:root {
  --bg: #0e0c16;
  --bg-deep: #11101a;
  --surface: #191523;
  --surface-strong: #211b2e;
  --surface-soft: rgba(245, 242, 251, 0.06);
  --line: #362d45;
  --line-strong: #726585;
  --text: #f5f2fb;
  --text-soft: #d8cde9;
  --text-muted: #b9aec9;
  --accent: #6d42d5;
  --accent-strong: #5630b5;
  --accent-soft: #c1a3ff;
  --info: #9cc6ff;
  --success: #80e3b6;
  --warning: #f5cb78;
  --danger: #ff9bac;
  --shadow-lg: 0 36px 90px rgba(1, 2, 10, 0.58);
  --shadow-md: 0 20px 50px rgba(1, 2, 10, 0.42);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", "Bahnschrift", sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(122, 76, 255, 0.18), transparent 24%),
    radial-gradient(circle at 82% 12%, rgba(180, 108, 255, 0.16), transparent 22%),
    radial-gradient(circle at 52% 74%, rgba(62, 24, 120, 0.24), transparent 28%),
    linear-gradient(145deg, #03030a 0%, #090414 32%, #12081f 64%, #06050b 100%);
  overflow-x: hidden;
}

body.portal-authenticated {
  background: radial-gradient(ellipse at 100% 0, #211732, transparent 48rem), var(--bg);
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  inset: 0.5rem auto auto 0.5rem;
  z-index: 5;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(214, 179, 255, 0.55) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(122, 76, 255, 0.4) 0 1px, transparent 1.4px);
  background-position: 0 0, 140px 80px, 280px 210px;
  background-size: 360px 360px, 420px 420px, 520px 520px;
  opacity: 0.2;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--text);
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.app-shell.is-authenticated {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.side-panel {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-deep);
  border-inline-end: 1px solid var(--line);
}

.side-panel > * {
  position: relative;
  z-index: 1;
}

.side-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.side-panel-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
}

.side-panel-content .profile-card { margin-block-start: auto; }

.portal-menu-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.brand-lockup,
.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark-shell,
.card-mark-shell {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  padding: 14px;
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(180, 108, 255, 0.24), rgba(122, 76, 255, 0.08)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(214, 179, 255, 0.22);
  box-shadow: 0 16px 34px rgba(122, 76, 255, 0.16);
}

.card-mark-shell {
  width: 68px;
  height: 68px;
}

.brand-mark,
.card-mark {
  width: 100%;
  filter: drop-shadow(0 0 18px rgba(180, 108, 255, 0.24));
}

.brand-wordmark {
  width: min(100%, 140px);
  filter: brightness(1.5) saturate(0.85);
}

.brand-block p,
.profile-card span {
  color: var(--text-muted);
}

.brand-block { min-width: 0; }
.brand-block p { margin: 0.35rem 0 0; overflow-wrap: anywhere; font-size: 0.85rem; }
.side-panel .brand-mark-shell { width: 44px; height: 44px; padding: 8px; border-radius: var(--radius-md); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.82rem;
  border-radius: 999px;
  border: 1px solid rgba(214, 179, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 0.35rem;
}

.main-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

.main-nav a[aria-current="page"] { border-inline-start: 3px solid var(--accent-soft); }

.profile-card {
  display: grid;
  gap: 0.45rem;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-wrap: anywhere;
}

.profile-card strong {
  font-size: 1.05rem;
}

.profile-label {
  color: var(--text-soft);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ghost-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.2rem;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(122, 76, 255, 0.34);
}

.primary-button:hover { background: var(--accent-strong); }

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  border-color: rgba(214, 179, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.ghost-button {
  margin-top: 0.8rem;
  border-color: rgba(214, 179, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.page-area {
  position: relative;
  min-width: 0;
  padding: 2rem;
}

.page-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(180, 108, 255, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(122, 76, 255, 0.12), transparent 24%);
  pointer-events: none;
}

.portal-authenticated .page-area::before { display: none; }

.page-frame {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.4rem;
  max-width: 1240px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.page-header h2,
.hero-card h2,
.detail-card h2,
.auth-card h2,
.auth-card h1 {
  margin: 0;
  font-family: "Bahnschrift SemiBold", "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  font-size: clamp(1.85rem, 3vw, 2.85rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.page-header p,
.muted {
  color: var(--text-muted);
  line-height: 1.65;
}

.hero-card,
.detail-card,
.metric-card,
.auth-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.hero-card,
.detail-card,
.auth-card {
  padding: 1.75rem;
}

.table-card {
  overflow: hidden;
}

.table-card .hero-card.page-header {
  border: 0;
  border-bottom: 1px solid rgba(214, 179, 255, 0.1);
  border-radius: 0;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.02);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 1.3rem;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -24px;
  right: -20px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122, 76, 255, 0.22), transparent 68%);
}

.metric-card span {
  display: block;
  color: var(--text-soft);
}

.metric-card strong {
  display: block;
  margin-top: 0.7rem;
  font-size: 2.35rem;
  letter-spacing: -0.04em;
}

.table-scroll {
  overflow-x: auto;
}

.ticket-table {
  width: 100%;
  border-collapse: collapse;
}

.ticket-table th,
.ticket-table td {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(214, 179, 255, 0.08);
  text-align: left;
}

.ticket-table th {
  color: var(--text-soft);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ticket-table tbody tr {
  transition: background 0.18s ease;
}

.ticket-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ticket-link {
  color: var(--text);
  font-weight: 700;
  transition: color 0.18s ease;
}

.ticket-title-link {
  display: inline-block;
  max-width: 460px;
  color: var(--text);
  font-weight: 650;
  transition: color 0.18s ease;
}

.ticket-title-link:hover,
.ticket-link:hover {
  color: var(--text-soft);
}

.table-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 0.78rem;
  border: 1px solid rgba(214, 179, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.table-action-link:hover {
  border-color: rgba(214, 179, 255, 0.32);
  background: rgba(122, 76, 255, 0.16);
  transform: translateY(-1px);
}

.status-pill,
.priority-pill {
  display: inline-flex;
  min-width: 118px;
  justify-content: center;
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  border: 1px solid rgba(214, 179, 255, 0.1);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill {
  background: var(--surface-strong);
  color: var(--text-soft);
}

.priority-pill {
  background: rgba(122, 76, 255, 0.12);
  color: var(--text);
}

.status-pill:is(.status-assigned, .status-claimed, .status-inprogress) {
  background: rgba(104, 170, 255, 0.14);
  color: var(--info);
}

.status-pill.status-waitingforcustomer {
  background: rgba(245, 203, 120, 0.14);
  color: var(--warning);
}

.status-pill.status-resolved,
.status-pill.status-closed {
  background: rgba(87, 230, 176, 0.14);
  color: var(--success);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.5rem;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--text-soft);
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(180, 108, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(122, 76, 255, 0.16);
}

.form-field textarea {
  min-height: 180px;
  resize: vertical;
}

.attachment-label {
  color: var(--text-soft);
  font-weight: 600;
}

.ticket-attachment-picker {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 82px;
  padding: 1rem;
  border: 1px dashed rgba(180, 108, 255, 0.38);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(122, 76, 255, 0.12), rgba(87, 230, 176, 0.04)),
    rgba(8, 6, 19, 0.5);
}

.ticket-attachment-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.ticket-file-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid rgba(214, 179, 255, 0.22);
  border-radius: 13px;
  background: rgba(122, 76, 255, 0.2);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ticket-file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 179, 255, 0.46);
  background: rgba(122, 76, 255, 0.34);
}

.ticket-attachment-picker strong,
.ticket-attachment-picker p {
  display: block;
}

.ticket-attachment-picker p,
.attachment-help {
  margin: 0.22rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.attachment-help {
  margin-top: -0.05rem;
}

.ticket-file-list,
.ticket-document-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-file-list:empty {
  display: none;
}

.ticket-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid rgba(214, 179, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.ticket-file-list span,
.ticket-document-link small {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.ticket-document-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem;
  border: 1px solid rgba(214, 179, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ticket-document-link:hover {
  transform: translateY(-1px);
  border-color: rgba(180, 108, 255, 0.38);
  background: rgba(122, 76, 255, 0.1);
}

.ticket-document-link strong,
.ticket-document-link small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-document-icon,
.ticket-document-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 0.66rem;
  border-radius: 999px;
  background: rgba(87, 230, 176, 0.12);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
}

.ticket-document-download {
  border: 1px solid rgba(214, 179, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.validation {
  color: var(--danger);
  font-size: 0.92rem;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.2rem;
}

.split-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 1rem;
}

.detail-stack,
.detail-meta,
.timeline,
.auth-form {
  display: grid;
  gap: 1rem;
}

.ticket-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .8rem;
  margin-block: .7rem;
}

.ticket-filters .form-field,
.report-period-form .form-field { min-width: 0; }
.ticket-filters input,
.ticket-filters select { width: 100%; }
.ticket-filters-basic { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ticket-advanced-filters { margin-block: 0.85rem; border-top: 1px solid var(--line); }
.ticket-advanced-filters summary { padding: 0.75rem 0.15rem; color: var(--text-soft); cursor: pointer; }
.attachment-limits { margin: 0; padding-inline-start: 1.2rem; }
.attachment-limits li + li { margin-top: 0.25rem; }
.ticket-detail-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-bottom: 0.75rem; }
.ticket-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-meta-row > * { min-width: 0; overflow-wrap: anywhere; }
.detail-stack > .detail-card h2 { font-size: clamp(1.2rem, 2vw, 1.55rem); }
.ticket-detail-heading .status-pill { min-width: 0; }
.ticket-filter-actions,
.ticket-pagination,
.report-period-form {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.report-period {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
}
.report-period h3,
.report-period p { margin: 0; }
.report-period p { margin-top: 0.25rem; font-size: 0.875rem; }
.report-period-form { align-items: flex-end; gap: 0.5rem; }
.report-period-form :is(select, button) { min-height: 44px; padding: 0.55rem 0.75rem; }
.ticket-pagination { padding: .9rem 1rem; justify-content: center; }
.ticket-filter-checkbox { display: inline-flex; gap: .4rem; align-items: center; margin-inline-end: .3rem; }
.ticket-product-name { display: block; color: var(--text-muted); margin-top: .25rem; overflow-wrap: anywhere; }
.export-limit-hint { padding-inline: 1rem; }
.contract-product-details { grid-column: 1 / -1; }
.contract-product-details summary { cursor: pointer; padding-block: .4rem; }
.kpi-card-link { color: inherit; text-decoration: none; }
.kpi-card-link:hover { border-color: var(--text-muted); }
.kpi-card-link:focus-visible,
.contract-product-details summary:focus-visible,
.table-scroll:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.detail-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(214, 179, 255, 0.08);
  color: var(--text-muted);
}

.detail-meta-row strong {
  color: var(--text);
  text-align: right;
}

.timeline-item {
  position: relative;
  padding-left: 1.25rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 0 6px rgba(122, 76, 255, 0.1);
}

.auth-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: clamp(1.4rem, 5vh, 3rem) clamp(1rem, 4vw, 2rem);
}

.page-area:has(> .auth-shell) { padding: 0; }
.page-area:has(> .auth-shell)::before { display: none; }

.auth-portal {
  position: relative;
  z-index: 1;
  width: min(100%, 25rem);
}

.auth-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 83% 76%, #42183f, transparent 61%),
    radial-gradient(ellipse at 8% 61%, #211b52, transparent 71%), #0e0b23;
}

.auth-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse min(37rem, 96vw) 49% at 50% 42%, #100c1c 8%, #100c1cc4 46%, transparent 100%);
}

.auth-shell .auth-card {
  display: grid;
  gap: 1.15rem;
  border: 0;
  padding: 0;
  background: none;
}

.nova-landscape {
  position: absolute;
  inset: -14px;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
}

.nova-world {
  transform: translate(var(--nova-x, 0px), var(--nova-y, 0px));
  transition: transform 260ms ease-out;
}

.nova-atmosphere { stroke-width: 37; filter: blur(19px); opacity: 0.52; }
.nova-halo { stroke-width: 6; filter: blur(4px); opacity: 0.67; }
.nova-rim { stroke-width: 1.45; opacity: 0.9; }
.nova-links {
  stroke: #bda5eb;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.38;
}

.nova-stars {
  fill: #d8c9f2;
  opacity: 0.68;
}

.nova-stars circle:nth-child(3n + 1) { opacity: 0.55; }

@media (min-width: 761px) and (prefers-reduced-motion: no-preference) {
  .auth-scene[data-intro="played"] .nova-rim { animation: nova-horizon-arrival 3s ease-out both; }
  .auth-scene[data-intro="played"] .nova-sky { animation: nova-sky-arrival 3.2s ease-out both; }
  .portal-login .auth-scene[data-intro="played"] + .auth-portal .auth-wordmark-o {
    animation: nova-wordmark-turn 4.4s cubic-bezier(.25, .55, .32, 1) both;
  }
}

@keyframes nova-horizon-arrival { from { opacity: 0.4; } to { opacity: 0.9; } }
@keyframes nova-sky-arrival { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes nova-wordmark-turn { from { transform: rotate(0); } to { transform: rotate(-1turn); } }

.auth-wordmark {
  /* The original 2669px wordmark's first O occupies the crop from x=301 to x=577. */
  --o-left: 11.27763%;
  --o-right: 21.61858%;
  position: relative;
  display: block;
  width: min(86%, 17.5rem);
  filter: brightness(1.7);
}

.auth-wordmark-letters {
  width: 100%;
  mask-image: linear-gradient(to right, #000 var(--o-left), transparent var(--o-left) var(--o-right), #000 var(--o-right));
}

.auth-wordmark-o {
  position: absolute;
  inset: 0 auto 0 var(--o-left);
  width: calc(var(--o-right) - var(--o-left));
  overflow: hidden;
}

.auth-wordmark-o img {
  position: absolute;
  top: 0;
  left: -109.05797%;
  width: 967.02899%;
  max-width: none;
  height: 100%;
}

.auth-shell .auth-card-brand {
  display: grid;
  justify-items: center;
  gap: 1.3rem;
  margin-bottom: 0.55rem;
  text-align: center;
}

.auth-shell .auth-card h1 { font-size: clamp(1.55rem, 3vw, 2.15rem); }
.auth-shell .auth-form { gap: 0.95rem; }
.auth-shell .form-field input { background: #151222e8; }
.auth-shell .validation:empty { display: none; }
.portal-login .auth-actions { display: grid; justify-items: stretch; text-align: center; gap: 0.8rem; }
.auth-setup-help { text-align: center; font-size: 0.87rem; color: var(--text-muted); }
.auth-setup-help summary { cursor: pointer; width: fit-content; margin-inline: auto; }
.auth-setup-help p { margin: 0.55rem 0 0; line-height: 1.5; }
.notice-card {
  padding: 1rem 1.1rem;
  border-radius: 22px;
  border: 1px solid rgba(214, 179, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(122, 76, 255, 0.16), rgba(180, 108, 255, 0.06)),
    rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.notice-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.notice-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.25rem;
  align-items: center;
}

.auth-recovery-link { color: var(--text-soft); text-decoration: underline; text-underline-offset: 0.2em; }

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .app-shell.is-authenticated {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .side-panel {
    position: relative;
    min-height: auto;
    padding: 0.7rem 1rem;
    gap: 0.6rem;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-grid,
  .split-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-area {
    padding: 1rem;
  }

  .auth-shell { padding-inline: clamp(1rem, 6vw, 2.5rem); }

  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .hero-card,
  .detail-card {
    padding: 1.3rem;
  }

  .brand-mark-shell,
  .card-mark-shell {
    width: 60px;
    height: 60px;
    padding: 12px;
  }


  .ticket-table th,
  .ticket-table td {
    padding: 0.85rem 0.9rem;
  }
}

body.portal-authenticated::before { display: none; }

.portal-authenticated .hero-card,
.portal-authenticated .detail-card,
.portal-authenticated .metric-card,
.portal-authenticated .auth-card,
.portal-authenticated .table-card,
.portal-authenticated .dashboard-panel,
.portal-authenticated .contract-panel,
.portal-authenticated .kpi-card {
  backdrop-filter: none;
}

.portal-dashboard {
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
}

.dashboard-alerts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.dashboard-alerts .unread-summary {
  padding: 0.75rem 0.85rem;
  min-width: 0;
}

.dashboard-alerts .unread-summary:hover { border-color: var(--accent-soft); }
.dashboard-waiting .unread-reply-tag { color: var(--warning); border-color: currentColor; }

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.dashboard-header h2,
.dashboard-panel h3,
.table-card-header h3,
.contract-panel h3 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0;
  line-height: 1.2;
}

.dashboard-header p,
.contract-panel p {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
}

.dashboard-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.contract-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.75fr);
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--success);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.contract-status-missing,
.contract-status-expiring { border-inline-start-color: var(--warning); }

.contract-main {
  min-width: 0;
}

.contract-label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--text-soft);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.contract-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.contract-meta div,
.kpi-card,
.dashboard-panel {
  border: 1px solid rgba(214, 179, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

.contract-meta div {
  padding: 0.75rem;
  border-radius: 14px;
}

.contract-meta span,
.kpi-card span,
.trend-column span {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.contract-meta strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--text);
  line-height: 1.3;
}

.contract-products {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.public-reply {
  min-width: 0;
  padding: .85rem 1rem;
  border-inline-start: 2px solid currentColor;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .035);
}

.public-reply-support { border-inline-start-color: #a682ef; }
.public-reply header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .35rem 1rem; }
.public-reply time { font-size: .8rem; opacity: .8; }
.public-reply-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-item-content { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin-top: .35rem; }
.notification-item-content .public-reply-body { flex: 1 1 14rem; min-width: 0; }
.notification-item-action .ghost-button { min-height: 40px; }

.dashboard-activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dashboard-activity-subject { display: block; margin-top: .3rem; overflow-wrap: anywhere; }

.unread-reply-tag {
  display: inline-block;
  margin: .2rem .25rem;
  padding: .2rem .55rem;
  border: 1px solid currentColor;
  border-radius: .5rem;
  color: var(--accent-text, var(--text));
  font-size: .78rem;
  font-weight: 700;
}

.unread-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  text-decoration: none;
  color: var(--text);
}

.unread-summary small { display: block; color: var(--text-muted); }
.unread-summary:hover { border-color: var(--accent); }

.contract-products:is(ul) {
  list-style: none;
  padding: 0;
}

.contract-products :is(span, li) {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(214, 179, 255, 0.13);
  border-radius: 999px;
  background: rgba(8, 6, 19, 0.44);
  color: var(--text);
  font-size: 0.86rem;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.kpi-card {
  position: relative;
  min-height: 106px;
  padding: 1rem;
  border-radius: 16px;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  opacity: 0.75;
}

.kpi-open::before { background: var(--text-muted); }
.kpi-progress::before { background: var(--info); }

.kpi-card strong {
  display: inline-flex;
  align-items: baseline;
  margin-top: 0.45rem;
  color: var(--text);
  font-size: 2rem;
  letter-spacing: 0;
  line-height: 1;
}

.kpi-card small {
  margin-left: 0.35rem;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.dashboard-panel {
  min-height: 0;
  padding: 1.05rem;
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.panel-heading p {
  flex-basis: 100%;
  margin: 0;
}

.bar-chart {
  display: grid;
  gap: 0.9rem;
}

.chart-row {
  display: grid;
  gap: 0.45rem;
}

.chart-row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.chart-row-label strong {
  color: var(--text);
}

.chart-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(214, 179, 255, 0.08);
}

.chart-fill,
.trend-fill {
  display: block;
  width: 100%;
  height: 100%;
}

.report-bar {
  fill: var(--accent-soft);
  transform-box: fill-box;
}

.chart-row-critical .report-bar {
  fill: var(--danger);
}

.chart-row-high .report-bar,
.chart-row-waiting .report-bar {
  fill: var(--warning);
}

.chart-row-progress .report-bar { fill: var(--info); }

.chart-row-resolved .report-bar,
.chart-row-closed .report-bar,
.chart-row-low .report-bar {
  fill: var(--success);
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 0.6rem;
  min-height: 198px;
}

.trend-column {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 0.35rem;
  min-width: 0;
  text-align: center;
}

.trend-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 138px;
  border-radius: 14px;
  background: rgba(214, 179, 255, 0.07);
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .is-chart-entering .chart-fill .report-bar {
    transform-origin: left center;
    animation: report-reveal-x 540ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .is-chart-entering .trend-fill .report-bar {
    transform-origin: center bottom;
    animation: report-reveal-y 620ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes report-reveal-x {
  from { transform: scaleX(0.65); opacity: 0.6; }
}

@keyframes report-reveal-y {
  from { transform: scaleY(0.65); opacity: 0.6; }
}

.trend-column strong {
  color: var(--text);
  font-size: 0.95rem;
}

.dashboard-table-card {
  border-radius: 18px;
}

.dashboard-ticket-label {
  display: none;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.1rem;
  border-bottom: 1px solid rgba(214, 179, 255, 0.1);
}

.ticket-subject {
  display: block;
  max-width: 420px;
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .kpi-strip,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .report-period,
  .dashboard-alerts {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-header,
  .contract-panel,
  .table-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-header {
    display: grid;
    padding: 0.9rem 1rem;
  }

  .dashboard-header-actions {
    width: 100%;
  }

  .dashboard-header-actions :is(.primary-button, .secondary-button) {
    min-height: 44px;
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
  }

  .portal-dashboard .dashboard-header-actions .primary-button { width: 100%; }
  .ticket-filters-basic { grid-template-columns: minmax(0, 1fr); }
  .dashboard-alerts .unread-summary { border-radius: var(--radius-lg); }

  .contract-panel,
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .contract-meta { grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); }

  .dashboard-panel {
    min-height: 0;
  }

  .trend-panel {
    grid-column: auto;
  }

  .trend-chart {
    gap: 0.35rem;
    min-height: 0;
  }

  .trend-track {
    height: 112px;
  }

  .trend-column span {
    overflow-wrap: anywhere;
  }

  .dashboard-header h2,
  .contract-meta strong {
    overflow-wrap: anywhere;
  }

  .dashboard-ticket-scroll {
    overflow: visible;
    padding: .65rem;
  }

  .dashboard-ticket-table,
  .dashboard-ticket-table tbody {
    display: block;
  }

  .dashboard-ticket-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .dashboard-ticket-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem .75rem;
    margin-block: .55rem;
    padding: .85rem;
    border: 1px solid rgba(214, 179, 255, 0.15);
    border-radius: 14px;
    background: rgba(214, 179, 255, 0.045);
  }

  .dashboard-ticket-table td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .dashboard-ticket-number,
  .dashboard-ticket-topic,
  .dashboard-ticket-action,
  .dashboard-ticket-empty {
    grid-column: 1 / -1;
  }

  .dashboard-ticket-table .ticket-subject {
    max-width: none;
    overflow: visible;
    white-space: normal;
  }

  .dashboard-ticket-label {
    display: block;
    margin-bottom: .18rem;
    color: var(--text-muted);
    font-size: .8rem;
  }

  .dashboard-ticket-table :is(.status-pill, .priority-pill) {
    max-width: 100%;
    white-space: normal;
  }

  .dashboard-ticket-action .table-action-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nova-world { transform: none; }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
