/* ============================================================ tokens */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --line: #e3e9f2;
  --line-strong: #cbd5e1;
  --ink: #0f1b2d;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --brand: #0b2545;
  --brand-2: #12365d;
  --accent: #0a8ea8;
  --accent-soft: #e2f6fa;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef4e6;
  --ok: #047857;
  --ok-soft: #e7f8f1;
  --st-open: #2563eb;
  --st-open-bg: #e8efff;
  --st-assigned: #7c3aed;
  --st-assigned-bg: #f0e9ff;
  --st-progress: #b45309;
  --st-progress-bg: #fdf0dc;
  --st-resolved: #047857;
  --st-resolved-bg: #e2f7ee;
  --st-closed: #526071;
  --st-closed-bg: #eceff4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05);
  --shadow: 0 14px 34px -20px rgba(15, 27, 45, 0.28);
  --shadow-lg: 0 30px 60px -30px rgba(8, 20, 40, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 252px;
}

[data-theme="dark"] {
  --bg: #070d18;
  --surface: #0e1727;
  --surface-2: #111d30;
  --surface-3: #16243a;
  --line: #1e2c42;
  --line-strong: #2b3d59;
  --ink: #e8eef9;
  --ink-2: #c3cfdf;
  --muted: #8797ad;
  --faint: #64748b;
  --brand: #0a1d36;
  --brand-2: #0e2a4c;
  --accent: #33c9e3;
  --accent-soft: #0c2b36;
  --danger: #f87171;
  --danger-soft: #2a1417;
  --warn: #fbbf24;
  --warn-soft: #2a2010;
  --ok: #34d399;
  --ok-soft: #0d2a22;
  --st-open: #7aa2ff;
  --st-open-bg: #16233f;
  --st-assigned: #b79bff;
  --st-assigned-bg: #211a3a;
  --st-progress: #fbbf24;
  --st-progress-bg: #33260d;
  --st-resolved: #34d399;
  --st-resolved-bg: #102a23;
  --st-closed: #91a1b6;
  --st-closed-bg: #1a2434;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
}

/* ============================================================ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 {
  font-size: 19px;
}

h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 15px;
}

p {
  margin: 0;
}

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

button {
  font: inherit;
  color: inherit;
}

ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

.wrap {
  overflow-wrap: anywhere;
}

.spacer {
  flex: 1;
}

.req {
  color: var(--danger);
  margin-left: 3px;
}

/* ============================================================ shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px 16px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(13, 219, 255, 0.16) 0%, transparent 55%),
    linear-gradient(180deg, #0b2545 0%, #0a1f3a 55%, #081a30 100%);
  color: #d9e6f7;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #0ddbff 0%, #0891b2 100%);
  color: #04202c;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.03em;
  box-shadow: 0 6px 16px -6px rgba(13, 219, 255, 0.7);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-text span {
  font-size: 11.5px;
  color: rgba(217, 230, 247, 0.62);
}

.brand-lg .brand-mark {
  width: 42px;
  height: 42px;
  font-size: 20px;
  border-radius: 12px;
}

.brand-lg .brand-text strong {
  font-size: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(217, 230, 247, 0.74);
  font-size: 13.8px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-item-active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-weight: 600;
}

.nav-item-active .icon {
  color: #0ddbff;
}

.nav-marker {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: #0ddbff;
}

.nav-spacer {
  flex: 1;
}

.sidebar-tip {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(217, 230, 247, 0.68);
}

.sidebar-tip p {
  font-size: 11.8px;
  line-height: 1.45;
}

.sidebar-tip .icon {
  color: #0ddbff;
  flex: none;
  margin-top: 2px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.sidebar-user-text strong {
  font-size: 13px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-text span {
  font-size: 11.5px;
  color: rgba(217, 230, 247, 0.6);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-menu {
  display: none;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  font-size: 17px;
  line-height: 1.2;
}

.topbar-title p {
  font-size: 12.3px;
  color: var(--muted);
  margin-top: 2px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  width: min(340px, 30vw);
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.topbar-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.topbar-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.2px;
}

.topbar-search kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--faint);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 26px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.2px;
}

.banner-warn {
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--warn);
}

.banner-link {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content {
  padding: 22px 26px 64px;
  width: 100%;
  max-width: 1480px;
}

.nav-scrim {
  display: none;
}

/* ============================================================ page */
.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: page-in 0.22s ease both;
}

.page-narrow {
  max-width: 820px;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h2 {
  font-size: 20px;
}

.page-head p {
  margin-top: 3px;
  font-size: 13.2px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* ============================================================ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13.4px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease,
    box-shadow 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.6px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(180deg, var(--brand-2) 0%, var(--brand) 100%);
  color: #ffffff;
  box-shadow: 0 8px 18px -10px rgba(11, 37, 69, 0.7);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #17497a 0%, #0d2d52 100%);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(180deg, #1d64a8 0%, #174d81 100%);
  border-color: #2b7dc4;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--faint);
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-subtle {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn-xs {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.icon-btn-invert {
  color: rgba(217, 230, 247, 0.7);
}

.icon-btn-invert:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.spinner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-padded {
  padding: 18px 20px;
}

.card-accent {
  background:
    radial-gradient(120% 100% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 60%),
    var(--surface);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.card-head-tight {
  border-bottom: 0;
  padding-bottom: 8px;
}

.card-head h3 {
  font-size: 14.5px;
}

.card-head p {
  font-size: 12.3px;
  color: var(--muted);
  margin-top: 2px;
}

.card-padded .card-head {
  padding: 0 0 12px;
  border-bottom: 0;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.6px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.link-arrow:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================ kpi */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 15px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
}

.kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kpi-value {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 12.8px;
  font-weight: 600;
  margin-top: 2px;
}

.kpi-caption {
  font-size: 11.5px;
  color: var(--muted);
}

.kpi-blue .kpi-icon {
  background: var(--st-open-bg);
  color: var(--st-open);
}
.kpi-violet .kpi-icon {
  background: var(--st-assigned-bg);
  color: var(--st-assigned);
}
.kpi-amber .kpi-icon {
  background: var(--st-progress-bg);
  color: var(--st-progress);
}
.kpi-red .kpi-icon {
  background: var(--danger-soft);
  color: var(--danger);
}
.kpi-green .kpi-icon {
  background: var(--st-resolved-bg);
  color: var(--st-resolved);
}

/* ============================================================ dashboard */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.dash-main,
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

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

.dash-columns .card {
  padding: 16px 18px;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.mini-row:hover {
  background: var(--surface-2);
}

.mini-ref {
  color: var(--muted);
  flex: none;
}

.mini-subject {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.stack-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  margin: 4px 0 12px;
}

.stack-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.legend {
  display: grid;
  gap: 6px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.legend-label {
  flex: 1;
  color: var(--ink-2);
}

.legend-value {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.stat-hero {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat-hero-label {
  font-size: 12.3px;
  color: var(--muted);
  font-weight: 500;
}

.stat-hero-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.stat-hero-caption {
  font-size: 11.8px;
  color: var(--muted);
}

.stat-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stat-split div {
  display: flex;
  flex-direction: column;
}

.stat-split-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-split-label {
  font-size: 11.8px;
  color: var(--muted);
}

.oldest-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color 0.15s ease;
}

.oldest-card:hover {
  border-color: var(--accent);
}

.oldest-card strong {
  font-size: 13.4px;
  line-height: 1.35;
}

.oldest-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.workload {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.workload li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 54px 18px;
  align-items: center;
  gap: 9px;
  font-size: 12.8px;
}

.workload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-bar,
.cat-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.workload-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #0ddbff);
}

.workload-count,
.cat-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cat-list li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 70px 20px;
  align-items: center;
  gap: 9px;
  font-size: 12.7px;
}

.cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.cat-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* ============================================================ table */
.table-wrap {
  overflow-x: auto;
}

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

.table th {
  text-align: left;
  font-size: 11.4px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th:first-child {
  padding-left: 20px;
}

.table th:last-child {
  padding-right: 20px;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.2px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.table td:first-child {
  padding-left: 20px;
}

.table td:last-child {
  padding-right: 20px;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.row-click {
  cursor: pointer;
  transition: background 0.12s ease;
}

.row-click:hover {
  background: var(--surface-2);
}

.cell-subject {
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cell-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 11.9px;
  flex-wrap: wrap;
}

.cell-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11.9px;
}

.cell-person {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
}

.unassigned {
  color: var(--faint);
  font-size: 12.6px;
  font-style: italic;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.7px;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 2px 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 12.7px;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-page {
  font-variant-numeric: tabular-nums;
}

/* ============================================================ status & priority */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-md {
  padding: 3px 10px;
  font-size: 12.2px;
}

.status-sm {
  padding: 2px 8px;
  font-size: 11.6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.status-open {
  color: var(--st-open);
  background: var(--st-open-bg);
  border-color: color-mix(in srgb, var(--st-open) 22%, transparent);
}
.status-assigned {
  color: var(--st-assigned);
  background: var(--st-assigned-bg);
  border-color: color-mix(in srgb, var(--st-assigned) 22%, transparent);
}
.status-in_progress {
  color: var(--st-progress);
  background: var(--st-progress-bg);
  border-color: color-mix(in srgb, var(--st-progress) 24%, transparent);
}
.status-resolved {
  color: var(--st-resolved);
  background: var(--st-resolved-bg);
  border-color: color-mix(in srgb, var(--st-resolved) 22%, transparent);
}
.status-closed {
  color: var(--st-closed);
  background: var(--st-closed-bg);
  border-color: color-mix(in srgb, var(--st-closed) 22%, transparent);
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.6px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.priority::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.priority-low {
  color: var(--muted);
  background: var(--surface-3);
}
.priority-normal {
  color: var(--st-open);
  background: var(--st-open-bg);
}
.priority-high {
  color: var(--warn);
  background: var(--warn-soft);
}
.priority-urgent {
  color: var(--danger);
  background: var(--danger-soft);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10.8px;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-admin {
  background: var(--st-assigned-bg);
  color: var(--st-assigned);
}
.role-agent {
  background: var(--st-open-bg);
  color: var(--st-open);
}
.role-requester {
  background: var(--surface-3);
  color: var(--muted);
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.6px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.state-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.state-on {
  color: var(--ok);
  background: var(--ok-soft);
}

.state-off {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ============================================================ avatar */
.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 650;
  font-size: 11px;
  letter-spacing: 0.01em;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 9px;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 10.5px;
}
.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 12.5px;
}
.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 17px;
}

/* ============================================================ forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-hint {
  font-size: 11.8px;
  color: var(--muted);
}

.field-error-text {
  font-size: 11.8px;
  color: var(--danger);
}

.input {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.input::placeholder {
  color: var(--faint);
}

.input-sm {
  padding: 5px 9px;
  font-size: 12.6px;
  border-radius: 8px;
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.select-sm {
  width: auto;
  max-width: 190px;
  cursor: pointer;
}

.field-error .input {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface));
}

.input-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.input-with-icon:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.input-with-icon .input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
  background: transparent;
}

.input-with-icon .input:focus {
  box-shadow: none;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-3);
  border-radius: 10px;
  border: 1px solid var(--line);
  flex-wrap: wrap;
}

.segment {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12.4px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.segment:hover {
  color: var(--ink);
}

.segment-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segment-active.segment-low {
  color: var(--st-closed);
}
.segment-active.segment-normal {
  color: var(--st-open);
}
.segment-active.segment-high {
  color: var(--warn);
}
.segment-active.segment-urgent {
  color: var(--danger);
}

/* ============================================================ filter bar */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.7px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip-count {
  font-size: 11.4px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 6px;
  min-width: 18px;
  text-align: center;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.chip-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

[data-theme="dark"] .chip-active {
  background: #1d4ed8;
  border-color: #2563eb;
}

.chip-active .chip-count {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.chip-open {
  color: var(--st-open);
}
.chip-assigned {
  color: var(--st-assigned);
}
.chip-in_progress {
  color: var(--st-progress);
}
.chip-resolved {
  color: var(--st-resolved);
}
.chip-closed {
  color: var(--st-closed);
}

.chip-active.chip-open,
.chip-active.chip-assigned,
.chip-active.chip-in_progress,
.chip-active.chip-resolved,
.chip-active.chip-closed {
  color: #ffffff;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  min-width: 230px;
  flex: 1;
  max-width: 380px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.filter-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.filter-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.view-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.view-btn-active {
  background: var(--surface-3);
  color: var(--ink);
}

/* ============================================================ board */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.board-col {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 160px;
  max-height: calc(100vh - 260px);
}

.board-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.board-count {
  font-size: 11.6px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  margin-right: auto;
}

.board-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.board-empty {
  text-align: center;
  color: var(--faint);
  font-size: 12.2px;
  padding: 18px 0;
}

.board-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.board-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.board-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-card-title {
  font-size: 13.1px;
  font-weight: 550;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-card-person {
  flex: none;
}

.board-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.4px;
  color: var(--faint);
  border-top: 1px dashed var(--line);
  padding-top: 7px;
}

.board-more {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.8px;
  cursor: pointer;
  padding: 4px;
}

.board-more:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ============================================================ ticket detail */
.page-ticket {
  gap: 14px;
}

.ticket-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.8px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-weight: 550;
}

.back-link:hover {
  color: var(--ink);
}

.crumb-sep {
  color: var(--faint);
}

.ticket-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.ticket-main,
.ticket-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ticket-header {
  padding: 20px 22px;
}

.ticket-title-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.ticket-title-block {
  flex: 1;
  min-width: 0;
}

.ticket-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.ticket-title {
  font-size: 21px;
  line-height: 1.32;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.ticket-submeta {
  margin-top: 7px;
  font-size: 12.7px;
  color: var(--muted);
}

.ticket-description {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.ticket-description p {
  white-space: pre-wrap;
}

.edit-block {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.resolution-card {
  padding: 16px 20px;
  border-left: 3px solid var(--st-resolved);
}

.resolution-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.resolution-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--st-resolved-bg);
  color: var(--st-resolved);
}

.resolution-body {
  margin-top: 10px;
  font-size: 13.6px;
  color: var(--ink-2);
  white-space: pre-wrap;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 20px 14px;
}

.timeline-empty {
  padding: 12px 0;
}

.comment {
  display: flex;
  gap: 11px;
  padding: 12px 0;
}

.comment + .comment {
  border-top: 1px solid var(--line);
}

.comment-internal {
  margin: 4px -10px;
  padding: 12px 10px;
  background: var(--warn-soft);
  border-radius: 10px;
  border: 1px dashed color-mix(in srgb, var(--warn) 35%, transparent);
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12.8px;
}

.comment-head strong {
  font-size: 13px;
}

.comment-head .muted {
  margin-left: auto;
  font-size: 11.7px;
}

.comment-text {
  margin-top: 5px;
  font-size: 13.8px;
  color: var(--ink-2);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-wrap: anywhere;
}

.comment-text p {
  white-space: pre-wrap;
}

.internal-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.8px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-radius: 5px;
  padding: 1px 6px;
}

.event {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 5px 0;
  color: var(--muted);
  font-size: 12.4px;
}

.event-marker {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  margin-top: 1px;
}

.event-status .event-marker {
  background: var(--st-progress-bg);
  color: var(--st-progress);
}
.event-assignee .event-marker {
  background: var(--st-assigned-bg);
  color: var(--st-assigned);
}
.event-created .event-marker {
  background: var(--st-open-bg);
  color: var(--st-open);
}
.event-comment .event-marker {
  background: var(--surface-3);
}

.event p {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event strong {
  color: var(--ink-2);
  font-weight: 600;
}

.event-note {
  color: var(--ink-2);
}

.event-time {
  color: var(--faint);
  font-size: 11.3px;
  margin-left: 5px;
  white-space: nowrap;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 14px 20px 16px;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.composer-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 9px;
}

.composer-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.3px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.composer-tab:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.composer-tab-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.composer-input {
  background: var(--surface);
  min-height: 82px;
}

.composer-internal {
  background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.side-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 12px;
}

.side-hint {
  font-size: 12.2px;
  color: var(--muted);
  margin-top: 8px;
}

.stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stepper-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  color: var(--faint);
  font-size: 12.6px;
}

.stepper-step::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}

.stepper-step:last-child::before {
  display: none;
}

.stepper-dot {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  flex: none;
  color: #fff;
  z-index: 1;
}

.stepper-label {
  font-weight: 550;
}

.stepper-current {
  color: var(--ink);
}

.stepper-current .stepper-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.stepper-current .stepper-label {
  font-weight: 700;
}

.stepper-done {
  color: var(--ink-2);
}

.stepper-done .stepper-dot {
  border-color: var(--st-resolved);
  background: var(--st-resolved);
}

.stepper-done::before {
  background: color-mix(in srgb, var(--st-resolved) 45%, var(--line));
}

.stepper-open .stepper-dot {
  border-color: var(--st-open);
}
.stepper-assigned .stepper-dot {
  border-color: var(--st-assigned);
}
.stepper-in_progress .stepper-dot {
  border-color: var(--st-progress);
}
.stepper-resolved .stepper-dot {
  border-color: var(--st-resolved);
}

.stage-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.side-dates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.side-dates div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.2px;
}

.side-dates span {
  color: var(--muted);
}

.side-dates strong {
  font-weight: 600;
  text-align: right;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.detail-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 12.8px;
}

.detail-label {
  color: var(--muted);
}

.detail-select {
  width: 100%;
  max-width: none;
}

.detail-sub {
  display: block;
  margin-top: 1px;
}

/* ============================================================ people / audit */
.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  width: fit-content;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12.8px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab-active {
  background: var(--surface-3);
  color: var(--ink);
}

.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.person-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.you-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0 5px;
  border-radius: 4px;
  margin-left: 6px;
}

.actions-cell {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.audit-toolbar {
  display: flex;
  gap: 9px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.cred-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cred-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
}

.cred-row span {
  color: var(--muted);
}

.cred-password {
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* ============================================================ profile */
.account-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-head h3 {
  font-size: 17px;
}

.account-head p {
  font-size: 12.8px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.account-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-facts dt {
  font-size: 11.4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.account-facts dd {
  font-size: 13.4px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.password-form {
  max-width: 560px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-list li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.session-list li:last-child {
  border-bottom: 0;
}

.session-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--muted);
  flex: none;
}

.session-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13px;
  min-width: 0;
}

/* ============================================================ modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 18px 24px;
  background: rgba(8, 17, 31, 0.55);
  backdrop-filter: blur(3px);
  animation: fade-in 0.15s ease both;
}

.modal {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.modal-sm {
  max-width: 430px;
}

.modal-lg {
  max-width: 680px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 12px;
}

.modal-head h2 {
  font-size: 17px;
}

.modal-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.modal-body {
  padding: 6px 20px 18px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

.confirm-message {
  font-size: 13.6px;
  color: var(--ink-2);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}

/* ============================================================ misc */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 13px;
  border: 1px solid transparent;
}

.alert .icon {
  flex: none;
  margin-top: 1px;
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.alert-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  padding: 46px 20px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--surface-3);
  color: var(--muted);
  margin-bottom: 4px;
}

.empty h3 {
  font-size: 15px;
}

.empty p {
  font-size: 13px;
  color: var(--muted);
  max-width: 340px;
}

.empty-action {
  margin-top: 6px;
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line {
  height: 13px;
}

.skeleton-chip {
  width: 76px;
  height: 22px;
  border-radius: 999px;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13.2px;
  animation: toast-in 0.2s ease both;
  overflow-wrap: anywhere;
}

.toast .icon {
  flex: none;
  margin-top: 1px;
}

.toast-success .icon {
  color: var(--ok);
}
.toast-error .icon {
  color: var(--danger);
}
.toast-info .icon {
  color: var(--accent);
}

.toast-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  background:
    radial-gradient(80% 50% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%),
    var(--bg);
}

.boot-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}

.boot-fallback {
  max-width: 460px;
  text-align: center;
  padding: 24px;
}

/* ============================================================ login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 56px clamp(32px, 6vw, 80px);
  color: #e8f2ff;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(13, 219, 255, 0.22) 0%, transparent 55%),
    radial-gradient(70% 60% at 100% 100%, rgba(37, 99, 235, 0.28) 0%, transparent 60%),
    linear-gradient(160deg, #0b2545 0%, #081b33 60%, #061426 100%);
}

.login-brand-inner {
  position: relative;
  z-index: 2;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-brand h1 {
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: #ffffff;
  font-weight: 700;
}

.login-lede {
  font-size: 14.4px;
  color: rgba(224, 237, 253, 0.72);
  max-width: 420px;
  line-height: 1.65;
}

.login-points {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 4px;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.4px;
  color: rgba(224, 237, 253, 0.86);
}

.login-point-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(13, 219, 255, 0.14);
  border: 1px solid rgba(13, 219, 255, 0.3);
  color: #0ddbff;
  flex: none;
}

.login-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(13, 219, 255, 0.16);
  pointer-events: none;
}

.login-orbit-1 {
  width: 520px;
  height: 520px;
  right: -180px;
  top: -160px;
}

.login-orbit-2 {
  width: 760px;
  height: 760px;
  right: -320px;
  bottom: -420px;
  border-color: rgba(13, 219, 255, 0.09);
}

.login-form-side {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.login-card {
  width: 100%;
  max-width: 392px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px 30px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card-head h2 {
  font-size: 23px;
  letter-spacing: -0.025em;
}

.login-card-head p {
  font-size: 13.2px;
  color: var(--muted);
  margin-top: 4px;
}

.login-help {
  font-size: 11.9px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ============================================================ responsive */
@media (max-width: 1240px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .dash-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
  }
}

@media (max-width: 1024px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-w);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }

  .shell-nav-open .sidebar {
    transform: none;
  }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(8, 17, 31, 0.5);
  }

  .topbar-menu {
    display: inline-grid;
  }

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

  .ticket-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 12px 16px;
  }

  .topbar-search {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .content {
    padding: 16px 14px 56px;
  }

  .banner {
    margin: 12px 14px 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-columns,
  .dash-side,
  .ticket-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-row,
  .account-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-brand {
    padding: 36px 26px;
  }

  .login-brand h1 {
    font-size: 27px;
  }

  .login-orbit {
    display: none;
  }

  .filter-search {
    max-width: none;
  }

  .select-sm {
    max-width: none;
    flex: 1;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-head {
    align-items: flex-start;
  }

  .table-tickets th:nth-child(3),
  .table-tickets td:nth-child(3),
  .table-tickets th:nth-child(4),
  .table-tickets td:nth-child(4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
