:root {
  --page: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-tint: #edf6f5;
  --line: #d8e0e8;
  --line-strong: #b9c5d1;
  --text: #1e293b;
  --muted: #66758a;
  --primary: #1f6feb;
  --primary-strong: #1557bd;
  --teal: #0f766e;
  --amber: #b7791f;
  --rose: #be123c;
  --brand-orange: #ed6a00;
  --brand-orange-strong: #c95600;
  --shadow: 0 14px 34px rgba(23, 37, 84, 0.08);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 48px 40px;
  background: #f1f4f7;
  border-top: 3px solid var(--primary);
}

.login-layout {
  width: min(552px, 100%);
}

.login-content {
  width: 100%;
  min-width: 0;
}

.login-panel {
  padding: 44px 44px 0;
  background: var(--surface);
  border: 1px solid #dde4ec;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(26, 39, 57, 0.02), 0 16px 40px -16px rgba(26, 39, 57, 0.18);
}

.login-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.login-heading-copy {
  min-width: 0;
}

.login-logo {
  display: block;
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.login-section-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-form-heading h1 {
  margin: 0;
  color: #202c3e;
  font-size: 32px;
  font-weight: 650;
  line-height: 1.4;
}

.login-form {
  display: grid;
  gap: 26px;
}

.login-panel .field {
  gap: 10px;
}

.login-panel .field label {
  color: #3b485b;
  font-size: 15px;
  font-weight: 600;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap > .ui-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a97a8;
  pointer-events: none;
}

.login-input-wrap:focus-within > .ui-icon {
  color: var(--primary);
}

.login-panel input {
  height: 58px;
  min-width: 0;
  border-radius: 6px;
  border-color: #d4dde7;
  background: #fcfdff;
  padding: 14px 16px 14px 48px;
  font-size: 17px;
  transition: border-color 150ms, box-shadow 150ms, background-color 150ms;
}

.login-panel input::placeholder {
  color: #97a2b2;
}

.login-panel input:hover {
  border-color: #acbacb;
}

.login-password-wrap input {
  padding-right: 58px;
}

.login-password-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: #8190a4;
}

.login-password-toggle:hover {
  background: #eef3f9;
  color: var(--primary);
}

.login-password-toggle:focus-visible,
.login-submit:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.3);
  outline-offset: 3px;
}

.login-panel input:-webkit-autofill,
.login-panel input:-webkit-autofill:hover,
.login-panel input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: #1f2937;
}

.login-panel input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.login-actions {
  margin-top: -14px;
}

.login-feedback {
  min-height: 32px;
  padding: 0 0 10px;
}

.login-error {
  margin: 0;
  color: var(--rose);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.login-panel .login-submit {
  width: 100%;
  min-height: 58px;
  padding: 15px 20px;
  border-radius: 6px;
  background: var(--primary);
  box-shadow: 0 4px 8px rgba(31, 111, 235, 0.14);
  font-size: 17px;
  gap: 14px;
  transition: background-color 150ms, box-shadow 150ms;
}

.login-panel .login-submit:hover {
  background: var(--primary-strong);
  box-shadow: 0 5px 12px rgba(31, 111, 235, 0.2);
}

.login-panel .login-submit:disabled {
  opacity: 0.8;
}

.login-spinner {
  display: inline-flex;
  animation: login-spin 1.2s linear infinite;
}

.login-panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 36px;
  padding: 22px 0;
  border-top: 1px solid #edf0f4;
  color: #66758a;
  font-size: 14px;
}

.login-panel-footer .ui-icon {
  width: 16px;
  height: 16px;
}

.login-page-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  color: #5e6e83;
  font-size: 12px;
  line-height: 1.8;
}

.login-page-footer span {
  color: #c0c9d4;
}

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

@media (prefers-reduced-motion: reduce) {
  .login-spinner { animation: none; }
  .login-panel input,
  .login-panel .login-submit { transition: none; }
}

@media (max-width: 480px) {
  .login-shell { padding: 32px 16px; }
  .login-panel { padding: 28px 24px 0; }
  .login-form-heading { gap: 16px; margin-bottom: 28px; }
  .login-form-heading h1 { font-size: 28px; }
  .login-logo { flex-basis: 60px; width: 60px; height: 60px; }
  .login-panel input { font-size: 16px; }
  .login-panel-footer { margin-top: 28px; }
}

@media (max-height: 720px) and (min-width: 481px) {
  .login-shell { padding-block: 24px; }
  .login-page-footer { margin-top: 20px; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #1f6feb;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1,
.brand h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.sidebar .brand {
  padding: 4px 4px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.sidebar .brand-mark {
  width: 38px;
  height: 38px;
  background: #14213d;
}

.nav {
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #475569;
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #0f172a;
  background: #e8f0fb;
}

.nav-symbol {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #1f6feb;
  background: #eef5ff;
  font-weight: 700;
}

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

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.user-chip strong {
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  padding: 28px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.password-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.password-form {
  display: grid;
  gap: 20px;
}

.password-form h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.password-form header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.password-form input {
  width: 100%;
  min-width: 0;
}

.password-form footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.password-error {
  margin: 0;
  color: var(--rose);
  font-size: 13px;
  line-height: 1.5;
}

.initial-password-page { min-height: 100svh; display: grid; place-items: center; padding: 28px 20px; background: var(--page); }
.initial-password-content { width: min(100%, 420px); min-width: 0; }
.initial-password-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-size: 21px; }
.initial-password-brand img { width: 42px; height: 42px; object-fit: contain; }
.initial-password-account { color: var(--muted); overflow-wrap: anywhere; margin-bottom: 24px; }
.initial-password-content .field { min-width: 0; }
.initial-password-content .password-form footer { flex-wrap: wrap; }

.workspace {
  padding: 22px 24px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2,
.section-title {
  margin: 0;
  font-size: 16px;
}

.section-title {
  margin-bottom: 10px;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 96px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1.2;
}

.metric.green {
  border-color: rgba(15, 118, 110, 0.26);
  background: var(--surface-tint);
}

.metric.green strong {
  color: var(--teal);
}

.metric.amber strong {
  color: var(--amber);
}

.dashboard-workspace {
  flex: 1;
  gap: 0;
  padding: 30px 36px 24px;
  background: #fff;
}

.dashboard-page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  align-self: start;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.dashboard-heading,
.dashboard-toolbar,
.dashboard-period,
.dashboard-section-heading,
.dashboard-kpi-label,
.dashboard-kpi-note,
.dashboard-text-action,
.dashboard-rank-line,
.dashboard-rank-heading,
.dashboard-rank-heading h4,
.dashboard-footer {
  display: flex;
  align-items: center;
}

.dashboard-heading,
.dashboard-section-heading,
.dashboard-rank-line,
.dashboard-rank-heading,
.dashboard-footer {
  justify-content: space-between;
  gap: 16px;
}

.dashboard-heading h2 {
  margin: 6px 0 0;
  color: #1d2a3a;
  font-size: 24px;
  line-height: 1.4;
}

.dashboard-eyebrow {
  margin: 0;
  color: #6b7788;
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-eyebrow > span {
  padding: 0 7px;
  color: #c2cad3;
}

.dashboard-toolbar {
  gap: 12px;
}

.dashboard-period {
  gap: 2px;
  padding: 3px;
  border: 1px solid #dde4eb;
  border-radius: 6px;
  background: #fff;
}

.dashboard-period input {
  width: 145px;
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
  border: 0;
  border-radius: 3px;
  color: #334155;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.dashboard-icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 32px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 4px;
  color: #687789;
  background: transparent;
}

.dashboard-current-month {
  min-height: 28px;
  margin: 0 4px;
  padding: 3px 9px;
  border-left: 1px solid #e5eaf0;
  color: #2469c7;
  background: transparent;
  font-size: 12px;
}

.dashboard-current-month:disabled {
  opacity: 1;
  color: #98a3b1;
}

.dashboard-icon-button:hover,
.dashboard-current-month:not(:disabled):hover {
  background: #f0f5fb;
}

.dashboard-register.btn {
  min-height: 40px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 2px 4px #1f6feb18;
}

.dashboard-personal-period {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
}

.nav-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  color: #526174;
  font-size: 14px;
  list-style: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary .ui-icon { width: 16px; height: 16px; }
.nav-group[open] summary .ui-icon { transform: rotate(90deg); }
.nav-group > div { padding-left: 10px; display: grid; gap: 4px; }
.dashboard-today-heading { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.dashboard-today-heading h3 { margin: 0; font-size: 15px; }
.dashboard-today-heading span { font-size: 12px; color: #69778a; }
.dashboard-kpis {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1fr;
  margin-top: 24px;
  padding: 25px 0;
  border-top: 1px solid #e4e9ef;
  border-bottom: 1px solid #e4e9ef;
}

.dashboard-kpi {
  min-width: 0;
  padding: 0 30px;
  border-left: 1px solid #e4e9ef;
}

.dashboard-kpi:first-child {
  padding-left: 0;
  border-left: 0;
}

.dashboard-kpi:last-child {
  padding-right: 0;
}

.dashboard-kpi-label {
  gap: 8px;
  color: #69778a;
  font-size: 13px;
}

.dashboard-kpi-label .ui-icon {
  width: 16px;
  height: 16px;
  color: #8593a4;
}

.dashboard-kpi-value {
  display: block;
  margin: 12px 0 10px;
  color: #243246;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.dashboard-kpi-primary .dashboard-kpi-value {
  color: #087e78;
}

.dashboard-kpi-value small {
  margin-left: 7px;
  color: #7d8998;
  font-size: 13px;
  font-weight: 500;
}

.dashboard-kpi-note {
  flex-wrap: wrap;
  gap: 7px;
  min-height: 18px;
  color: #8591a0;
  font-size: 12px;
}

.dashboard-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #68778b;
}

.dashboard-change .ui-icon {
  width: 14px;
  height: 14px;
}

.dashboard-change.is-up {
  color: #0b8272;
}

.dashboard-change.is-down,
.dashboard-rank-amount.is-negative {
  color: #bc4253;
}

.dashboard-analysis {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, 1fr);
  gap: 30px;
  padding: 26px 0;
  border-bottom: 1px solid #e4e9ef;
}

.dashboard-trend,
.dashboard-monthly {
  min-width: 0;
}

.dashboard-monthly {
  padding-left: 28px;
  border-left: 1px solid #e4e9ef;
}

.dashboard-section-heading {
  min-height: 22px;
  margin-bottom: 22px;
}

.dashboard-section-heading h3 {
  margin: 0;
  color: #253346;
  font-size: 15px;
  font-weight: 650;
}

.dashboard-section-heading > span,
.dashboard-rankings-heading > div > span {
  color: #8a96a5;
  font-size: 12px;
}

.dashboard-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #188b86;
}

.dashboard-legend-period {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid #e4e9ef;
}

.dashboard-chart {
  padding-top: 12px;
}

.dashboard-plot {
  position: relative;
  height: 174px;
  margin: 0 8px 0 52px;
}

.dashboard-grid-line {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px dashed #e8edf2;
  pointer-events: none;
}

.dashboard-grid-line > span {
  position: absolute;
  top: -8px;
  right: calc(100% + 12px);
  color: #98a3b0;
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-zero-line {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid #dce4ed;
  pointer-events: none;
}

.dashboard-bars {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-chart-column {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  color: #536477;
  background: transparent;
}

button.dashboard-chart-column:hover {
  background: #f6f9fc;
}

.dashboard-bar {
  position: absolute;
  left: 50%;
  width: min(48px, 34%);
  transform: translateX(-50%);
  border-radius: 4px 4px 0 0;
  background: #9eb8d7;
}

.dashboard-chart-column.is-current .dashboard-bar {
  background: #148b84;
}

.dashboard-chart-column.is-negative .dashboard-bar {
  border-radius: 0 0 4px 4px;
  background: #cf7885;
}

.dashboard-trend-value {
  position: absolute;
  bottom: calc(var(--label-bottom) + 8px);
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.dashboard-chart-column.is-negative .dashboard-trend-value {
  top: calc(100% - var(--label-bottom) + 6px);
  bottom: auto;
  color: #bc4253;
}

.dashboard-chart-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 8px 0 52px;
  text-align: center;
}

.dashboard-chart-labels > div {
  display: grid;
  gap: 5px;
}

.dashboard-chart-labels strong {
  color: #6b788a;
  font-size: 12px;
  font-weight: 500;
}

.dashboard-chart-labels .is-current strong {
  color: #157b76;
  font-weight: 650;
}

.dashboard-chart-labels span {
  color: #97a1ae;
  font-size: 11px;
}

.dashboard-month-table {
  width: 100%;
  min-width: 0;
}

.dashboard-month-table th,
.dashboard-month-table td {
  padding: 13px 8px;
  border-bottom: 1px solid #edf1f5;
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-month-table th {
  padding-top: 9px;
  padding-bottom: 9px;
  color: #8a96a5;
  background: #f8fafc;
  font-weight: 500;
}

.dashboard-month-table th:not(:first-child),
.dashboard-month-table td:not(:first-child) {
  text-align: right;
}

.dashboard-month-table .is-selected td {
  color: #0b8179;
  background: #f2f9f8;
  font-weight: 600;
}

.dashboard-month-table small {
  font-size: 10px;
}

.dashboard-month-link {
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
}

.dashboard-month-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.dashboard-text-action {
  gap: 6px;
  padding: 0;
  color: #3c6fa9;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
}

.dashboard-text-action:hover {
  color: var(--primary-strong);
}

.dashboard-text-action .ui-icon {
  width: 15px;
  height: 15px;
}

.dashboard-month-orders {
  margin-top: 21px;
}

.dashboard-rankings {
  padding: 25px 0 0;
}

.dashboard-rankings-heading {
  margin-bottom: 22px;
}

.dashboard-rankings-heading > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-dot-separator {
  padding: 0 7px;
  color: #c4cbd4;
}

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

.dashboard-rank-column {
  min-width: 0;
  padding: 0 24px;
  border-left: 1px solid #e4e9ef;
}

.dashboard-rank-column:first-child {
  padding-left: 0;
  border-left: 0;
}

.dashboard-rank-column:last-child {
  padding-right: 0;
}

.dashboard-rank-heading {
  margin-bottom: 8px;
}

.dashboard-rank-heading h4 {
  gap: 7px;
  margin: 0;
  color: #435369;
  font-size: 13px;
  font-weight: 600;
}

.dashboard-rank-heading h4 .ui-icon {
  width: 16px;
  height: 16px;
  color: #397bc6;
}

.dashboard-rank-heading > span {
  color: #a1aab6;
  font-size: 11px;
}

.dashboard-rank-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-rank-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid #f0f3f6;
}

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

.dashboard-rank-position {
  color: #a2afbf;
  font-size: 12px;
  font-weight: 650;
}

.dashboard-rank-list li:first-child .dashboard-rank-position {
  color: #b8882e;
}

.dashboard-rank-line {
  gap: 7px;
}

.dashboard-rank-person {
  min-width: 0;
}

.dashboard-rank-line strong {
  color: #435369;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.dashboard-rank-line > span {
  flex-shrink: 0;
  color: #98a3b0;
  font-size: 11px;
}

.dashboard-rank-track {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 1px;
  background: #f0f4f7;
}

.dashboard-rank-track > span {
  display: block;
  height: 100%;
  background: #94b7e3;
}

[data-department="operator"] .dashboard-rank-track > span {
  background: #8ac4ba;
}

[data-department="teacher"] .dashboard-rank-track > span {
  background: #c9b278;
}

.dashboard-rank-track > span.is-negative {
  background: #cf7885;
}

.dashboard-rank-amount {
  min-width: 100px;
  color: #35465d;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.dashboard-ranking-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-height: 154px;
  color: #9ba8b6;
  font-size: 12px;
}

.dashboard-ranking-empty .ui-icon {
  width: 25px;
  height: 25px;
  margin-bottom: 4px;
  color: #b8c6d5;
  stroke-width: 1.4;
}

.dashboard-ranking-empty strong {
  color: #7f8d9e;
  font-weight: 500;
}

.dashboard-ranking-empty > span {
  font-size: 11px;
}

.dashboard-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #edf1f5;
  color: #a0aab7;
  font-size: 11px;
}

.dashboard-page button:focus-visible,
.dashboard-page input:focus-visible {
  outline: 2px solid #6a9fe4;
  outline-offset: 3px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 13px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(190px, 1fr));
}

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

.order-entry-panel {
  max-width: 1480px;
}

.order-form {
  display: grid;
  gap: 20px;
}

.form-section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.order-form > .form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.form-section-heading {
  margin-bottom: 14px;
}

.form-section-heading h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #203249;
  font-size: 15px;
}

.section-step {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.entry-info-grid,
.order-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 14px;
}

.transaction-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(145px, 0.85fr));
  gap: 14px;
}

.money-field input {
  font-variant-numeric: tabular-nums;
}

.actual-received-field input[readonly] {
  color: #087a72;
  border-color: #a9d7d1;
  background: #eef8f6;
  font-size: 16px;
  font-weight: 750;
}

input[readonly] {
  cursor: default;
}

.learning-term {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid #13847a;
  background: #f4faf9;
  color: #5c6e80;
  font-size: 13px;
}

.learning-term strong {
  color: #0f766e;
  font-size: 15px;
}

.performance-filters {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) auto;
}

.performance-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 40px;
  flex-wrap: wrap;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
  align-items: start;
}

.assignment-field {
  align-content: start;
}

.assignment-self .self-person {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #334155;
  font-weight: 600;
}

.split-preview {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #cddaea;
  border-radius: 8px;
  background: #f8fbff;
}

.split-preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #52647a;
  font-size: 13px;
}

.split-preview-heading strong {
  color: #1f3b62;
  font-size: 13px;
}

.split-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.split-role {
  min-width: 0;
  padding-left: 10px;
  border-left: 3px solid #d6e1ee;
}

.split-role.is-multi {
  border-left-color: var(--amber);
}

.split-role-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.split-role-title em {
  padding: 2px 5px;
  border-radius: 4px;
  color: #854d0e;
  background: #fef3c7;
  font-size: 11px;
  font-style: normal;
}

.split-people {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.split-person {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: #52647a;
  font-size: 12px;
}

.split-person > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-person strong {
  color: #26364a;
  font-size: 12px;
  white-space: nowrap;
}

.split-empty {
  color: var(--muted);
  font-size: 12px;
}

.full-row {
  grid-column: 1 / -1;
}

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

.field label {
  color: #344256;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

select[multiple] {
  min-height: 116px;
  padding: 8px;
}

textarea {
  resize: vertical;
}

.person-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  min-height: 40px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.person-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #26364a;
  background: #f6f8fb;
}

.person-option:has(input:checked) {
  border-color: #8db5f2;
  color: #1557bd;
  background: #edf5ff;
  font-weight: 700;
}

.person-option input {
  width: auto;
  min-height: auto;
}

.empty-picker {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(170px, 0.35fr) auto;
  gap: 10px;
  align-items: end;
}

.order-filters {
  grid-template-columns: minmax(250px, 2fr) repeat(4, minmax(138px, 1fr));
}

.order-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 40px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 8px;
  font-size: 20px;
  line-height: 1;
}

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

.dashboard-filter-panel {
  padding: 12px 16px;
}

.dashboard-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-filters .field {
  width: min(220px, 100%);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
  font-weight: 600;
}

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

.btn.secondary {
  color: #26364a;
  background: #e7edf4;
}

.btn.secondary:hover {
  background: #d7e1ec;
}

.btn.danger {
  background: var(--rose);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  gap: 6px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #53657a;
  font-weight: 700;
  background: #f6f8fb;
}

tbody tr:hover {
  background: #f9fbfd;
}

.empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.issue-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 6px;
  border-radius: 4px;
  color: #9a3412;
  background: #ffedd5;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.order-history-panel {
  max-width: 920px;
}

.history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

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

.history-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-list li > span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.import-table {
  min-width: 1000px;
}

.import-table .issue-badge {
  margin: 2px 4px 2px 0;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #14213d;
  box-shadow: var(--shadow);
}

.review-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #854d0e;
  background: #fef3c7;
  font-size: 12px;
  font-weight: 700;
}

.amount-cell {
  display: grid;
  gap: 4px;
  min-width: 108px;
}

.amount-cell > strong {
  color: #1f2937;
  white-space: nowrap;
}

.amount-cell > .split-amount {
  color: var(--teal);
}

.share-amount {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.multi-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 6px;
  border-radius: 4px;
  color: #854d0e;
  background: #fef3c7;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.student-multi-dot {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  margin-left: 4px;
  border-radius: 50%;
  color: #854d0e;
  background: #fef3c7;
  font-size: 11px;
  font-weight: 800;
  vertical-align: 1px;
}

.student-info {
  min-width: 280px;
  white-space: nowrap;
}

.student-info strong,
.student-info .subtle {
  display: inline-block;
  margin-right: 10px;
  vertical-align: middle;
}

.student-access {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.student-access strong {
  margin-right: 0;
  color: #0f766e;
  font-size: 12px;
}

.department-people {
  color: #334155;
  font-size: 13px;
  white-space: nowrap;
}

.assignment-cell {
  display: grid;
  gap: 4px;
  min-width: 104px;
}

.assignment-person {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  color: #334155;
  font-size: 13px;
}

.assignment-person > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-person strong {
  color: var(--teal);
  font-size: 12px;
  white-space: nowrap;
}

.assignment-note {
  color: #8a5d19;
  font-size: 11px;
  font-weight: 700;
}

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

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

.check-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-row input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.check-row strong {
  display: block;
  font-size: 14px;
}

.check-row span {
  color: var(--muted);
  font-size: 12px;
}

.bar-list {
  display: grid;
  gap: 11px;
}

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

.dashboard-ranking-column {
  min-width: 0;
  padding: 0 20px;
  border-left: 1px solid var(--line);
}

.dashboard-ranking-column:first-child {
  padding-left: 0;
  border-left: 0;
}

.dashboard-ranking-column:last-child {
  padding-right: 0;
}

.dashboard-ranking-column h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.ranking-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  border-bottom: 1px solid #edf1f5;
}

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

.ranking-position {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #4e6278;
  background: #edf2f7;
  font-size: 12px;
  font-weight: 700;
}

.ranking-list li:nth-child(-n + 3) .ranking-position {
  color: #8a5c12;
  background: #fff1c8;
}

.ranking-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  color: #1f4553;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ranking-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  background: #e5ebf2;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--width);
  background: linear-gradient(90deg, var(--teal), var(--primary));
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  min-height: 200px;
  padding: 8px 12px 0;
}

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

.trend-column > strong {
  overflow: hidden;
  color: #26364a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-bar-area {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 126px;
  border-bottom: 1px solid var(--line);
}

.trend-bar {
  width: min(58px, 58%);
  height: var(--height);
  min-height: 0;
  border-radius: 6px 6px 0 0;
  background: var(--teal);
  transition: height 180ms ease;
}

.trend-column > span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.trend-column > small {
  color: var(--muted);
  font-size: 12px;
}

.user-management-header {
  align-items: flex-start;
}

.panel-hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-management-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.user-table-wrap table {
  min-width: 1050px;
}

.user-table-wrap th,
.user-table-wrap td {
  white-space: nowrap;
}

.user-table-wrap input,
.user-table-wrap select {
  min-width: 128px;
  min-height: 36px;
  padding: 7px 9px;
}

.user-table-wrap td:first-child {
  color: #46596e;
  font-weight: 600;
}

.status-text {
  color: #267052;
  font-size: 13px;
  font-weight: 600;
}

.compact-btn {
  min-height: 34px;
  padding: 6px 10px;
}

.directory-workspace {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 30px 36px;
  background: #fff;
}

.directory-page {
  width: 100%;
  min-width: 0;
  max-width: 1480px;
  margin: 0 auto;
}

.directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.directory-heading h2 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.4;
}

.directory-heading .btn,
.student-filters .btn {
  border-radius: 6px;
  font-size: 13px;
}

.student-filters {
  display: grid;
  grid-template-columns: 190px minmax(220px, 440px) auto;
  align-items: end;
  justify-content: start;
  gap: 12px;
  margin-bottom: 22px;
}

.student-filters input {
  border-color: #d8e0e8;
  border-radius: 6px;
  font-size: 13px;
}

.student-filters .btn {
  min-height: 40px;
}

.directory-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 26px;
  padding: 16px 0;
  border-top: 1px solid #e5eaf0;
  color: #7e8b9c;
  font-size: 12px;
}

.directory-summary > span > strong {
  margin: 0 7px;
  color: #344b63;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.directory-summary-period {
  margin-left: auto;
}

.directory-table-wrap {
  min-width: 0;
  border-top: 1px solid #e5eaf0;
}

.directory-table-wrap th {
  padding: 13px 12px;
  color: #718096;
  font-size: 12px;
  font-weight: 500;
  background: #f8fafc;
}

.directory-table-wrap td {
  padding: 14px 12px;
  border-bottom-color: #edf1f5;
  color: #40536b;
  font-size: 13px;
}

.student-table {
  min-width: 1000px;
  font-variant-numeric: tabular-nums;
}

.student-table td:first-child {
  min-width: 110px;
}

.student-table td:nth-child(2) {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.student-table td > strong {
  font-weight: 600;
}

.numeric-cell {
  text-align: right;
  white-space: nowrap;
}

.phone-cell,
.directory-date {
  white-space: nowrap;
}

.learning-duration {
  color: #147f76;
  white-space: nowrap;
}

.learning-duration[data-status="expired"],
.learning-duration[data-status="today"] {
  color: var(--rose);
}

.learning-duration[data-status="upcoming"],
.learning-duration[data-status="unknown"] {
  color: var(--muted);
}

.directory-subtext {
  display: block;
  margin-top: 5px;
  color: #96a1af;
  font-size: 11px;
  white-space: nowrap;
}

.directory-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 260px;
  border-top: 1px solid #e5eaf0;
  color: #96a3b3;
}

.directory-empty > .ui-icon {
  width: 34px;
  height: 34px;
  color: #b5c5d8;
  stroke-width: 1.5;
}

.directory-empty h3 {
  margin: 0;
  color: #7c8c9e;
  font-size: 14px;
  font-weight: 500;
}

.directory-empty > span {
  font-size: 12px;
}

.department-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin-bottom: 2px;
  border-bottom: 1px solid #e5eaf0;
}

.department-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 2px;
  border-bottom: 2px solid transparent;
  color: #7a8a9d;
  background: transparent;
  font-size: 13px;
}

.department-tabs button .ui-icon {
  width: 16px;
  height: 16px;
}

.department-tabs button > span {
  color: #9aa8b7;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.department-tabs button.is-active {
  border-bottom-color: #2a76d3;
  color: #216fcf;
  font-weight: 600;
}

.department-tabs + .directory-summary {
  border-top: 0;
}

.department-pending {
  margin-left: auto;
  font-size: 12px;
}

.directory-page .user-table-wrap td:first-child {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-page .user-table-wrap table {
  min-width: 940px;
  table-layout: fixed;
}

.directory-page .user-table-wrap th:nth-child(1) { width: 180px; }
.directory-page .user-table-wrap th:nth-child(2) { width: 118px; }
.directory-page .user-table-wrap th:nth-child(3) { width: 120px; }
.directory-page .user-table-wrap th:nth-child(4) { width: 94px; }
.directory-page .user-table-wrap th:nth-child(5) { width: 145px; }
.directory-page .user-table-wrap th:nth-child(6) { width: 132px; }
.directory-page .user-table-wrap th:nth-child(7) { width: 74px; }

.directory-page .user-table-wrap .compact-btn {
  font-size: 12px;
}

.directory-page .user-table-wrap input,
.directory-page .user-table-wrap select {
  width: 100%;
  min-width: 0;
  border-radius: 5px;
  border-color: #d8e0e8;
  font-size: 13px;
}

.department-tabs button:focus-visible {
  outline: 2px solid #6a9fe4;
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .dashboard-analysis {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .dashboard-monthly {
    padding: 22px 0 0;
    border-left: 0;
    border-top: 1px solid #e4e9ef;
  }

  .dashboard-rank-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .dashboard-rank-column,
  .dashboard-rank-column:first-child,
  .dashboard-rank-column:last-child {
    padding: 0;
    border-left: 0;
  }

  .dashboard-rank-column + .dashboard-rank-column {
    padding-top: 20px;
    border-top: 1px solid #e4e9ef;
  }

  .dashboard-rank-list li {
    min-height: 50px;
  }

  .dashboard-ranking-empty {
    min-height: 110px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar .brand {
    margin-bottom: 0;
  }

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

  .metrics,
  .grid-2,
  .permission-groups,
  .dashboard-ranking-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .form-grid.two,
  .entry-info-grid,
  .order-info-grid,
  .transaction-grid,
  .assignment-grid,
  .split-preview-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .dashboard-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-filters .field {
    width: 100%;
  }

  .order-filter-actions,
  .performance-filter-actions,
  .table-footer,
  .history-list li,
  .learning-term {
    align-items: stretch;
    flex-direction: column;
  }

  .history-list li > span {
    text-align: left;
    white-space: normal;
  }

  .dashboard-ranking-column,
  .dashboard-ranking-column:first-child,
  .dashboard-ranking-column:last-child {
    padding: 16px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .dashboard-ranking-column:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .user-management-header {
    gap: 14px;
  }

  .user-management-actions {
    justify-content: flex-start;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .workspace {
    padding: 16px;
  }

  .dashboard-workspace {
    padding: 24px;
  }

  .directory-workspace {
    padding: 24px;
  }

  .dashboard-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-kpi {
    padding-right: 20px;
    padding-left: 20px;
  }

  .dashboard-kpi-value {
    font-size: 28px;
  }

  th {
    position: static;
  }
}

@media (max-width: 600px) {
  .directory-workspace {
    padding: 22px 18px;
  }

  .directory-heading {
    flex-wrap: wrap;
    gap: 18px;
  }

  .directory-heading h2 {
    font-size: 22px;
  }

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

  .student-filters > .field:first-child {
    grid-column: 1 / -1;
  }

  .department-tabs {
    gap: 0 18px;
  }

  .department-tabs button {
    gap: 5px;
    font-size: 12px;
  }

  .department-tabs button .ui-icon {
    display: none;
  }

  .department-pending {
    width: 100%;
    margin-left: 0;
  }
  .sidebar .brand {
    padding-bottom: 12px;
  }

  .nav {
    gap: 4px;
    padding-top: 9px;
  }

  .nav button {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 13px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .user-chip {
    gap: 7px;
    font-size: 12px;
  }

  .user-chip strong {
    max-width: 70px;
  }

  .user-chip > span {
    display: none;
  }

  .user-chip .btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .user-chip .btn .ui-icon {
    display: none;
  }

  .dashboard-workspace {
    padding: 22px 18px;
  }

  .dashboard-heading {
    display: block;
  }

  .dashboard-heading h2 {
    font-size: 22px;
  }

  .dashboard-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
  }

  .dashboard-period {
    flex: 1 1 100%;
  }

  .dashboard-period input {
    flex: 1;
  }

  .dashboard-refresh {
    margin-left: auto;
  }

  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 0;
    margin-top: 20px;
    padding: 20px 0;
  }

  .dashboard-kpi:first-child {
    grid-column: 1 / -1;
    padding-bottom: 20px;
    border-bottom: 1px solid #e4e9ef;
  }

  .dashboard-kpi:nth-child(2) {
    padding-left: 0;
    border-left: 0;
  }

  .dashboard-kpi-value {
    font-size: 25px;
  }

  .dashboard-kpi-primary .dashboard-kpi-value {
    font-size: 34px;
  }

  .dashboard-kpi-label {
    font-size: 12px;
  }

  .dashboard-analysis {
    padding-top: 22px;
  }

  .dashboard-section-heading {
    gap: 10px;
    margin-bottom: 18px;
  }

  .dashboard-legend-period {
    display: none;
  }

  .dashboard-plot {
    height: 160px;
    margin-right: 0;
    margin-left: 42px;
  }

  .dashboard-chart-labels {
    margin-right: 0;
    margin-left: 42px;
  }

  .dashboard-trend-value {
    font-size: 11px;
  }

  .dashboard-rankings-heading > div {
    display: grid;
    gap: 6px;
  }

  .dashboard-footer {
    gap: 12px;
    font-size: 10px;
  }
}
/* Business entry and review tables share the existing workspace layout. */
.business-page { width: 100%; min-width: 0; }
.business-page h2 { font-size: 18px; margin: 16px 0; }
.business-toolbar, .business-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.business-toolbar { margin: 16px 0; }
.business-toolbar form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.business-toolbar label, .business-form-grid label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.business-toolbar input, .business-toolbar select { min-width: 140px; }
.business-grow { flex: 1; min-width: 180px; }
.business-entry { padding: 20px 0; margin: 20px 0; border-top: 1px solid #dce4ec; border-bottom: 1px solid #dce4ec; }
.business-kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: 20px; padding: 20px 0; border-bottom: 1px solid #dce4ec; }
.business-kpis span { display: block; font-size: 13px; color: #617386; }
.business-kpis strong { display: block; margin-top: 8px; font-size: 23px; color: #167f77; }
.business-form-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 16px 0; align-items: end; }
.business-wide { grid-column: 1 / -1; }
.business-checkbox { flex-direction: row !important; align-items: center; }
.business-checkbox input { width: 18px; }
.business-date-fields { margin: 20px 0; }
.business-detail { display: grid; grid-template-columns: 100px minmax(180px,1fr); gap: 10px; white-space: normal; min-width: 300px; }
.business-detail dt { color: #617386; }
.business-detail dd { margin: 0; overflow-wrap: anywhere; }
.business-page details summary { cursor: pointer; padding: 8px 0; }
.business-page td { vertical-align: top; }
.business-page td small { display: block; margin-top: 6px; color: #617386; white-space: normal; }
.business-status { font-size: 12px; white-space: nowrap; }
.business-status.pending { color: #9b650b; }
.business-status.approved { color: #167f77; }
.business-status.rejected { color: #bd3c45; }
.sales-order-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sales-order-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; border: 1px solid #dce4ec; border-radius: 6px; background: #fff; color: #52667d; font: inherit; cursor: pointer; }
.sales-order-tabs button[aria-pressed="true"] { color: #c74e00; background: #fff3e9; border-color: #ffac70; }
.sales-order-tabs button span { min-width: 20px; font-size: 12px; font-variant-numeric: tabular-nums; }
.sales-order-tabs button:focus-visible { outline: 2px solid #2466c5; outline-offset: 2px; }
.traffic-entry-table { table-layout: fixed; min-width: 620px; width: 100%; }
.traffic-entry-table th:nth-child(1), .traffic-entry-table th:nth-child(2) { width: 36%; }
.traffic-entry-table th:nth-child(3) { width: 20%; }
.traffic-entry-table th:nth-child(4) { width: 8%; }
.traffic-entry-table input, .traffic-entry-table select { width: 100%; min-width: 0; }
.business-history { margin-top: 20px; }
.performance-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.performance-layout .panel { min-width: 0; }
.bar-fill.is-negative { background: #c35b62; }
.business-actions { align-items: start; }
@media (max-width: 720px) {
  .business-form-grid { grid-template-columns: 1fr; }
  .business-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .business-actions .btn { padding: 8px 10px; }
  .traffic-entry-table { min-width: 0; display: block; }
  .traffic-entry-table thead { display: none; }
  .traffic-entry-table tbody { display: block; }
  .traffic-entry-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) 80px 42px; gap: 12px 8px; padding: 12px 0; border-bottom: 1px solid #dce4ec; }
  .traffic-entry-table tbody td { display: block; padding: 0; border: 0; min-width: 0; }
  .traffic-entry-table tbody td:first-child { grid-column: 1/-1; }
  .traffic-entry-table tbody td::before { content: attr(data-label); display: block; height: 22px; font-size: 12px; color: #617386; }
  .traffic-entry-table input, .traffic-entry-table select { min-height: 40px; }
}
.dashboard-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
.order-time-editor { margin-top: 20px; }
.order-time-editor > summary { cursor: pointer; color: #2466c5; font-weight: 600; padding: 12px 0; }
.order-time-error { grid-column: 1/-1; color: #b44646; }
.order-records { margin-top: 24px; border-top: 1px solid #e4e9ef; padding-top: 16px; }
.order-records > summary { cursor: pointer; font-weight: 600; }
.order-history-content { padding-top: 16px; }
.order-history-content h2 { font-size: 16px; }
.refund-registration { padding: 12px 0 28px; margin-bottom: 28px; border-bottom: 1px solid #dce4ec; }
.refund-source-order { grid-column: span 2; }
.refund-section { border-top: 1px solid #e4e9ef; padding: 22px 0 6px; }
.refund-section h3 { font-size: 16px; margin: 0; }
.refund-amounts { grid-template-columns: repeat(2,minmax(0,1fr)); }
.refund-registration input[readonly] { background: #f5f8fa; color: #415265; }
.refund-auto-amount { display: flex; gap: 20px; align-items: center; padding: 12px 0; color: #b42318; }
.refund-auto-amount strong { font-size: 22px; }
.refund-role-label { font-size: 13px; margin-bottom: 10px; }
.refund-registration .person-picker { min-width: 0; }
.refund-registration .person-option { min-width: 0; }
.refund-ledger-row > td { background: #fff3b0; color: #b42318; }
.refund-ledger-row strong, .refund-ledger-row .subtle, .refund-ledger-row .split-person strong { color: #b42318; }
.refund-ledger-row .amount-cell strong, .refund-ledger-row .assignment-person, .refund-ledger-row .assignment-note { color: #b42318; }
.refund-entry-badge { display: block; margin-top: 6px; font-weight: 600; }
.refund-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; }
.refund-toolbar form { display: flex; flex-wrap: nowrap; margin: 0; }
.refund-toolbar input { width: 180px; min-width: 0; }
.refund-toolbar > select { width: 140px; }
.refund-tabs { display: flex; gap: 24px; border-bottom: 1px solid #dce4ec; }
.refund-tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 0; color: #617386; cursor: pointer; }
.refund-tabs button[aria-selected=true] { border-bottom-color: #2466c5; color: #2466c5; font-weight: 600; }
@media (max-width: 720px) {
  .refund-source-order { grid-column: auto; }
  .refund-amounts { grid-template-columns: minmax(0,1fr); }
  .refund-toolbar { grid-template-columns: minmax(0,1fr); }
  .refund-toolbar > select, .refund-toolbar input { width: 100%; }
  .refund-toolbar form input { flex: 1; }
}
.dashboard-month-summary { grid-template-columns: repeat(5,minmax(0,1fr)); }
.dashboard-month-summary .dashboard-kpi { padding-left: 18px; padding-right: 18px; }
.dashboard-month-summary .dashboard-kpi:first-child { padding-left: 0; }
.dashboard-month-summary .dashboard-kpi:last-child { padding-right: 0; }
.dashboard-month-summary.dashboard-teacher-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
.dashboard-today.dashboard-teacher-summary { grid-template-columns: minmax(0,1fr); }
.dashboard-summary .dashboard-kpi-value { font-size: 28px; }
.dashboard-summary .dashboard-kpi:first-child .dashboard-kpi-value { color: #087e78; }
.dashboard-today { margin-top: 12px; border-top: 0; padding-top: 12px; }
.dashboard-summary .dashboard-kpi-refund .dashboard-kpi-value { color: #b44646; }
@media (max-width: 1100px) {
  .dashboard-summary .dashboard-kpi { padding-left: 16px; padding-right: 16px; }
  .dashboard-summary .dashboard-kpi-value { font-size: 23px; }
  .dashboard-month-summary { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px 0; }
}
@media (max-width: 700px) {
  .dashboard-summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 0; }
  .dashboard-month-summary.dashboard-teacher-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-summary .dashboard-kpi:first-child { grid-column: auto; padding-bottom: 0; border-bottom: 0; }
  .dashboard-summary .dashboard-kpi:nth-child(odd) { border-left: 0; padding-left: 0; }
  .dashboard-summary .dashboard-kpi:nth-child(even) { border-left: 1px solid #e4e9ef; padding-left: 16px; }
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar .brand { flex-shrink: 0; }
.sidebar .nav {
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar .nav button:focus-visible,
.sidebar-toggle:focus-visible,
.account-trigger:focus-visible,
.account-actions button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.sidebar-footer { flex-shrink: 0; padding: 24px 6px 0; }
.sidebar-signature { padding: 20px 4px 22px; border-top: 1px solid #e4eaf1; }
.sidebar-signature p { margin: 0 0 7px; color: var(--muted); font-size: 12px; }
.sidebar-signature strong { color: #43566d; font-size: 15px; font-weight: 600; }
.sidebar-utilities { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-platform { display: inline-flex; align-items: center; gap: 6px; color: #738399; font-size: 11px; }
.sidebar-platform .ui-icon { width: 14px; height: 14px; color: var(--brand-orange); }
.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid #dfe6ee;
  border-radius: 6px;
  background: #fff;
  color: #718197;
}
.sidebar-toggle:hover { color: var(--primary); border-color: #b7d0f3; background: #f1f7ff; }
.sidebar-toggle .ui-icon { width: 16px; height: 16px; }

.topbar h1 { min-width: 0; overflow-wrap: anywhere; }
.account-menu { position: relative; flex-shrink: 0; margin-left: auto; }
.account-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 5px 10px 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger:hover,
.account-menu[open] > .account-trigger { background: #f6f8fb; border-color: #e7edf4; }
.person-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid #cfe0fa;
  border-radius: 50%;
  background: #eef5ff;
  color: #2879de;
}
.person-initials { font-size: 13px; font-weight: 650; line-height: 1; }
.person-role-badge { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid #fff; border-radius: 50%; background: currentColor; }
.person-role-badge .ui-icon { width: 10px; height: 10px; color: #fff; stroke-width: 2; }
.person-avatar-admin,.person-avatar-supervisor { color: #d9650c; background: #fff2e7; border-color: #ffddc2; }
.person-avatar-operator,.person-avatar-operator_supervisor { color: #099681; background: #e9f7f2; border-color: #c6e9de; }
.person-avatar-teacher,.person-avatar-teacher_supervisor { color: #7563bf; background: #f1edfc; border-color: #ddd5f3; }
.account-identity { display: grid; gap: 3px; min-width: 0; max-width: 180px; }
.account-identity strong { color: var(--text); font-size: 13px; line-height: 18px; }
.account-identity > span { color: var(--muted); font-size: 11px; line-height: 15px; }
.account-identity strong,
.account-identity > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { display: grid; place-items: center; margin-left: 8px; color: #8392a6; }
.account-chevron .ui-icon { width: 14px; height: 14px; transform: rotate(90deg); }
.account-menu[open] .account-chevron .ui-icon { transform: rotate(-90deg); }
.account-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 10;
  width: 264px;
  max-width: calc(100vw - 32px);
  padding: 18px 16px 8px;
  border: 1px solid #dde5ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(34, 54, 79, 0.12);
}
.account-popover-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.account-popover-heading strong { font-size: 14px; overflow-wrap: anywhere; }
.account-popover-heading > span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.account-login { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 16px; font-size: 12px; }
.account-login dt { flex-shrink: 0; color: var(--muted); }
.account-login dd { margin: 0; color: #475d76; text-align: right; overflow-wrap: anywhere; }
.account-actions { padding-top: 6px; border-top: 1px solid #e7edf4; }
.account-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 8px;
  border-radius: 5px;
  background: transparent;
  color: #344960;
  text-align: left;
  font-size: 13px;
}
.account-actions button > span { flex: 1; }
.account-actions button > .ui-icon:last-child:not(:first-child) { width: 14px; height: 14px; color: #94a2b5; }
.account-actions button:hover { background: #f1f6fc; }
.account-actions .account-logout { color: #bd3f45; }
.account-actions .account-logout:hover { background: #fff1f2; }

@media (min-width: 981px) {
  .sidebar-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar-collapsed .sidebar { padding: 18px 10px; }
  .sidebar-collapsed .sidebar .brand { justify-content: center; padding: 4px 0 18px; }
  .sidebar-collapsed .sidebar-logo { width: 36px; height: 36px; }
  .sidebar-collapsed .sidebar-brand-copy,
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .nav-group-label,
  .sidebar-collapsed .sidebar-signature,
  .sidebar-collapsed .sidebar-platform { display: none; }
  .sidebar-collapsed .nav button { justify-content: center; padding: 9px; }
  .sidebar-collapsed .nav-group summary { justify-content: center; }
  .sidebar-collapsed .sidebar-footer { padding: 16px 0 0; }
  .sidebar-collapsed .sidebar-utilities { justify-content: center; }
  .sidebar-collapsed .sidebar-toggle .ui-icon { transform: rotate(180deg); }
}

@media (max-width: 980px) {
  .sidebar .nav { flex: none; overflow: visible; }
  .sidebar-footer { display: none; }
  .topbar { flex-direction: row; align-items: center; }
}

@media (max-width: 600px) {
  .account-trigger { min-height: 40px; gap: 6px; padding: 3px; }
  .account-trigger .person-avatar { width: 32px; height: 32px; }
  .account-identity { max-width: 100px; }
  .account-identity strong { font-size: 12px; }
  .account-identity > span { font-size: 10px; }
  .account-chevron { margin-left: 0; }
  .account-popover { top: calc(100% + 7px); }
}

@media (max-width: 380px) {
  .account-identity { display: none; }
}
