:root {
  --demo-top: 0px;
  --bg: #f2f7f6;
  --bg-2: #e6eeec;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --text: #0f2622;
  --text-2: #334b46;
  --muted: #64807a;
  --faint: #94a8a3;
  --border: #e0eae8;
  --border-2: #c8d8d5;
  --primary: #0d9488;
  --primary-2: #14b8a6;
  --primary-soft: #ccfbf1;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --shadow-sm: 0 1px 2px rgba(15, 38, 34, 0.05);
  --shadow: 0 4px 14px rgba(15, 38, 34, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 38, 34, 0.16);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --topbar-h: 60px;
  --sidebar-w: 264px;
  --font: system-ui, 'Segoe UI', Tahoma, sans-serif;
}
html[data-theme='dark'] {
  --bg: #061815;
  --bg-2: #0d2622;
  --surface: #122a26;
  --surface-2: #1a3833;
  --text: #d1fae5;
  --text-2: #a7f3d0;
  --muted: #6ea699;
  --faint: #4d7b71;
  --border: #1e403a;
  --border-2: #2d5d54;
  --primary: #2dd4bf;
  --primary-2: #5eead4;
  --primary-soft: #042f2a;
  --accent: #fbbf24;
  --accent-soft: #3b2a06;
  --success: #4ade80;
  --success-soft: #052e1a;
  --warn: #fbbf24;
  --warn-soft: #3b2a06;
  --danger: #f87171;
  --danger-soft: #3b0e0e;
  --info: #60a5fa;
  --info-soft: #0c1e3d;
  --purple: #a78bfa;
  --purple-soft: #1e1b4b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.6);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  padding-top: var(--demo-top, 0px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 8px;
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: linear-gradient(160deg, var(--primary) 0%, #0f766e 55%, #115e59 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.45s,
    visibility 0.45s;
}
html[data-theme='dark'] .splash {
  background: linear-gradient(160deg, #042f2a 0%, #031a16 60%, #010d0b 100%);
}
.splash.hide {
  opacity: 0;
  visibility: hidden;
}
.splash-inner {
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: splashIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes splashIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.splash-logo {
  width: 82px;
  height: 82px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: blur(6px);
}
.splash-brandname {
  filter: blur(7px);
  font-weight: 800;
  font-size: 20px;
}
.splash-generic {
  font-size: 12px;
  opacity: 0.85;
  margin-top: -8px;
}
.splash-title {
  font-size: 19px;
  font-weight: 700;
  margin-top: 4px;
}
.splash-credit {
  font-size: 10.5px;
  letter-spacing: 3px;
  font-weight: 300;
  opacity: 0.75;
  margin-top: 24px;
}
.splash-credit span {
  animation: glow 2.6s ease-in-out infinite;
}
@keyframes glow {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
html.mobile-layout .app-shell {
  grid-template-columns: 1fr;
}
.sidebar {
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--demo-top, 0px);
  height: calc(100dvh - var(--demo-top, 0px));
  overflow-y: auto;
}
html.mobile-layout .sidebar {
  display: none;
}
.side-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  filter: blur(5px);
}
.brand-txt {
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 14px;
  filter: blur(6px);
  white-space: nowrap;
  overflow: hidden;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
}
.lock-mini {
  margin-inline-start: auto;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--muted);
  flex-shrink: 0;
  cursor: help;
}
.lock-mini:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.side-nav {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s;
  text-align: start;
  width: 100%;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-2);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
html[data-theme='dark'] .nav-item.active {
  color: var(--primary-2);
}
.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
.nav-badge {
  margin-inline-start: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-sep {
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}
.side-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.role-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.role-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.role-btn .r-ic {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.credit {
  font-size: 10px;
  letter-spacing: 2.6px;
  font-weight: 300;
  color: var(--faint);
  text-align: center;
  margin-top: 8px;
}

/* Main */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: var(--demo-top, 0px);
  z-index: 60;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.topbar-title {
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-title .t-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-title .t-ic svg {
  width: 17px;
  height: 17px;
}
.spacer {
  flex: 1;
}
html.mobile-layout {
  --topbar-h: 84px;
}
html.mobile-layout .topbar {
  flex-wrap: wrap;
  align-content: center;
  gap: 2px 6px;
  padding-inline: 10px;
}
html.mobile-layout .spacer {
  display: none;
}
html.mobile-layout .badge-demo {
  order: 10;
  margin-inline-start: auto;
}
html.mobile-layout .topbar-title {
  flex: 1 1 auto;
  overflow: hidden;
}
html.mobile-layout .topbar-title .t-txt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.3;
}
.badge-demo {
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
}
html[data-theme='dark'] .role-chip {
  color: var(--primary-2);
}
.role-chip .r-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  position: relative;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: var(--bg-2);
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
.dot-badge {
  position: absolute;
  top: 5px;
  inset-inline-end: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.content {
  padding: 18px;
  max-width: 1340px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
html.mobile-layout .content {
  padding: 14px 14px 96px;
}

/* Bottom nav */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
}
html.mobile-layout .bottom-nav {
  display: flex;
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  min-height: 48px;
  justify-content: center;
  position: relative;
}
.bn-item svg {
  width: 21px;
  height: 21px;
}
.bn-item.active {
  color: var(--primary);
}
html[data-theme='dark'] .bn-item.active {
  color: var(--primary-2);
}
.bn-ic-wrap {
  padding: 3px 10px;
  border-radius: 10px;
  display: flex;
}
.bn-item.active .bn-ic-wrap {
  background: var(--primary-soft);
}
.fab {
  display: none;
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  inset-inline-end: 16px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 71;
  align-items: center;
  justify-content: center;
}
html.mobile-layout .fab {
  display: flex;
}
.fab svg {
  width: 24px;
  height: 24px;
}

/* Buttons/cards */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition:
    transform 0.1s,
    background 0.15s;
  min-height: 42px;
}
.btn:hover {
  background: var(--bg-2);
}
.btn:active {
  transform: scale(0.975);
}
.btn svg {
  width: 17px;
  height: 17px;
}
.btn-primary {
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-primary:hover {
  filter: brightness(1.06);
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}
.btn-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}
.btn-purple {
  background: var(--purple-soft);
  color: var(--purple);
  border-color: transparent;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  min-height: 36px;
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 14.5px;
  font-weight: 800;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.grid {
  display: grid;
  gap: 14px;
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.entry-grid {
  grid-template-columns: 1fr 380px;
}
html.mobile-layout .entry-grid {
  grid-template-columns: 1fr;
}
@media (max-width: 900px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
html.mobile-layout .grid-2,
html.mobile-layout .grid-3,
html.mobile-layout .grid-4 {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.field input,
.field select,
.field textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  width: 100%;
  min-height: 42px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.field input.err {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.field-err {
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
  min-height: 14px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 21px;
  font-weight: 800;
  margin: 0;
}
.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.kpi .k-ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 9px;
}
html[data-theme='dark'] .kpi .k-ic {
  color: var(--primary-2);
}
.kpi .k-ic svg {
  width: 17px;
  height: 17px;
}
.kpi .k-lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}
.kpi .k-val {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.kpi .k-sub {
  font-size: 11px;
  color: var(--faint);
  margin-top: 3px;
  font-weight: 600;
}
.kpi.green .k-ic {
  background: var(--success-soft);
  color: var(--success);
}
.kpi.amber .k-ic {
  background: var(--warn-soft);
  color: var(--warn);
}
.kpi.red .k-ic {
  background: var(--danger-soft);
  color: var(--danger);
}
.kpi.purple .k-ic {
  background: var(--purple-soft);
  color: var(--purple);
}
.kpi.blue .k-ic {
  background: var(--info-soft);
  color: var(--info);
}

/* Table */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tbl th,
table.tbl td {
  padding: 11px 13px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tbl th {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
table.tbl th:hover {
  color: var(--primary);
}
table.tbl tr:last-child td {
  border-bottom: none;
}
table.tbl tbody tr:hover {
  background: var(--surface-2);
}
.num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Doctors' shares: one card per doctor on phones, no sideways scroll. */
html.mobile-layout .tbl-cards {
  overflow: visible;
  border: 0;
  background: none;
}
html.mobile-layout .tbl-cards table,
html.mobile-layout .tbl-cards thead,
html.mobile-layout .tbl-cards tbody,
html.mobile-layout .tbl-cards tr,
html.mobile-layout .tbl-cards td {
  display: block;
  width: auto;
}
html.mobile-layout .tbl-cards thead {
  display: none;
}
html.mobile-layout .tbl-cards tr {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-block-end: 10px;
}
html.mobile-layout .tbl-cards td {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border: 0;
  white-space: normal;
  text-align: end;
}
html.mobile-layout .tbl-cards td::before {
  content: attr(data-label);
  color: var(--muted);
  font-weight: 700;
}
html.mobile-layout .tbl-cards td:last-child {
  justify-content: flex-end;
  padding-block-start: 10px;
}
html.mobile-layout .tbl-cards td:last-child::before {
  content: none;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 9px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap svg {
  position: absolute;
  inset-inline-start: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-wrap input {
  padding-inline-start: 36px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  outline: none;
  min-height: 42px;
}
.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.chip {
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--bg-2);
}
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

/* Detail rows */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  gap: 8px;
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row .dr-l {
  color: var(--muted);
  font-weight: 600;
}
.detail-row .dr-r {
  font-weight: 700;
  text-align: end;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 20, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
  backdrop-filter: blur(3px);
}
.overlay.show {
  opacity: 1;
  visibility: visible;
}
html.mobile-layout .overlay {
  align-items: flex-end;
  padding: 0;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.overlay.show .modal {
  transform: none;
}
html.mobile-layout .modal {
  border-radius: 22px 22px 0 0;
  max-width: none;
  max-height: 94vh;
  transform: translateY(100%);
}
html.mobile-layout .overlay.show .modal {
  transform: none;
}
.modal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}
.modal-body {
  padding: 18px;
}
.modal-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  flex-wrap: wrap;
}
.grabber {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--border-2);
  margin: 9px auto 0;
}

/* Toast */
.toasts {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  inset-inline-start: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
html.mobile-layout .toasts {
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  inset-inline: 14px;
}
.toast {
  background: var(--text);
  color: var(--surface);
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: auto;
  max-width: 340px;
}
html[data-theme='dark'] .toast {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.toast button {
  color: var(--primary-2);
  font-weight: 800;
  font-size: 12.5px;
  text-decoration: underline;
}

/* Tour */
.tour-spot {
  position: fixed;
  z-index: 400;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(8, 12, 16, 0.62);
  transition: all 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  pointer-events: none;
  border: 2px solid var(--primary-2);
}
.tour-tip {
  position: fixed;
  z-index: 401;
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.tour-tip .t-step {
  font-size: 11px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.tour-tip .t-txt {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 11px;
}
.tour-tip .t-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tour-tip .t-skip {
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
}

/* Empty */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty .e-ic {
  width: 70px;
  height: 70px;
  border-radius: 22px;
  margin: 0 auto 14px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}
.empty .e-ic svg {
  width: 32px;
  height: 32px;
}
.empty h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 16px;
}
.empty p {
  margin: 0 0 16px;
  font-size: 13px;
}

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--border) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shim 1.1s infinite;
  border-radius: 8px;
}
@keyframes shim {
  to {
    background-position: -200% 0;
  }
}

/* Chart */
.chart-svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.bar-anim {
  transform-origin: bottom;
  animation: barGrow 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
}
@keyframes barGrow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab.active {
  color: var(--primary);
  border-color: var(--primary);
}
html[data-theme='dark'] .tab.active {
  color: var(--primary-2);
  border-color: var(--primary-2);
}
.tab .t-count {
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
}
.tab.active .t-count {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Donut chart container */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 150px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-item .lv {
  margin-inline-start: auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Receipt */
.receipt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  max-width: 440px;
  margin: 0 auto;
}
.receipt .rh {
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.receipt .rrow {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}
.receipt .rtotal {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  font-size: 17px;
  font-weight: 900;
  border-top: 2px solid var(--border);
  margin-top: 8px;
}

/* Cash counter */
.denom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.denom-row:last-child {
  border-bottom: none;
}
.denom-lbl {
  font-weight: 800;
  min-width: 60px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.denom-inp {
  flex: 1;
  min-inline-size: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 700;
  outline: none;
  min-height: 38px;
}
.denom-inp:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.denom-sum {
  min-width: 80px;
  text-align: end;
  font-weight: 800;
  color: var(--success);
}

/* Phone mode */
html.phone-mode {
  background: #0c1216;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 0;
}
html.phone-mode body {
  width: 390px;
  height: 790px;
  max-height: 92vh;
  overflow: hidden;
  border-radius: 44px;
  border: 11px solid #1b2429;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  padding-top: 0;
  position: relative;
  background: var(--bg);
}
html.phone-mode .app-shell {
  height: 100%;
  overflow: hidden;
  grid-template-columns: 1fr;
}
html.phone-mode .main-col {
  height: 100%;
  overflow: hidden;
}
html.phone-mode .content {
  overflow-y: auto;
  height: calc(100% - var(--topbar-h));
  padding-bottom: 96px;
}
html.phone-mode .sidebar {
  display: none;
}
html.phone-mode .bottom-nav {
  display: flex;
  position: absolute;
}
html.phone-mode .fab {
  display: flex;
  position: absolute;
}
html.phone-mode .toasts {
  position: absolute;
}
html.phone-mode .overlay {
  position: absolute;
}
html.phone-mode .tour-spot,
html.phone-mode .tour-tip {
  position: absolute;
}
html.phone-mode .topbar {
  top: 0;
}
.mobile-toggle {
  display: none;
}
@media (min-width: 768px) {
  .mobile-toggle {
    display: inline-flex;
  }
}
html.phone-mode .mobile-toggle {
  display: inline-flex;
}

/* Print */
@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .sidebar,
  .topbar,
  .bottom-nav,
  .fab,
  .toasts,
  .no-print,
  .tour-spot,
  .tour-tip {
    display: none !important;
  }
  .content {
    padding: 0;
    max-width: none;
  }
  .card,
  .tbl-wrap,
  .receipt {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

@media (max-width: 520px) {
  .page-title {
    font-size: 19px;
  }
  .kpi .k-val {
    font-size: 20px;
  }
}

/* Locked overlay for role restrictions */
.lock-note {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 10px;
  padding: 11px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: center;
}
