:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-elevated: #fbfcfd;
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --surface-soft: rgba(255, 255, 255, .62);
  --surface-tint: #fff4f5;
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .88);
  --sidebar: rgba(255, 255, 255, .76);
  --sidebar-2: rgba(255, 247, 248, .82);
  --ink: #171316;
  --muted: #70686c;
  --muted-2: #9a9296;
  --line: rgba(36, 28, 32, .095);
  --line-strong: rgba(36, 28, 32, .16);
  --primary: #c8192e;
  --primary-dark: #8d1020;
  --primary-soft: #fff1f3;
  --gold: #c7a05d;
  --champagne: #f7efe2;
  --teal: #176b68;
  --danger: #a11222;
  --ok: #1d7a4f;
  --warn: #9a6417;
  --focus-ring: rgba(200, 25, 46, .18);
  --shadow: 0 24px 64px rgba(33, 28, 31, .11);
  --shadow-soft: 0 12px 32px rgba(33, 28, 31, .075);
  --shadow-3d: 0 18px 40px rgba(33, 28, 31, .085), inset 0 1px 0 rgba(255,255,255,.9);
  --ease-ios: cubic-bezier(.2, .8, .2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html {
  background: var(--bg);
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.86) 0%, rgba(247,249,252,.94) 38%, rgba(255,244,245,.78) 100%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  accent-color: var(--primary);
}
button, input, select, textarea { font: inherit; }
p { margin: 0; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 16px;
  background: var(--sidebar);
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 34px rgba(33, 28, 31, .045);
  -webkit-backdrop-filter: blur(28px) saturate(1.18);
  backdrop-filter: blur(28px) saturate(1.18);
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 10px 9px 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--glass-strong);
  border: 1px solid rgba(200, 25, 46, .14);
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(200, 25, 46, .14), inset 0 1px 0 rgba(255,255,255,.9);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: .13em;
  color: var(--ink);
}
.brand span {
  display: block;
  margin-top: 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

body.student-portal-mode .brand-subtitle {
  display: none;
}

.nav {
  display: grid;
  gap: 7px;
  padding-top: 4px;
}
.nav button {
  position: relative;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #5f5659;
  text-align: left;
  padding: 12px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .2s var(--ease-ios), border-color .2s var(--ease-ios), color .2s var(--ease-ios), transform .2s var(--ease-ios), box-shadow .2s var(--ease-ios);
}

.nav button .nav-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 6px;
  box-sizing: border-box;
  border: 1px solid rgba(183, 19, 40, .12);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,241,244,.72)),
    rgba(255,255,255,.88);
  color: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(47, 34, 40, .06), inset 0 1px 0 rgba(255,255,255,.96);
}

.nav button .nav-icon .icon-fill {
  fill: rgba(183, 19, 40, .10);
  stroke: rgba(183, 19, 40, .38);
}

.nav button.active .nav-icon {
  border-color: rgba(183, 19, 40, .24);
  background:
    linear-gradient(145deg, rgba(200, 25, 46, .15), rgba(255,255,255,.92)),
    rgba(255,241,244,.94);
  color: #8f1020;
  box-shadow: 0 12px 26px rgba(183, 19, 40, .16), inset 0 1px 0 rgba(255,255,255,.96);
}

.nav button:hover:not(.active) .nav-icon {
  transform: translateY(-1px);
  border-color: rgba(183, 19, 40, .20);
  box-shadow: 0 12px 25px rgba(47, 34, 40, .10), inset 0 1px 0 rgba(255,255,255,.96);
}

.nav-badge {
  position: absolute;
  top: 5px;
  right: 7px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 7px 16px rgba(161, 18, 34, .25);
}
.nav-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav button.active {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,241,243,.92)),
    var(--primary-soft);
  border-color: rgba(200, 25, 46, .18);
  color: var(--primary-dark);
  box-shadow: inset 3px 0 0 var(--primary), 0 12px 26px rgba(200, 25, 46, .105), inset 0 1px 0 rgba(255,255,255,.96);
}
.nav button:hover:not(.active) {
  background: rgba(255,255,255,.68);
  border-color: var(--line);
  color: var(--ink);
  transform: translateX(2px);
}

.main {
  min-width: 0;
  background: transparent;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 34px 22px;
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(28px) saturate(1.18);
  backdrop-filter: blur(28px) saturate(1.18);
  box-shadow: 0 10px 30px rgba(33, 28, 31, .045);
}
h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.12;
  letter-spacing: 0;
}
h2 {
  margin: 0 0 15px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}
h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}
.topbar p {
  margin-top: 6px;
  color: var(--muted);
}
.content {
  padding: 30px 34px 64px;
  max-width: 1540px;
}
.content:empty::before {
  content: "Đang tải dữ liệu...";
  display: block;
  padding: 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-3d);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
}
.card h2, .card h3 { color: var(--ink); }
.card > .muted:first-child { margin-bottom: 8px; }

.metric {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border-top: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.74)),
    var(--surface);
  box-shadow: var(--shadow-3d);
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}
.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--ink);
}
.metric::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(23, 107, 104, .75));
}

.muted { color: var(--muted); }
.tiny-meta {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid rgba(200, 25, 46, .12);
  font-size: 11.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,241,243,.88);
  color: var(--primary-dark);
  border: 1px solid rgba(200, 25, 46, .12);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}
.chip.ok {
  color: #16633f;
  background: rgba(234, 248, 239, .9);
  border-color: rgba(29, 122, 79, .18);
}
.chip.warn {
  color: #80500e;
  background: rgba(255, 246, 223, .9);
  border-color: rgba(154, 100, 23, .2);
}
.chip.danger {
  color: #991b1b;
  background: rgba(255,240,240,.92);
  border-color: rgba(161, 18, 34, .18);
}

.btn {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.86);
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92);
  transition: transform .18s var(--ease-ios), box-shadow .18s var(--ease-ios), background .18s var(--ease-ios), border-color .18s var(--ease-ios), filter .18s var(--ease-ios);
}
.btn:hover {
  transform: translateY(-1px) scale(1.005);
  border-color: #cfc1c5;
  box-shadow: 0 12px 24px rgba(32, 26, 28, .10), inset 0 1px 0 rgba(255,255,255,.96);
}
.btn:active {
  transform: translateY(0) scale(.985);
  filter: saturate(.96);
}
.btn.primary {
  background: linear-gradient(180deg, #d72238, var(--primary));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 14px 26px rgba(200, 25, 46, .22), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #c8192e, var(--primary-dark));
  border-color: var(--primary-dark);
}
.btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
.btn.ghost { background: rgba(255,255,255,.62); }
.btn.danger {
  color: #fff;
  background: linear-gradient(180deg, #b7192b, var(--danger));
  border-color: var(--danger);
  box-shadow: 0 14px 26px rgba(161, 18, 34, .18), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.align-end { align-self: end; }

.form {
  display: grid;
  gap: 14px;
}
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-wide { grid-column: 1 / -1; }
.form.inline-form {
  grid-template-columns: minmax(150px, 1.2fr) repeat(2, minmax(130px, 1fr)) auto;
  align-items: end;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.88);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  transition: border-color .18s var(--ease-ios), box-shadow .18s var(--ease-ios), background .18s var(--ease-ios);
}
textarea {
  resize: vertical;
  min-height: 96px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--focus-ring), inset 0 1px 0 rgba(255,255,255,.96);
}

.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row strong { letter-spacing: 0; }
.row p { line-height: 1.45; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(32, 26, 28, .055), inset 0 1px 0 rgba(255,255,255,.9);
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.38;
}
th {
  background: rgba(246, 247, 249, .9);
  color: #5f5659;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 900;
}
td { color: var(--ink); }
tbody tr:hover td { background: #fffafb; }
tr:last-child td { border-bottom: 0; }

.notice {
  margin: 18px 34px 0;
  padding: 13px 15px;
  border-radius: 8px;
  border: 1px solid #e8c1c7;
  background: rgba(255,241,243,.88);
  color: var(--primary-dark);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
}
.notice.error {
  border-color: #f2b6b6;
  background: rgba(255,242,242,.92);
  color: #951525;
}
.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 15px;
  border-radius: 8px;
  background: rgba(26, 111, 71, .92);
  color: #fff;
  box-shadow: 0 18px 38px rgba(45, 38, 41, .18);
  font-weight: 800;
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  animation: toastIn .28s var(--ease-ios);
}
.toast.error {
  background: rgba(161, 18, 34, .94);
}
.refresh-fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(200, 25, 46, .18);
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  color: var(--primary-dark);
  box-shadow: 0 18px 38px rgba(45, 38, 41, .16);
  font-weight: 900;
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
}
.refresh-fab span {
  font-size: 19px;
  line-height: 1;
}
pre.card {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #342d2f;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.employee-list { overflow: hidden; }
.employee-card {
  border-top: 1px solid var(--line);
}
.employee-card:first-of-type {
  border-top: 0;
}
.employee-card > summary {
  list-style: none;
}
.employee-card > summary::-webkit-details-marker {
  display: none;
}
.employee-summary {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr) minmax(220px, auto) auto;
  gap: 14px;
  align-items: center;
  min-height: 74px;
  padding: 14px 0;
  cursor: pointer;
}
.employee-index,
.service-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255,241,243,.9);
  color: var(--primary-dark);
  border: 1px solid rgba(200,25,46,.14);
  font-size: 12px;
  font-weight: 950;
}
.employee-main small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 750;
}
.employee-open-label {
  justify-self: end;
  min-width: 46px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}
.employee-details {
  display: grid;
  gap: 12px;
  padding: 0 0 16px 56px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.detail-grid > div {
  min-height: 68px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.58);
}
.detail-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}
.employee-actions {
  justify-content: flex-start;
}
.employee-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(230px, auto) minmax(260px, auto);
  gap: 16px;
  align-items: center;
  padding: 17px 0;
  border-top: 1px solid var(--line);
}
.employee-row:first-of-type { border-top: 0; }
.employee-main strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15.5px;
}
.employee-main p + p { margin-top: 4px; }
.employee-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.employee-row .top-actions {
  justify-content: flex-end;
}
.employee-edit-panel {
  padding: 18px;
  margin: 0 0 10px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field-group {
  display: grid;
  gap: 7px;
}
.field-group > span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
}
.field-group > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.58);
}
.payroll-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 11px 0 15px;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13px;
}
.commission-strip {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 11px 0 15px;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13px;
}
.payroll-strip span {
  background: rgba(255,255,255,.68);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.35;
  min-width: 0;
}
.payroll-strip strong { color: var(--primary-dark); }

.auth-grid {
  max-width: 980px;
}
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 18px;
  max-width: 1040px;
}
.auth-primary {
  min-height: 330px;
  align-content: start;
  border-left: 4px solid var(--primary);
  background:
    linear-gradient(135deg, rgba(255,241,243,.74), rgba(255,255,255,.88)),
    var(--surface);
}
.auth-primary h2 {
  font-size: 24px;
}
.auth-secondary {
  align-self: start;
}
.module-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  max-width: 1040px;
  margin-top: 18px;
}
.module-tile {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
}
.module-tile .nav-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
}
.module-tile span {
  font-size: 13px;
  font-weight: 850;
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(200, 25, 46, .08), rgba(247,239,226,.58) 52%, rgba(255,255,255,.74)),
    var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow-3d);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  backdrop-filter: blur(18px) saturate(1.08);
}
.dashboard-hero h2 {
  margin: 12px 0 8px;
  font-size: 24px;
}
.dashboard-hero p {
  color: var(--muted);
}
.hero-total {
  min-width: 260px;
  padding: 16px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), transparent 35%),
    linear-gradient(180deg, #d72238, var(--primary-dark));
  color: #fff;
  text-align: right;
  box-shadow: 0 14px 28px rgba(200, 25, 46, .18);
}
.hero-total span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.hero-total strong {
  display: block;
  color: #fff;
  font-size: 25px;
  line-height: 1.15;
}
.dashboard-lower {
  margin-top: 18px;
}
.finance-card {
  margin-top: 18px;
}
.finance-lower {
  margin-top: 18px;
}
.finance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.finance-grid > div {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.64);
}
.finance-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.finance-grid strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
}
.service-group-row td {
  background: rgba(247, 239, 226, .58);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.service-group-row span {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}
.approval-row {
  align-items: flex-start;
}
.approval-edit {
  display: grid;
  grid-template-columns: 90px minmax(160px, 1fr);
  gap: 8px;
  min-width: 270px;
}
.report-total::before {
  display: none;
}
.report-total {
  border-left: 0;
}
.expense-list {
  margin-top: 16px;
}

.company-expense-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.company-expense-list {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.compact-title h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.company-expense-table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.company-expense-table {
  margin: 0;
  min-width: 820px;
}

.company-expense-table th,
.company-expense-table td {
  vertical-align: middle;
}

.company-expense-table tbody tr.is-editing td {
  background: rgba(183, 29, 50, .06);
}

.compact-actions {
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.compact-actions .btn {
  min-height: 34px;
  padding: 8px 12px;
}
.compact-row {
  padding: 12px 0;
}
.employee-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.employee-cost-row:first-of-type {
  border-top: 0;
}
.employee-cost-row strong {
  display: block;
  margin-bottom: 5px;
}
.employee-cost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}
.employee-cost-grid .employee-cost-row:nth-child(-n + 2) {
  border-top: 0;
}

.notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(247, 239, 226, .82), rgba(255,255,255,.78));
  box-shadow: var(--shadow-3d);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  backdrop-filter: blur(16px) saturate(1.08);
}
.notice-card.urgent {
  border-color: rgba(200, 25, 46, .22);
  background: linear-gradient(135deg, rgba(200, 25, 46, .12), rgba(255,255,255,.86));
}
.notice-card h2 {
  margin: 10px 0 6px;
}
.notice-card p {
  color: var(--muted);
}
.announcement-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.announcement-item:first-child {
  border-top: 0;
}
.announcement-item.unread {
  margin: 0 -12px;
  padding: 16px 12px;
  border: 1px solid rgba(200, 25, 46, .16);
  border-radius: 8px;
  background: rgba(255,241,243,.76);
}
.announcement-head {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
  margin-bottom: 7px;
}
.read-status {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
  color: var(--primary-dark);
  font-weight: 900;
}
.read-status span {
  color: var(--muted);
  font-size: 12px;
}
.read-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}
.settings-layout {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr);
  gap: 18px;
}
.settings-layout > .card:last-child {
  grid-column: 1 / -1;
}
.ai-panel {
  grid-row: span 2;
}
.ai-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}
.ai-panel > summary::-webkit-details-marker { display: none; }
.ai-panel > summary strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}
.ai-panel > summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ai-panel:not([open]) {
  align-self: start;
}
.ai-panel[open] > summary {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ai-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.ai-result {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,253,249,.86);
  color: var(--ink);
  line-height: 1.58;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.preference-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.62);
  color: var(--ink);
  cursor: pointer;
}
.preference-row span {
  display: grid;
  gap: 4px;
}
.preference-row strong {
  color: var(--ink);
  font-size: 15px;
}
.preference-row small {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}
.preference-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.preference-row i {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: #d8dce2;
  border: 1px solid rgba(36, 28, 32, .08);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
  transition: background .2s var(--ease-ios), box-shadow .2s var(--ease-ios);
}
.preference-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
  transition: transform .22s var(--ease-ios);
}
.preference-row input:checked + i {
  background: linear-gradient(180deg, #39d079, #1dba61);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.28), 0 6px 16px rgba(29, 186, 97, .24);
}
.preference-row input:checked + i::after {
  transform: translateX(20px);
}
.preference-row input:focus-visible + i,
.btn:focus-visible,
.nav button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.content > * {
  animation: pageIn .32s var(--ease-ios);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 48px rgba(33, 28, 31, .095), inset 0 1px 0 rgba(255,255,255,.92);
  }
  .module-tile:hover,
  .metric:hover {
    transform: translateY(-2px);
  }
  .card,
  .module-tile,
  .metric {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(255,255,255,.82);
    box-shadow: 0 -12px 30px rgba(33, 28, 31, .11);
    -webkit-backdrop-filter: blur(26px) saturate(1.18);
    backdrop-filter: blur(26px) saturate(1.18);
  }
  .brand { display: none; }
  .brand {
    margin-bottom: 8px;
    padding: 8px 4px 14px;
  }
  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button {
    flex: 0 0 76px;
    min-height: 56px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    padding: 7px 6px;
    font-size: 10.5px;
    text-align: center;
    white-space: normal;
  }
  .nav button.active {
    box-shadow: inset 0 3px 0 var(--primary), 0 10px 22px rgba(200, 25, 46, .12), inset 0 1px 0 rgba(255,255,255,.9);
  }
  .nav-icon { width: 20px; height: 20px; }
  .nav button:hover:not(.active) { transform: none; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    align-items: flex-start;
    flex-direction: column;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: rgba(255,255,255,.8);
    -webkit-backdrop-filter: blur(26px) saturate(1.16);
    backdrop-filter: blur(26px) saturate(1.16);
  }
  .content { padding: 16px 14px calc(100px + env(safe-area-inset-bottom)); }
  .notice { margin: 16px 20px 0; }
  .grid.two, .grid.three, .form.two, .form.inline-form, .auth-layout, .settings-layout, .student-extra-grid, .student-learning-mode-group { grid-template-columns: 1fr; }
  .finance-grid,
  .payroll-strip,
  .detail-grid,
  .employee-cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-layout > .card:last-child { grid-column: auto; }
  .module-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .hero-total {
    min-width: 0;
    text-align: left;
  }
  table {
    display: block;
    overflow-x: auto;
  }
  .employee-summary {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .employee-summary .employee-meta,
  .employee-open-label {
    grid-column: 2;
    justify-self: start;
  }
  .employee-details {
    padding-left: 0;
  }
  .employee-row .top-actions,
  .employee-meta {
    justify-content: flex-start;
  }
  body.auth-mode .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-top: 0;
    border-right: 0;
    box-shadow: none;
  }
  body.auth-mode .brand {
    display: flex;
  }
  body.auth-mode .content {
    padding-bottom: 32px;
  }
  body:not(.auth-mode) .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(180deg, rgba(255,255,255,.94) 0, rgba(248,250,252,.94) 235px, rgba(255,244,245,.82) 100%),
      var(--bg);
  }
  .app-shell {
    min-height: 100dvh;
  }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: auto;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(200, 25, 46, .10);
    border-right: 0;
    background: rgba(255,255,255,.82);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 -18px 40px rgba(33, 28, 31, .12);
  }
  .brand { display: none; }
  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button {
    flex: 0 0 72px;
    min-height: 58px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    padding: 7px 6px;
    font-size: 10.2px;
    text-align: center;
    border-radius: 12px;
  }
  .nav button.active {
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,241,243,.88));
    box-shadow: inset 0 3px 0 var(--primary), 0 10px 22px rgba(200, 25, 46, .13), inset 0 1px 0 rgba(255,255,255,.95);
  }
  .nav-icon {
    width: 20px;
    height: 20px;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(255,255,255,.78);
    -webkit-backdrop-filter: blur(26px) saturate(1.16);
    backdrop-filter: blur(26px) saturate(1.16);
    box-shadow: none;
  }
  .topbar h1 { font-size: 22px; }
  .topbar p { font-size: 13px; }
  .content {
    padding: 12px 14px calc(104px + env(safe-area-inset-bottom));
  }
  .refresh-fab {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(138px + env(safe-area-inset-bottom));
  }
  .notice {
    margin: 12px 14px 0;
  }
  .dashboard-hero {
    padding: 18px;
    border-left: 0;
    border-top: 4px solid var(--primary);
  }
  .hero-total {
    width: 100%;
  }
  .grid {
    gap: 12px;
  }
  .card {
    padding: 16px;
    border-color: rgba(216, 205, 208, .78);
    box-shadow: 0 14px 30px rgba(45, 38, 41, .075), inset 0 1px 0 rgba(255,255,255,.9);
  }
  .notice-card,
  .announcement-item {
    grid-template-columns: 1fr;
  }
  .notice-card {
    align-items: stretch;
  }
  .announcement-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .ai-actions .btn {
    flex: 1 1 100%;
  }
  .metric {
    min-height: 98px;
  }
  .row,
  .employee-cost-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .employee-cost-grid .employee-cost-row:nth-child(-n + 2) {
    border-top: 1px solid var(--line);
  }
  .employee-cost-grid .employee-cost-row:first-child {
    border-top: 0;
  }
  .approval-edit {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }
  .finance-grid > div {
    min-height: 88px;
  }
  .auth-primary {
    min-height: auto;
  }
  body.auth-mode .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-top: 0;
    border-right: 0;
    box-shadow: none;
  }
  body.auth-mode .brand {
    display: flex;
  }
  body.auth-mode .content {
    padding-bottom: 32px;
  }
  body:not(.auth-mode) .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
  }
}
.nested-card {
  margin-top: 14px;
  box-shadow: none;
  background: var(--surface-soft);
}

@media (max-width: 560px) {
  .sidebar { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .brand-mark {
    width: 50px;
    height: 50px;
  }
  h1 { font-size: 24px; }
  h2 { font-size: 17px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .notice { margin-left: 16px; margin-right: 16px; }
  .card { padding: 16px; }
  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .top-actions .btn {
    flex: 1 1 auto;
  }
  .metric { min-height: 104px; }
  .metric strong { font-size: 24px; }
  .module-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-grid,
  .payroll-strip,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .employee-cost-grid {
    grid-template-columns: 1fr;
  }
  .employee-summary {
    gap: 10px;
  }
  .employee-meta .chip {
    font-size: 11.5px;
  }
}

/* iOS app refresh v05 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
  font-size: 15px;
  background:
    radial-gradient(circle at 50% -120px, rgba(255, 255, 255, .98), transparent 340px),
    linear-gradient(180deg, #f9fafb 0%, #f3f5f8 44%, #fff4f6 100%);
}
button,
input,
select,
textarea {
  font-size: 16px;
}
.card,
.module-tile,
.dashboard-hero,
.notice-card,
table {
  border-radius: 8px;
}
.card {
  border-color: rgba(36, 28, 32, .08);
  background: rgba(255,255,255,.82);
  box-shadow: 0 14px 36px rgba(28, 24, 27, .07), inset 0 1px 0 rgba(255,255,255,.94);
}
.card h2 {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 850;
}
.muted {
  color: #6d666a;
}
.btn {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
}
.btn.primary {
  background: linear-gradient(180deg, #d9283e, #b7162a);
  color: #fff;
  border-color: #b7162a;
  box-shadow: 0 12px 24px rgba(183, 22, 42, .22), inset 0 1px 0 rgba(255,255,255,.22);
}
input,
select,
textarea {
  min-height: 46px;
  border-radius: 8px;
  background: rgba(255,255,255,.92);
}
textarea {
  font-size: 15px;
  line-height: 1.45;
}
.auth-primary,
.auth-secondary {
  background: rgba(255,255,255,.94);
}
.auth-primary h2,
.auth-secondary h2 {
  color: var(--ink);
}
.auth-primary p,
.auth-secondary p {
  color: #6d666a;
}
.auth-primary label,
.auth-secondary label {
  color: #70686c;
}
.chip {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}
.row strong,
.employee-main strong,
.announcement-copy strong {
  font-weight: 850;
}
.announcement-list-card {
  overflow: hidden;
}
.announcement-card {
  border-top: 1px solid var(--line);
}
.announcement-card:first-of-type {
  border-top: 0;
}
.announcement-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  list-style: none;
  cursor: pointer;
}
.announcement-card > summary::-webkit-details-marker {
  display: none;
}
.announcement-severity {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(200,25,46,.12);
  background: rgba(255,241,243,.86);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: capitalize;
}
.announcement-severity.warn {
  border-color: rgba(154,100,23,.16);
  background: rgba(255,246,223,.9);
  color: #80500e;
}
.announcement-severity.danger {
  border-color: rgba(161,18,34,.16);
  background: rgba(255,240,240,.92);
  color: #991b1b;
}
.announcement-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.announcement-copy strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}
.announcement-copy em {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.announcement-copy small {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
}
.announcement-toggle {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.announcement-detail {
  display: grid;
  gap: 12px;
  padding: 0 0 16px 70px;
}
.announcement-detail p {
  margin: 0;
  color: #343035;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.announcement-actions {
  justify-content: flex-start;
}
.announcement-card.unread > summary {
  margin: 0 -10px;
  padding: 14px 10px;
  border-radius: 8px;
  background: rgba(255,241,243,.68);
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
    background:
      linear-gradient(180deg, #fbfcfd 0, #f4f6f9 46%, #fff4f6 100%);
  }
  .app-shell {
    min-height: 100dvh;
  }
  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: 62px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    border-bottom: 1px solid rgba(36,28,32,.07);
    background: rgba(255,255,255,.86);
    box-shadow: 0 8px 22px rgba(28,24,27,.06);
  }
  .topbar > div:first-child {
    min-width: 0;
  }
  .topbar h1 {
    overflow: hidden;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar p {
    display: none;
  }
  .topbar .top-actions {
    flex: 0 0 auto;
    width: auto;
    gap: 6px;
    justify-content: flex-end;
  }
  .topbar .chip {
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .btn {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .content {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 14px 14px calc(94px + env(safe-area-inset-bottom));
  }
  .sidebar {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.9);
    box-shadow: 0 -10px 28px rgba(28,24,27,.12);
  }
  .nav {
    justify-content: flex-start;
    gap: 5px;
  }
  .nav button {
    flex: 0 0 68px;
    min-height: 54px;
    padding: 6px 5px;
    border-radius: 8px;
    font-size: 10px;
    line-height: 1.15;
  }
  .nav button span {
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-icon {
    width: 19px;
    height: 19px;
  }
  .grid,
  .stack {
    gap: 12px;
  }
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card {
    padding: 15px;
  }
  .card h2 {
    font-size: 16px;
    line-height: 1.25;
  }
  .metric {
    min-height: 92px;
    gap: 10px;
  }
  .metric span {
    font-size: 11px;
    line-height: 1.25;
  }
  .metric strong {
    font-size: 21px;
    line-height: 1.15;
  }
  .dashboard-hero {
    gap: 14px;
    margin-bottom: 14px;
    padding: 16px;
  }
  .dashboard-hero h2 {
    margin: 9px 0 6px;
    font-size: 20px;
    line-height: 1.18;
  }
  .hero-total strong {
    font-size: 22px;
  }
  th,
  td {
    padding: 10px 11px;
    font-size: 13px;
  }
  .row {
    gap: 8px;
    padding: 12px 0;
  }
  .row p,
  .tiny-meta {
    font-size: 12.5px;
  }
  .notice-card {
    margin: 12px 0;
    padding: 15px;
  }
  .notice-card h2 {
    margin: 8px 0 5px;
    font-size: 18px;
  }
  .notice-card p {
    font-size: 13.5px;
    line-height: 1.45;
  }
  .announcement-card > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 10px;
    padding: 13px 0;
  }
  .announcement-severity {
    grid-column: 1 / -1;
    width: fit-content;
    min-width: 0;
  }
  .announcement-copy strong {
    font-size: 15px;
  }
  .announcement-copy em {
    font-size: 13.5px;
    line-height: 1.42;
  }
  .announcement-detail {
    padding-left: 0;
  }
  .announcement-detail p {
    font-size: 14px;
    line-height: 1.55;
  }
  .read-list {
    max-height: 180px;
    overflow: auto;
  }
  .employee-summary {
    min-height: 68px;
  }
  .detail-grid,
  .payroll-strip {
    gap: 8px;
  }
  .detail-grid > div,
  .payroll-strip span {
    padding: 10px;
  }
  .refresh-fab {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
  }
}

@media (max-width: 390px) {
  .content {
    padding-left: 12px;
    padding-right: 12px;
  }
  .grid.three,
  .finance-grid,
  .payroll-strip,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .topbar .chip {
    display: none;
  }
  .nav button {
    flex-basis: 64px;
  }
}

/* Production design system v06 */
:root {
  --app-bg: #f7f4f5;
  --app-bg-2: #f1f3f6;
  --surface: rgba(255, 255, 255, .9);
  --surface-solid: #ffffff;
  --surface-muted: #f8f7f8;
  --surface-raised: rgba(255, 255, 255, .96);
  --ink: #181315;
  --text-primary: #181315;
  --text-secondary: #625b60;
  --text-tertiary: #91898e;
  --border: rgba(30, 22, 26, .10);
  --border-strong: rgba(30, 22, 26, .18);
  --primary: #b9162a;
  --primary-2: #d92b40;
  --primary-dark: #7f1020;
  --primary-soft: #fff1f3;
  --secondary: #365f5d;
  --secondary-soft: #edf7f6;
  --success: #17764b;
  --warning: #9a6417;
  --error: #ad1828;
  --disabled: #b9b4b7;
  --shadow-xs: 0 1px 2px rgba(28, 22, 25, .05);
  --shadow-sm: 0 8px 22px rgba(28, 22, 25, .07);
  --shadow-md: 0 18px 46px rgba(28, 22, 25, .10);
  --shadow-lg: 0 26px 70px rgba(28, 22, 25, .13);
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --content-max: 1180px;
  --touch: 44px;
  --ease-ios: cubic-bezier(.2, .8, .2, 1);
}

html {
  background: var(--app-bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.86) 0%, rgba(247,244,245,.94) 34%, rgba(241,243,246,.98) 100%),
    var(--app-bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(185,22,42,.035), transparent 28%, rgba(54,95,93,.035)),
    linear-gradient(180deg, rgba(255,255,255,.65), transparent 40%);
  z-index: -1;
}

button,
input,
select,
textarea {
  font-size: 16px;
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.main {
  min-width: 0;
}

.sidebar,
.topbar,
.card,
.notice,
.toast,
.refresh-fab {
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
}

.sidebar {
  padding: var(--space-6) var(--space-4);
  background: rgba(255,255,255,.74);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 34px rgba(28,22,25,.045);
}

.brand {
  min-height: 72px;
  margin-bottom: var(--space-5);
  padding: var(--space-2) var(--space-2) var(--space-5);
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  border-color: rgba(185,22,42,.12);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.95);
}

.brand strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

.brand span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.nav {
  gap: var(--space-2);
}

.nav button {
  min-height: 48px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 820;
}

.nav button.active {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,241,243,.92));
  color: var(--primary-dark);
  border-color: rgba(185,22,42,.16);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm);
}

.nav button:hover:not(.active) {
  background: rgba(255,255,255,.66);
  border-color: var(--border);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.topbar {
  min-height: 78px;
  padding: calc(var(--space-5) + env(safe-area-inset-top)) var(--space-8) var(--space-5);
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(28,22,25,.045);
}

h1,
h2,
h3 {
  color: var(--text-primary);
  font-weight: 900;
}

h1 {
  font-size: clamp(23px, 2.4vw, 31px);
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.22;
}

.topbar p,
.muted {
  color: var(--text-secondary);
}

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) 80px;
}

body.auth-mode .content {
  max-width: 1100px;
}

.grid {
  gap: var(--space-4);
}

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

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

.card,
table,
.dashboard-hero,
.notice-card,
.module-tile {
  border-radius: var(--radius);
}

.card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.92);
}

.card h2 {
  margin-bottom: var(--space-3);
  font-size: 18px;
  font-weight: 900;
}

.section-title {
  margin-bottom: var(--space-3);
  align-items: center;
}

.section-title h2 {
  margin-bottom: var(--space-1);
}

.section-title p {
  font-size: 13px;
}

.metric {
  min-height: 112px;
  padding: var(--space-5);
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(255,255,255,.78)),
    var(--surface);
}

.metric span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.metric strong {
  color: var(--text-primary);
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.08;
}

.metric::before {
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.dashboard-hero {
  padding: var(--space-6);
  background:
    linear-gradient(135deg, rgba(185,22,42,.08), rgba(255,255,255,.86) 52%, rgba(54,95,93,.08)),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.dashboard-hero h2 {
  font-size: clamp(22px, 2.2vw, 28px);
}

.hero-total {
  background: linear-gradient(180deg, var(--primary-2), var(--primary-dark));
  box-shadow: 0 18px 34px rgba(185,22,42,.22);
}

.btn {
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.92);
  color: var(--text-primary);
  font-weight: 850;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.96);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  border-color: var(--primary);
  box-shadow: 0 14px 30px rgba(185,22,42,.22), inset 0 1px 0 rgba(255,255,255,.22);
}

.btn.ghost {
  background: rgba(255,255,255,.62);
}

.btn.danger {
  background: linear-gradient(180deg, #c82336, var(--error));
  border-color: var(--error);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.96);
}

.btn:active,
.nav button:active,
.module-tile:active,
summary:active {
  transform: scale(.985);
}

.btn:disabled,
button:disabled {
  opacity: .52;
  color: var(--disabled);
}

input,
select,
textarea {
  min-height: var(--touch);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.94);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

textarea {
  min-height: 104px;
  line-height: 1.5;
}

label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(185,22,42,.62);
  box-shadow: 0 0 0 4px rgba(185,22,42,.12), inset 0 1px 0 rgba(255,255,255,.95);
}

.chip,
.eyebrow {
  border-radius: 999px;
  border-color: rgba(185,22,42,.12);
  background: rgba(255,241,243,.86);
  color: var(--primary-dark);
  font-weight: 900;
}

.chip.ok {
  color: var(--success);
  background: rgba(237,247,241,.92);
  border-color: rgba(23,118,75,.18);
}

.chip.warn {
  color: var(--warning);
  background: rgba(255,247,225,.92);
  border-color: rgba(154,100,23,.18);
}

.chip.danger {
  color: var(--error);
  background: rgba(255,241,242,.94);
  border-color: rgba(173,24,40,.18);
}

table {
  background: var(--surface-raised);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

th {
  background: var(--surface-muted);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 950;
}

td {
  color: var(--text-primary);
}

tbody tr:hover td {
  background: rgba(255,241,243,.38);
}

.row {
  border-top-color: var(--border);
}

.employee-card,
.announcement-card {
  border-top-color: var(--border);
}

.employee-summary,
.announcement-card > summary {
  transition: background .18s var(--ease-ios), transform .18s var(--ease-ios);
}

.employee-summary:hover,
.announcement-card > summary:hover {
  background: rgba(255,255,255,.52);
}

.payroll-strip,
.finance-grid,
.detail-grid,
.employee-cost-grid {
  gap: var(--space-3);
}

.payroll-strip span,
.finance-grid > div,
.detail-grid > div {
  background: rgba(255,255,255,.72);
  border-color: var(--border);
}

.auth-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: var(--space-5);
}

.auth-primary,
.auth-secondary {
  background: rgba(255,255,255,.94);
  border-color: var(--border);
}

.auth-primary {
  min-height: 360px;
  border-left: 0;
  position: relative;
  overflow: hidden;
}

.auth-primary::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.module-strip {
  gap: var(--space-3);
}

.module-tile {
  min-height: 94px;
  background: rgba(255,255,255,.82);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.notice {
  border-color: rgba(185,22,42,.16);
  background: rgba(255,241,243,.88);
  color: var(--primary-dark);
}

.notice.error {
  border-color: rgba(173,24,40,.18);
  background: rgba(255,241,242,.94);
  color: var(--error);
}

.toast {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.refresh-fab {
  min-height: var(--touch);
  border-radius: 999px;
}

.loading-state {
  display: grid;
  gap: var(--space-4);
  width: min(520px, 100%);
  margin: 10vh auto 0;
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.loading-mark {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  animation: loadingPulse 1.15s var(--ease-ios) infinite;
}

.loading-state h2 {
  margin: 0 0 var(--space-1);
  font-size: 19px;
}

.loading-state p {
  margin: 0;
  color: var(--text-secondary);
}

.skeleton-stack {
  display: grid;
  gap: var(--space-2);
}

.skeleton-stack span {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(30,22,26,.06), rgba(255,255,255,.72), rgba(30,22,26,.06));
  background-size: 220% 100%;
  animation: skeletonShimmer 1.2s linear infinite;
}

.skeleton-stack span:nth-child(2) {
  width: 78%;
}

.skeleton-stack span:nth-child(3) {
  width: 58%;
}

body.offline .topbar::after {
  content: "Offline";
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(154,100,23,.18);
  background: rgba(255,247,225,.94);
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
}

@keyframes loadingPulse {
  0%, 100% { opacity: .55; transform: scaleX(.72); transform-origin: left center; }
  50% { opacity: 1; transform: scaleX(1); transform-origin: left center; }
}

@keyframes skeletonShimmer {
  from { background-position: 220% 0; }
  to { background-position: -220% 0; }
}

/* Production polish v07 */
:root {
  --app-bg: #f8f6f7;
  --app-bg-2: #eef3f4;
  --surface: rgba(255, 255, 255, .92);
  --surface-muted: #f7f6f7;
  --surface-raised: rgba(255, 255, 255, .98);
  --border: rgba(31, 24, 28, .105);
  --border-strong: rgba(31, 24, 28, .18);
  --primary: #b71328;
  --primary-2: #da2a40;
  --primary-dark: #79101f;
  --secondary: #2f615e;
  --shadow-xs: 0 1px 2px rgba(28, 22, 25, .045);
  --shadow-sm: 0 10px 24px rgba(28, 22, 25, .072);
  --shadow-md: 0 18px 48px rgba(28, 22, 25, .105);
  --content-max: 1200px;
}

body {
  background:
    linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(248,246,247,.96) 42%, rgba(238,243,244,.96) 100%),
    var(--app-bg);
}

body::before {
  background:
    linear-gradient(135deg, rgba(183,19,40,.04), transparent 32%, rgba(47,97,94,.045)),
    linear-gradient(180deg, rgba(255,255,255,.74), transparent 44%);
}

.main {
  isolation: isolate;
}

.topbar > div:first-child,
.section-title > div,
.row > div,
.employee-main,
.announcement-copy {
  min-width: 0;
}

.topbar {
  padding-right: max(var(--space-8), env(safe-area-inset-right));
  padding-left: max(var(--space-8), env(safe-area-inset-left));
}

.topbar .top-actions {
  flex-wrap: nowrap;
}

.topbar .btn,
.nav button,
.chip,
.employee-open-label,
.announcement-toggle {
  white-space: nowrap;
}

.nav-label-compact {
  display: none;
}

.card {
  position: relative;
}

.card,
.dashboard-hero,
.notice-card,
.module-tile,
table {
  border-color: var(--border);
}

.content > .card + .card,
.content > .grid + .card,
.content > .card + .grid,
.content > .grid + .grid,
.content > .notice-card + .card,
.content > .notice-card + .grid {
  margin-top: var(--space-4);
}

.card > h2 + p.muted:last-child,
.card > p.muted:only-child,
.card > p.muted:last-child:not(:only-child) {
  padding: 14px;
  border: 1px dashed rgba(31,24,28,.12);
  border-radius: var(--radius);
  background: rgba(255,255,255,.58);
}

.row {
  min-width: 0;
}

.row strong,
.row p,
.finance-grid strong,
.detail-grid strong,
.payroll-strip strong {
  overflow-wrap: anywhere;
}

.compact-row .muted:not(.tiny-meta),
.employee-cost-row .muted:not(.tiny-meta) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.btn {
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

.btn,
button,
summary,
label.preference-row {
  touch-action: manipulation;
}

.btn:disabled,
button:disabled {
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
  opacity: .78;
}

.metric,
.finance-grid > div,
.detail-grid > div,
.payroll-strip span {
  overflow: hidden;
}

.metric strong,
.finance-grid strong,
.hero-total strong,
.chip {
  font-variant-numeric: tabular-nums;
}

.finance-grid > div,
.detail-grid > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.finance-grid strong {
  margin-top: 10px;
  font-size: clamp(17px, 1.65vw, 21px);
}

.employee-card {
  border-top-color: var(--border);
}

.employee-summary {
  margin: 0 -8px;
  padding: 14px 8px;
  border-radius: var(--radius);
}

.employee-card[open] .employee-summary {
  background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,241,243,.48));
}

.employee-index,
.service-index {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.employee-main strong {
  line-height: 1.24;
}

.employee-meta .chip {
  min-height: 28px;
  padding: 5px 9px;
}

.employee-open-label,
.announcement-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(183,19,40,.14);
  border-radius: 999px;
  background: rgba(255,241,243,.74);
  color: var(--primary-dark);
}

.employee-details,
.announcement-detail {
  animation: pageIn .22s var(--ease-ios);
}

.employee-actions {
  gap: 8px;
}

.announcement-list-card {
  overflow: hidden;
}

.announcement-card {
  margin: 0 -8px;
  padding: 0 8px;
  border-top-color: var(--border);
}

.announcement-card > summary {
  border-radius: var(--radius);
}

.announcement-card[open] > summary {
  background: rgba(255,255,255,.62);
}

.announcement-card.unread > summary {
  background: linear-gradient(180deg, rgba(255,241,243,.78), rgba(255,255,255,.66));
  box-shadow: inset 3px 0 0 var(--primary);
}

.announcement-copy em {
  max-width: 72ch;
}

table {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

th,
td {
  overflow-wrap: normal;
}

.service-group-row td {
  background: linear-gradient(90deg, rgba(255,241,243,.72), rgba(237,247,246,.58));
}

.loading-state {
  position: relative;
  overflow: hidden;
}

.loading-state::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

body.auth-mode {
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(248,246,247,.92) 44%, rgba(237,247,246,.82)),
    var(--app-bg);
}

body.auth-mode .topbar {
  display: none;
}

body.auth-mode .app-shell {
  grid-template-columns: minmax(250px, 34vw) minmax(0, 1fr);
}

body.auth-mode .sidebar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 22px 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,241,243,.52)),
    rgba(255,255,255,.72);
}

body.auth-mode .brand {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0 0 20px;
  border-bottom-color: rgba(183,19,40,.12);
}

body.auth-mode .nav {
  display: none;
}

body.auth-mode .content {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  max-width: 1040px;
  padding-top: max(36px, env(safe-area-inset-top));
  padding-bottom: max(36px, env(safe-area-inset-bottom));
}

body.auth-mode .auth-layout,
body.auth-mode .module-strip {
  width: 100%;
}

body.auth-mode .auth-layout {
  align-items: start;
}

body.auth-mode .auth-primary,
body.auth-mode .auth-secondary {
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.96);
}

body.auth-mode .auth-primary {
  min-height: auto;
  padding: clamp(22px, 3vw, 32px);
}

body.auth-mode .auth-primary h2 {
  max-width: 13ch;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.08;
}

body.auth-mode .auth-primary .muted,
body.auth-mode .auth-secondary .muted {
  max-width: 48ch;
  line-height: 1.55;
}

body.auth-mode .module-strip {
  margin-top: var(--space-4);
}

body.auth-mode .module-tile {
  min-height: 86px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .content {
    padding: var(--space-5) var(--space-5) calc(96px + env(safe-area-inset-bottom));
  }
  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255,255,255,.9);
    box-shadow: 0 -12px 32px rgba(28,22,25,.11);
  }
  .brand {
    display: none;
  }
  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0;
    scroll-padding: 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav button {
    flex: 0 0 76px;
    min-height: 56px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 6px 5px;
    font-size: 10.5px;
    line-height: 1.15;
    text-align: center;
    scroll-snap-align: center;
  }
  .nav-label-full {
    display: none;
  }
  .nav-label-compact {
    display: inline;
  }
  .nav button.active {
    box-shadow: inset 0 3px 0 var(--primary), var(--shadow-sm);
  }
  .nav button span {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 860px) {
  .topbar {
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    gap: var(--space-2);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .topbar h1 {
    max-width: none;
    overflow: hidden;
    font-size: 20px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar p {
    display: none;
  }
  .topbar .top-actions {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 6px;
  }
  .topbar .chip {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .btn {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .content {
    max-width: 560px;
    padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
  }
  .section-title {
    gap: 10px;
  }
  .section-title .chip {
    align-self: start;
  }
  .grid.two,
  .auth-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .grid.three,
  .finance-grid,
  .detail-grid,
  .payroll-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card {
    padding: var(--space-4);
  }
  .metric {
    min-height: 94px;
  }
  .metric strong {
    font-size: 22px;
  }
  .dashboard-hero {
    padding: var(--space-4);
    flex-direction: column;
    align-items: stretch;
  }
  .hero-total {
    min-width: 0;
    text-align: left;
  }
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .announcement-card > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }
  .announcement-severity {
    grid-column: 1 / -1;
    width: fit-content;
    min-width: 0;
  }
  .announcement-detail {
    padding-left: 0;
  }
  .employee-summary {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .employee-summary .employee-meta {
    grid-column: 2 / 4;
    justify-self: start;
  }
  .employee-open-label {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
  .employee-details {
    padding-left: 0;
  }
  .employee-cost-grid {
    grid-template-columns: 1fr;
  }
  .employee-cost-grid .employee-cost-row:nth-child(-n + 2) {
    border-top: 1px solid var(--border);
  }
  .employee-cost-grid .employee-cost-row:first-child {
    border-top: 0;
  }
}

@media (max-width: 430px) {
  .content {
    padding-left: 12px;
    padding-right: 12px;
  }
  .topbar .chip {
    display: none;
  }
  .grid.three,
  .finance-grid,
  .detail-grid,
  .payroll-strip {
    grid-template-columns: 1fr;
  }
  .nav button {
    flex-basis: 66px;
    font-size: 9.8px;
  }
  .auth-primary,
  .auth-secondary {
    padding: var(--space-4);
  }
  body.auth-mode .auth-primary h2 {
    max-width: none;
  }
}

@media (max-width: 760px) {
  body.auth-mode .app-shell {
    display: block;
  }
  body.auth-mode .sidebar {
    position: static;
    height: auto;
    padding: max(18px, env(safe-area-inset-top)) 14px 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  body.auth-mode .brand {
    min-height: 64px;
    padding-bottom: 16px;
  }
  body.auth-mode .brand-mark {
    width: 52px;
    height: 52px;
  }
  body.auth-mode .content {
    min-height: auto;
    align-content: start;
    max-width: 520px;
    padding: 18px 12px 34px;
  }
  body.auth-mode .auth-layout {
    gap: 12px;
  }
  body.auth-mode .module-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .employee-actions,
  .announcement-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .employee-actions .btn,
  .announcement-actions .btn {
    width: 100%;
  }
  table {
    border-radius: var(--radius);
  }
  th,
  td {
    white-space: nowrap;
  }
  td .top-actions {
    flex-wrap: nowrap;
  }
  .service-group-row td {
    white-space: normal;
  }
  .finance-grid > div,
  .detail-grid > div {
    min-height: 82px;
  }
  .payroll-strip span {
    min-height: 58px;
  }
}

@media (max-width: 380px) {
  body.auth-mode .module-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

/* Production redesign v09: premium app shell + dashboard */
:root {
  color-scheme: light;
  --bg: #f8f7f8;
  --bg-elevated: #eef4f3;
  --surface: rgba(255, 255, 255, .94);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: rgba(255, 255, 255, .68);
  --surface-tint: #fff3f5;
  --glass: rgba(255, 255, 255, .76);
  --ink: #171214;
  --text-primary: #171214;
  --text-secondary: #5f585d;
  --text-tertiary: #928a90;
  --muted: #5f585d;
  --muted-2: #928a90;
  --line: rgba(31, 24, 28, .10);
  --border: rgba(31, 24, 28, .10);
  --border-strong: rgba(31, 24, 28, .18);
  --primary: #b71328;
  --primary-2: #dc3147;
  --primary-dark: #74101f;
  --primary-soft: #fff1f4;
  --secondary: #2e625f;
  --secondary-soft: #edf7f6;
  --success: #14744b;
  --warning: #946014;
  --error: #a91425;
  --focus-ring: rgba(183, 19, 40, .16);
  --shadow-xs: 0 1px 2px rgba(24, 18, 21, .05);
  --shadow-sm: 0 10px 24px rgba(24, 18, 21, .07);
  --shadow-md: 0 18px 48px rgba(24, 18, 21, .10);
  --shadow-lg: 0 28px 74px rgba(24, 18, 21, .13);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --font-xs: 11px;
  --font-sm: 12.5px;
  --font-md: 15px;
  --font-lg: 18px;
  --font-xl: 24px;
  --font-2xl: 32px;
  --content-max: 1240px;
  --sidebar-width: 286px;
  --touch: 44px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --ease-ios: cubic-bezier(.2, .8, .2, 1);
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92) 0, rgba(248,247,248,.97) 40%, rgba(238,244,243,.95) 100%),
    var(--bg);
  color: var(--text-primary);
  font-size: var(--font-md);
  line-height: 1.5;
}

body::before {
  background:
    linear-gradient(135deg, rgba(183, 19, 40, .045), transparent 36%, rgba(46, 98, 95, .055)),
    linear-gradient(180deg, rgba(255,255,255,.76), transparent 42%);
}

.app-shell {
  min-height: 100dvh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  padding: calc(22px + var(--safe-top)) 16px 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,243,245,.48)),
    rgba(255,255,255,.72);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 34px rgba(24, 18, 21, .05);
}

.brand {
  min-height: 76px;
  gap: 12px;
  margin-bottom: 18px;
  padding: 6px 6px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(183, 19, 40, .14);
  background: var(--surface-solid);
  box-shadow: 0 14px 28px rgba(183, 19, 40, .12), inset 0 1px 0 rgba(255,255,255,.95);
}

.brand strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .12em;
}

.brand span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.nav {
  gap: 8px;
}

.nav button {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
}

.nav button.active {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,241,244,.92));
  border-color: rgba(183, 19, 40, .16);
  color: var(--primary-dark);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm);
}

.nav button:hover:not(.active) {
  background: rgba(255,255,255,.70);
  border-color: var(--border);
  color: var(--text-primary);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 78px;
  padding: calc(18px + var(--safe-top)) max(28px, env(safe-area-inset-right)) 18px max(28px, env(safe-area-inset-left));
  background: rgba(255,255,255,.80);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 26px rgba(24, 18, 21, .045);
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar h1 {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 950;
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.topbar .top-actions {
  flex-wrap: nowrap;
}

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 84px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.94);
}

.btn {
  min-height: var(--touch);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255,255,255,.92);
  color: var(--text-primary);
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.96);
}

.btn.primary {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  color: #fff;
  box-shadow: 0 14px 30px rgba(183,19,40,.22), inset 0 1px 0 rgba(255,255,255,.22);
}

.btn.subtle {
  background: rgba(255,241,244,.66);
  border-color: rgba(183,19,40,.12);
  color: var(--primary-dark);
}

.btn:hover {
  transform: translateY(-1px);
}

input,
select,
textarea {
  min-height: 46px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.94);
  color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(183,19,40,.62);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.chip,
.eyebrow {
  border-radius: 999px;
  border-color: rgba(183,19,40,.13);
  background: rgba(255,241,244,.88);
  color: var(--primary-dark);
  font-weight: 900;
}

.chip.ok {
  color: var(--success);
  background: rgba(237,247,241,.94);
  border-color: rgba(20,116,75,.18);
}

.chip.warn {
  color: var(--warning);
  background: rgba(255,247,225,.94);
  border-color: rgba(148,96,20,.18);
}

.chip.danger {
  color: var(--error);
  background: rgba(255,241,243,.96);
  border-color: rgba(169,20,37,.18);
}

.dashboard-page {
  display: grid;
  gap: 16px;
}

.dashboard-hero-v2 {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
  align-items: stretch;
  gap: 18px;
  min-height: 238px;
  margin: 0;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(183,19,40,.12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(183,19,40,.10), rgba(255,255,255,.90) 50%, rgba(46,98,95,.12)),
    var(--surface-solid);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.95);
}

.dashboard-hero-v2::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255,255,255,.62), transparent 34%),
    radial-gradient(circle at 94% 12%, rgba(46,98,95,.16), transparent 28%);
}

.dashboard-hero-v2 > * {
  position: relative;
}

.hero-copy {
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.hero-copy h2 {
  max-width: 760px;
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 950;
  line-height: 1.03;
  letter-spacing: 0;
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 750;
}

.hero-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-status-strip span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.70);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.90);
}

.hero-status-strip strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.hero-total-v2 {
  min-width: 0;
  display: grid;
  align-content: end;
  gap: 9px;
  padding: 18px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255,255,255,.17), transparent 34%),
    linear-gradient(180deg, var(--primary-2), var(--primary-dark));
  color: #fff;
  box-shadow: 0 20px 42px rgba(183,19,40,.24);
}

.hero-total-v2 span,
.hero-total-v2 small {
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 850;
}

.hero-total-v2 strong {
  color: #fff;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-stat {
  position: relative;
  min-height: 142px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.78));
}

.dashboard-stat::before,
.dashboard-stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  display: block;
  background: linear-gradient(90deg, rgba(183,19,40,.72), rgba(46,98,95,.68));
}

.dashboard-stat::after {
  inset: auto 14px 12px auto;
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: rgba(183,19,40,.20);
}

.dashboard-stat-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(183,19,40,.12);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.dashboard-stat-icon .nav-icon {
  width: 19px;
  height: 19px;
}

.dashboard-stat-copy {
  display: grid;
  gap: 5px;
}

.dashboard-stat-copy span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 950;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.dashboard-stat-copy strong {
  color: var(--text-primary);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 950;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.dashboard-stat-copy small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.dashboard-stat.tone-secondary .dashboard-stat-icon,
.dashboard-stat.tone-neutral .dashboard-stat-icon {
  background: var(--secondary-soft);
  border-color: rgba(46,98,95,.16);
  color: var(--secondary);
}

.dashboard-stat.tone-success .dashboard-stat-icon,
.dashboard-stat.tone-people .dashboard-stat-icon {
  background: rgba(237,247,241,.94);
  border-color: rgba(20,116,75,.16);
  color: var(--success);
}

.dashboard-stat.tone-warning .dashboard-stat-icon {
  background: rgba(255,247,225,.94);
  border-color: rgba(148,96,20,.16);
  color: var(--warning);
}

.dashboard-stat.tone-danger .dashboard-stat-icon {
  background: rgba(255,241,243,.96);
  border-color: rgba(169,20,37,.16);
  color: var(--error);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, .78fr);
  gap: 16px;
  align-items: start;
}

.dashboard-panel,
.finance-card-v2 {
  padding: 18px;
}

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

.dashboard-panel-header h2 {
  margin: 3px 0 4px;
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 950;
  line-height: 1.18;
}

.dashboard-panel-header p {
  max-width: 54ch;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.42;
}

.panel-kicker {
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.dashboard-announcement-list,
.dashboard-activity-list,
.employee-cost-grid-v2 {
  display: grid;
  gap: 10px;
}

.dashboard-announcement-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.66);
  overflow: hidden;
}

.dashboard-announcement-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  cursor: pointer;
  list-style: none;
}

.dashboard-announcement-card > summary::-webkit-details-marker {
  display: none;
}

.dashboard-announcement-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.25;
}

.dashboard-announcement-card em {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: normal;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-announcement-card small {
  display: block;
  margin-top: 5px;
  color: var(--text-tertiary);
  font-size: 11.5px;
  font-weight: 750;
}

.dashboard-announcement-card > p {
  padding: 0 13px 13px 37px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.5;
}

.announcement-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--secondary);
  box-shadow: 0 0 0 4px rgba(46,98,95,.10);
}

.announcement-dot.warn {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(148,96,20,.12);
}

.announcement-dot.danger {
  background: var(--error);
  box-shadow: 0 0 0 4px rgba(169,20,37,.12);
}

.finance-card-v2 {
  grid-column: 1 / -1;
  background:
    linear-gradient(135deg, rgba(255,241,244,.74), rgba(255,255,255,.92) 45%, rgba(237,247,246,.70)),
    var(--surface);
}

.finance-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(183,19,40,.12);
  border-radius: var(--radius);
  background: rgba(255,255,255,.70);
}

.finance-summary span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.finance-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--text-primary);
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.finance-summary small {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

.finance-ring {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--primary) 0 62%, rgba(183,19,40,.14) 62% 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.96), var(--shadow-sm);
}

.finance-ring span {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0;
}

.finance-grid-v2 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.finance-tile {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.74);
}

.finance-tile span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 950;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.finance-tile strong {
  color: var(--text-primary);
  font-size: clamp(17px, 1.7vw, 22px);
  font-weight: 950;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.finance-tile small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.finance-tile.tone-revenue {
  border-color: rgba(20,116,75,.16);
  background: rgba(237,247,241,.76);
}

.finance-tile.tone-cost {
  border-color: rgba(183,19,40,.12);
  background: rgba(255,248,249,.76);
}

.dashboard-payroll-panel {
  grid-column: 1 / -1;
}

.employee-cost-grid-v2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.employee-cost-grid-v2 .employee-cost-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 74px;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.employee-cost-grid-v2 .employee-cost-row:nth-child(-n + 2) {
  border-top: 0;
}

.dashboard-activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.66);
}

.dashboard-activity-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.25;
}

.dashboard-activity-row p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed rgba(31,24,28,.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,.54);
  color: var(--text-secondary);
  text-align: center;
}

.dashboard-empty .nav-icon {
  color: var(--success);
}

.dashboard-empty p {
  max-width: 28ch;
  font-size: 13px;
  font-weight: 750;
}

.notice-card.dashboard-alert-card {
  margin: 0;
}

@media (hover: hover) and (pointer: fine) {
  .dashboard-stat:hover,
  .dashboard-panel:hover,
  .finance-card-v2:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.94);
  }
}

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

  .content {
    max-width: 760px;
    padding: 16px 16px calc(96px + var(--safe-bottom));
  }

  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: auto;
    padding: 8px 10px calc(8px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255,255,255,.92);
    box-shadow: 0 -14px 34px rgba(24,18,21,.12);
  }

  .brand {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0;
    scroll-padding: 8px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 70px;
    min-height: 56px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 6px 5px;
    border-radius: var(--radius);
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
  }

  .nav button.active {
    box-shadow: inset 0 3px 0 var(--primary), var(--shadow-sm);
  }

  .nav-label-full {
    display: none;
  }

  .nav-label-compact {
    display: inline;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar {
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: calc(10px + var(--safe-top)) 14px 10px;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar p {
    display: none;
  }

  .topbar .chip {
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 980px) {
  .dashboard-hero-v2,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

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

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

  .finance-card-v2,
  .dashboard-payroll-panel {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .content {
    max-width: 540px;
    padding: 12px 12px calc(92px + var(--safe-bottom));
  }

  .dashboard-page {
    gap: 12px;
  }

  .dashboard-hero-v2,
  .dashboard-panel,
  .finance-card-v2 {
    padding: 15px;
  }

  .hero-copy h2 {
    font-size: 25px;
    line-height: 1.08;
  }

  .hero-total-v2 {
    padding: 15px;
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-stat {
    min-height: 128px;
    padding: 13px;
  }

  .dashboard-stat-copy strong {
    font-size: 22px;
  }

  .dashboard-panel-header {
    display: grid;
    gap: 10px;
  }

  .dashboard-panel-header .btn,
  .dashboard-panel-header .chip {
    width: fit-content;
  }

  .finance-summary {
    grid-template-columns: 1fr;
  }

  .finance-ring {
    width: 92px;
    height: 92px;
  }

  .finance-grid-v2,
  .employee-cost-grid-v2 {
    grid-template-columns: 1fr;
  }

  .employee-cost-grid-v2 .employee-cost-row:nth-child(-n + 2) {
    border-top: 1px solid var(--border);
  }

  .employee-cost-grid-v2 .employee-cost-row:first-child {
    border-top: 0;
  }

  .dashboard-announcement-card > summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dashboard-announcement-card > summary .chip {
    grid-column: 2;
    justify-self: start;
  }

  .dashboard-activity-row {
    align-items: start;
  }
}

@media (max-width: 390px) {
  .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-status-strip span {
    width: 100%;
  }

  .nav button {
    flex-basis: 64px;
    font-size: 9.5px;
  }
}

/* Commission approval clarity v11 */
.income-service-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(46,98,95,.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(237,247,246,.76), rgba(255,255,255,.78));
}

.income-service-preview:empty {
  display: none;
}

.income-service-preview div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.income-service-preview span,
.approval-money-grid span {
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.income-service-preview strong,
.approval-money-grid strong {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.income-service-preview small,
.approval-money-grid small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.income-service-preview .income-commission-lines {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.income-service-preview .income-commission-lines small {
  line-height: 1.5;
}

.approval-board {
  padding: 18px;
}

.approval-list {
  display: grid;
  gap: 14px;
}

.approval-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.76));
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.94);
}

.approval-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.approval-main h3 {
  margin: 3px 0 5px;
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 950;
  line-height: 1.2;
}

.income-approval-lines {
  display: grid;
  gap: 12px;
}

.income-approval-line {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(46,98,95,.14);
  border-radius: var(--radius);
  background: rgba(255,255,255,.68);
}

.income-approval-line-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.income-approval-line-head h4 {
  margin: 3px 0 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 950;
  line-height: 1.25;
}

.approval-money-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.approval-money-grid > div,
.approval-money-grid > label {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.68);
}

.approval-money-grid input {
  min-height: 40px;
  padding: 8px 10px;
  font-weight: 850;
}

.approval-result-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(183,19,40,.12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255,241,244,.78), rgba(237,247,246,.58));
}

.approval-result-strip span {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.approval-result-strip strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.approval-result-strip .approval-total {
  color: var(--primary-dark);
}

.approval-result-strip .approval-total strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.reconciliation-danger-row {
  background: #fff4f5;
}

.reconciliation-danger-row td {
  border-color: rgba(161, 18, 34, .22);
}

.reconciliation-danger-text {
  color: var(--danger);
  font-weight: 950;
}

.reconciliation-customer-table .chip.danger {
  white-space: normal;
  text-align: left;
}

.approval-group-strip {
  border-color: rgba(46,98,95,.16);
  background:
    linear-gradient(135deg, rgba(237,247,246,.82), rgba(255,255,255,.78));
}

.approval-note {
  padding: 10px 12px;
  border-left: 3px solid rgba(46,98,95,.42);
  border-radius: var(--radius);
  background: rgba(237,247,246,.62);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.approval-actions {
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .approval-money-grid,
  .approval-result-strip,
  .income-service-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .approval-board,
  .approval-card {
    padding: 14px;
  }

  .approval-main {
    display: grid;
  }

  .approval-money-grid,
  .approval-result-strip,
  .income-service-preview {
    grid-template-columns: 1fr;
  }

  .approval-money-grid > div,
  .approval-money-grid > label {
    min-height: 0;
  }

  .approval-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .approval-actions .btn {
    width: 100%;
  }
}

/* Admin AI + income validation + iOS push readiness v13 */
.form-error-summary {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid rgba(190, 42, 54, .2);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,239,241,.9), rgba(255,255,255,.82));
  color: var(--primary-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92);
}

.form-error-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 950;
}

.form-error-summary ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

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

.required-field .form-label,
.required-label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
  color: var(--text-secondary);
  line-height: 1.25;
}

.required-mark,
.required-field b {
  display: inline;
  color: var(--primary);
  font-size: 13px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
  flex: 0 0 auto;
}

label.has-error input,
label.has-error select,
label.has-error textarea {
  border-color: rgba(190, 42, 54, .72);
  background: rgba(255,245,246,.92);
  box-shadow: 0 0 0 3px rgba(190, 42, 54, .1);
}

.field-error {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.ai-insight-card,
.ai-admin-center {
  overflow: hidden;
  border-color: rgba(46,98,95,.16);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(246,252,251,.84) 52%, rgba(255,243,246,.72)),
    var(--surface);
  box-shadow: 0 18px 48px rgba(35, 28, 31, .09), inset 0 1px 0 rgba(255,255,255,.94);
}

.ai-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.ai-card-head h2,
.ai-action-card h3 {
  margin: 0 0 5px;
  color: var(--text-primary);
  font-weight: 950;
  line-height: 1.15;
}

.ai-card-head p,
.ai-action-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.ai-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(183,19,40,.14);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,239,243,.82));
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(183,19,40,.11), inset 0 1px 0 rgba(255,255,255,.9);
}

.ai-mark .nav-icon {
  width: 21px;
  height: 21px;
}

.ai-mini-actions,
.ai-result-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ai-mini-actions {
  margin-top: 14px;
}

.ai-assistant-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(183, 29, 50, .13);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,246,248,.68));
}

.ai-assistant-box h3 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 950;
}

.ai-assistant-box p {
  margin: 0;
  line-height: 1.45;
}

.ai-assistant-box textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid rgba(31,24,28,.14);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255,255,255,.94);
  color: var(--text-primary);
  font: inherit;
  line-height: 1.5;
}

.ai-assistant-box textarea:focus {
  outline: 0;
  border-color: rgba(183, 29, 50, .42);
  box-shadow: 0 0 0 3px rgba(183, 29, 50, .1);
}

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

.ai-assistant-actions .btn.subtle {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 12px;
}

.ai-result-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(46,98,95,.16);
  border-radius: var(--radius);
  background: rgba(255,255,255,.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.ai-result-panel.loading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-result-panel.error {
  border-color: rgba(190,42,54,.22);
  background: rgba(255,242,244,.86);
  color: var(--primary-dark);
}

.ai-result-panel.error p,
.ai-result-panel.loading p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.ai-loading-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(46,98,95,.16);
  border-top-color: var(--secondary);
  animation: aiSpin 900ms linear infinite;
}

.ai-skeleton {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.ai-skeleton span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(46,98,95,.08), rgba(255,255,255,.8), rgba(46,98,95,.08));
  background-size: 220% 100%;
  animation: aiShimmer 1.2s ease-in-out infinite;
}

.ai-skeleton span:nth-child(2) { width: 82%; }
.ai-skeleton span:nth-child(3) { width: 64%; }

.ai-result-toolbar {
  margin-bottom: 10px;
}

.ai-result-toolbar small {
  color: var(--text-tertiary);
  font-weight: 800;
  margin-right: auto;
}

.ai-result-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.ai-sections {
  display: grid;
  gap: 12px;
}

.ai-section {
  padding: 12px;
  border: 1px solid rgba(31,24,28,.08);
  border-radius: var(--radius);
  background: rgba(255,255,255,.62);
}

.ai-section-title {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.ai-section p {
  margin: 0;
  color: var(--text-secondary);
}

.ai-section p + p {
  margin-top: 7px;
}

.ai-section ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.ai-section li {
  color: var(--text-secondary);
  line-height: 1.5;
}

.ai-summary {
  background: linear-gradient(135deg, rgba(237,247,246,.76), rgba(255,255,255,.72));
}

.ai-alert-list {
  border-color: rgba(190,42,54,.16);
  background: linear-gradient(135deg, rgba(255,242,244,.78), rgba(255,255,255,.72));
}

.ai-alert-list .ai-section-title {
  color: var(--primary-dark);
}

.ai-checklist li::marker {
  color: var(--secondary);
}

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

.ai-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ai-health-card {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.ai-health-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.ai-health-card span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-health-card strong {
  color: var(--text-primary);
  font-size: 26px;
  line-height: 1;
}

.ai-health-card small {
  color: var(--muted);
  font-weight: 760;
  line-height: 1.35;
}

.ai-health-ok { border-color: rgba(23, 107, 104, .22); }
.ai-health-warn { border-color: rgba(199, 160, 93, .38); background: #fffaf0; }
.ai-health-danger { border-color: rgba(200, 25, 46, .32); background: #fff6f7; }
.ai-health-muted { opacity: .84; }

.alert-row {
  border-left: 4px solid transparent;
}

.alert-row.danger { border-left-color: var(--danger); }
.alert-row.warn { border-left-color: var(--warning); }

.ai-action-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(31,24,28,.1);
  border-radius: var(--radius);
  background: rgba(255,255,255,.68);
}

.ai-compose-card {
  grid-column: 1 / -1;
}

.ai-compose-card label {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
}

.ai-compose-card textarea {
  min-height: 96px;
}

.approval-data-warning {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(190, 42, 54, .18);
  border-radius: var(--radius);
  background: rgba(255, 245, 235, .82);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.push-card {
  margin-top: 14px;
}

.push-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.push-status-grid span {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.66);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.push-status-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.push-guide {
  margin: 8px 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.push-guide.ios {
  padding: 10px 12px;
  border-left: 3px solid var(--secondary);
  border-radius: var(--radius);
  background: rgba(237,247,246,.72);
  font-weight: 800;
}

.approval-data-warning strong {
  color: var(--primary-dark);
}

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

@keyframes aiShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (max-width: 900px) {
  .ai-card-head,
  .ai-center-grid,
  .push-status-grid {
    grid-template-columns: 1fr;
  }

  .ai-card-head .btn {
    width: 100%;
  }

  .ai-compose-card {
    grid-column: auto;
  }
}

/* v14: Vietnamese polish, leave requests, premium brand */
.brand {
  position: relative;
  gap: 12px;
  padding: 12px 10px 18px;
}

.brand-mark {
  position: relative;
  border-radius: 16px;
  background:
    radial-gradient(circle at 24% 16%, rgba(255,255,255,.98), rgba(255,255,255,.64) 32%, rgba(255,236,240,.86) 72%),
    linear-gradient(145deg, rgba(200,25,46,.12), rgba(23,107,104,.1));
  box-shadow: 0 16px 34px rgba(145, 22, 40, .16), inset 0 1px 0 rgba(255,255,255,.92);
}

.brand-mark img {
  opacity: .92;
  transform: scale(.9);
  filter: drop-shadow(0 8px 14px rgba(145, 22, 40, .14));
}

.brand strong {
  letter-spacing: .12em;
  font-weight: 950;
}

.brand > div:last-child > span {
  color: var(--teal);
  font-weight: 850;
}

.employee-open-label::after,
.announcement-toggle::after {
  content: none !important;
  display: none !important;
}

.employee-open-label,
.announcement-toggle {
  min-height: 34px;
  min-width: max-content;
  gap: 4px;
  border-color: rgba(23,107,104,.16);
  background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(237,247,246,.78));
  color: var(--teal);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}

.employee-open-label .open-label,
.announcement-toggle .open-label {
  display: none;
}

.employee-card[open] .employee-open-label .closed-label,
.announcement-card[open] .announcement-toggle .closed-label {
  display: none;
}

.employee-card[open] .employee-open-label .open-label,
.announcement-card[open] .announcement-toggle .open-label {
  display: inline;
}

.leave-panel,
.leave-approval-board,
.overtime-panel,
.overtime-approval-board {
  margin-top: 14px;
  overflow: hidden;
  border-color: rgba(23,107,104,.16);
  background:
    linear-gradient(145deg, rgba(255,255,255,.95), rgba(237,247,246,.72)),
    var(--surface);
}

.leave-panel .form-error-summary,
.leave-panel form {
  margin-bottom: 14px;
}

.leave-balance-preview {
  grid-column: 1 / -1;
  justify-content: flex-start;
  width: fit-content;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.leave-history,
.leave-request-list {
  display: grid;
  gap: 12px;
}

.leave-request-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}

.leave-request-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.leave-request-main h3 {
  margin: 4px 0;
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.25;
}

.leave-request-body {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.leave-request-body p {
  color: var(--text-secondary);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.leave-request-body strong {
  color: var(--text-primary);
}

.leave-actions {
  justify-content: flex-end;
}

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

.cashier-stats {
  margin-bottom: 16px;
}

.cashier-layout,
.cashier-quick-grid {
  align-items: start;
}

.cashier-form {
  gap: 14px;
}

.cashier-form label {
  min-height: 74px;
}

.cashier-form input,
.cashier-form select,
.cashier-form textarea {
  min-height: 48px;
}

.cashier-service-line {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(160px, .9fr) minmax(190px, 1.2fr) minmax(180px, 1fr) minmax(140px, .7fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.7);
}

.cashier-service-line label {
  min-height: auto;
}

.cashier-service-line .btn {
  min-height: 48px;
  padding-inline: 14px;
}

.income-service-line {
  grid-template-columns: minmax(150px, .9fr) minmax(160px, .9fr) minmax(220px, 1.4fr) minmax(150px, .8fr) auto;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.compact-choice-grid {
  margin-top: 8px;
}

.choice-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.76);
}

.choice-check input {
  width: 18px;
  height: 18px;
}

.choice-check span {
  font-weight: 700;
  color: var(--text-primary);
}

.customer-pair {
  display: grid;
  grid-template-columns: minmax(120px, .55fr) minmax(220px, 1.45fr);
  gap: 10px;
  align-items: start;
}

.field-error input,
.field-error select,
.field-error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(161, 18, 34, .12);
}

.cashier-row {
  align-items: center;
}

.cashier-row-money {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 132px;
}

.cashier-row-money strong {
  font-size: 16px;
  color: var(--text-primary);
}

.cashier-return-panel {
  margin-bottom: 16px;
  border-color: rgba(190,42,54,.18);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,245,235,.78)),
    var(--surface);
}

.cashier-return-list {
  display: grid;
  gap: 10px;
}

.cashier-return-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(190,42,54,.16);
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
}

.cashier-return-item h3 {
  margin: 3px 0 4px;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.25;
}

.cashier-return-reason {
  margin-top: 7px;
  padding: 8px 10px;
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  background: rgba(255,245,235,.9);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 760;
  line-height: 1.4;
}

.cashier-return-reason strong {
  color: var(--danger);
}

.cashier-shift-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
}

.cashier-shift-preview span {
  color: var(--text-secondary);
  line-height: 1.4;
}

.cashier-shift-preview strong {
  display: block;
  color: var(--text-primary);
  font-size: 16px;
}

.cashier-approval-board {
  margin-bottom: 16px;
}

.cashier-approval-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.cashier-approval-grid section {
  display: grid;
  align-content: start;
  gap: 10px;
}

.cashier-approval-grid h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.cashier-approval-card {
  padding: 14px;
}

@media (max-width: 760px) {
  .brand {
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
  }

  .leave-request-main {
    display: grid;
  }

  .leave-actions {
    justify-content: stretch;
  }

  .leave-actions .btn {
    flex: 1 1 140px;
  }

  .cashier-approval-grid,
  .cashier-shift-preview,
  .cashier-service-line,
  .customer-pair {
    grid-template-columns: 1fr;
  }

  .cashier-row {
    align-items: stretch;
  }

  .cashier-return-item {
    display: grid;
  }

  .cashier-row-money {
    justify-items: start;
    min-width: 0;
  }

  .cashier-form label {
    min-height: auto;
  }
}

/* v15: tổng rà soát UI/UX, Cài đặt accordion, form mobile rõ hơn */
a.btn {
  text-decoration: none;
}

.section-gap {
  margin-top: var(--space-4);
}

.form-help {
  margin-top: 10px;
  line-height: 1.48;
}

.form-note {
  margin-bottom: 8px;
}

.section-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.toolbar,
.result-toolbar,
.settings-action-row {
  gap: 8px;
}

.result-toolbar {
  margin: 12px 0;
}

.report-table {
  margin-top: 12px;
}

.payroll-slip-card {
  background: linear-gradient(135deg, #fff 0%, #fff8f9 54%, #f7fbfa 100%);
  border: 1px solid rgba(183, 29, 50, .16);
}

.payroll-slip-head,
.payroll-slip-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.payroll-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.payroll-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(183, 29, 50, .16);
  background: #fff;
  box-shadow: 0 12px 28px rgba(183, 29, 50, .09);
}

.payroll-brand span,
.payroll-slip-identity span {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.payroll-brand h2 {
  margin: 3px 0;
  font-size: 24px;
}

.payroll-brand p {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 760;
}

.payroll-slip-identity {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(183, 29, 50, .12);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}

.payroll-slip-identity > div {
  min-width: 0;
}

.payroll-slip-identity strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 14px;
}

.payroll-slip-metric,
.payroll-slip-total {
  background: rgba(255,255,255,.86);
}

.payroll-slip-total {
  border-color: rgba(183, 29, 50, .25);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.payroll-slip-total span,
.payroll-slip-total .muted {
  color: rgba(255,255,255,.8);
}

.payroll-slip-total strong {
  color: #fff;
}

.source-rate-cell,
.source-value-cell {
  display: grid;
  gap: 6px;
}

.source-kpi-grid {
  gap: 10px;
}

.source-kpi {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(23, 107, 104, .14);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(250, 255, 255, .86));
}

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

.source-kpi strong {
  font-size: 24px;
  line-height: 1.1;
}

.source-rate-cell strong,
.source-value-cell strong {
  font-size: 13px;
}

.source-rate-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(23, 107, 104, .12);
  overflow: hidden;
}

.source-rate-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(23, 107, 104, .92), rgba(200, 25, 46, .88));
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed rgba(31, 24, 28, .15);
  border-radius: var(--radius);
  background: rgba(255,255,255,.58);
  color: var(--text-secondary);
  text-align: center;
}

.empty-state .nav-icon {
  width: 22px;
  height: 22px;
  color: var(--secondary);
}

.empty-state p {
  max-width: 34ch;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.42;
}

.settings-page {
  width: min(100%, 1120px);
  display: grid;
  gap: 16px;
  margin: 0 auto;
}

.settings-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 18px;
  align-items: stretch;
  padding: 22px;
  border: 1px solid rgba(183, 19, 40, .12);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255,241,244,.84), rgba(255,255,255,.92) 50%, rgba(237,247,246,.78)),
    var(--surface);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.94);
}

.settings-hero h2 {
  max-width: 17ch;
  margin: 10px 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.06;
  letter-spacing: 0;
}

.settings-hero p {
  max-width: 58ch;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

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

.settings-summary-grid span {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.70);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 820;
  line-height: 1.3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}

.settings-summary-grid strong {
  color: var(--text-primary);
  font-size: 21px;
  font-weight: 950;
  line-height: 1.08;
}

.settings-accordion {
  display: grid;
  gap: 12px;
}

.accordion-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.94);
}

.accordion-section[open] {
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.94);
}

.accordion-section.tone-danger {
  border-color: rgba(169,20,37,.18);
}

.accordion-section.tone-ai {
  border-color: rgba(46,98,95,.18);
}

.accordion-summary {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  transition: background .18s var(--ease-ios);
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-section[open] > .accordion-summary {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,241,244,.42));
}

.accordion-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.accordion-title strong {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 950;
  line-height: 1.2;
}

.accordion-title small {
  max-width: 72ch;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 760;
  line-height: 1.4;
}

.accordion-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 900;
}

.accordion-meta i {
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(183,19,40,.14);
  border-radius: 999px;
  background: rgba(255,241,244,.74);
}

.accordion-meta i::before,
.accordion-meta i::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary-dark);
  transition: transform .18s var(--ease-ios), opacity .18s var(--ease-ios);
}

.accordion-meta i::after {
  transform: rotate(90deg);
}

.accordion-section[open] .accordion-meta i::after {
  opacity: 0;
  transform: rotate(0);
}

.accordion-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.settings-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.settings-section-grid > .card:only-child,
.settings-section-grid > .ai-panel,
.settings-section-grid > .danger-card {
  grid-column: 1 / -1;
}

.settings-page .card {
  min-width: 0;
}

.danger-card {
  border-color: rgba(169,20,37,.18);
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,241,243,.82)),
    var(--surface);
}

.checkbox-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: auto;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 4px;
}

.checkbox-row strong {
  display: block;
  color: var(--text-primary);
}

.checkbox-row small {
  display: block;
  margin-top: 2px;
}

.form-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.64);
}

.student-extra-fields {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.student-extra-summary {
  list-style: none;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,241,244,.52));
}

.student-extra-summary::-webkit-details-marker {
  display: none;
}

.student-extra-summary span {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 900;
}

.student-extra-summary small {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 760;
}

.student-extra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}

.student-learning-mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.student-learning-mode-title {
  grid-column: 1 / -1;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 860;
}

.student-learning-mode-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255,255,255,.7);
  cursor: pointer;
}

.student-learning-mode-option span {
  color: var(--text-primary);
  font-weight: 780;
  font-size: 12.5px;
}

.student-storage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.student-storage-progress {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(19, 13, 17, .08);
  overflow: hidden;
}

.student-storage-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
}

.student-storage-progress-fill.tone-ok {
  background: linear-gradient(90deg, #129d5f, #1fb772);
}

.student-storage-progress-fill.tone-warn {
  background: linear-gradient(90deg, #f0a116, #f6bc45);
}

.student-storage-progress-fill.tone-danger {
  background: linear-gradient(90deg, #cd2b42, #e44c63);
}

.student-upload-progress {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.student-upload-progress-bar {
  position: relative;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(19, 13, 17, .1);
}

.student-upload-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #cc1950, #f45f84);
  transition: width .18s ease;
}

.student-upload-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.student-upload-progress-meta strong {
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 860;
}

.student-video-player-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.student-video-watermark {
  position: absolute;
  z-index: 3;
  color: rgba(142, 20, 44, .92);
  font-size: var(--watermark-size-fit, var(--watermark-size, 28px));
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255,255,255,.6), 0 1px 5px rgba(0,0,0,.32);
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(142, 20, 44, .28);
  background: rgba(255, 246, 248, .34);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  pointer-events: none;
  user-select: none;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-video-watermark.pos-top-left { top: 10px; left: 10px; }
.student-video-watermark.pos-top-right { top: 10px; right: 10px; }
.student-video-watermark.pos-bottom-left { bottom: 10px; left: 10px; }
.student-video-watermark.pos-bottom-right { bottom: 10px; right: 10px; }
.student-video-watermark.pos-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.student-video-watermark.pos-upper-third-center {
  top: 33%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.student-video-watermark.pos-lower-third-center {
  top: 67%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.student-video-watermark.pos-left-third-center {
  top: 50%;
  left: 33%;
  transform: translate(-50%, -50%);
}
.student-video-watermark.pos-right-third-center {
  top: 50%;
  left: 67%;
  transform: translate(-50%, -50%);
}

body.auth-mode .student-auth-layout {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.form-section-head,
.form-section > .section-title,
.form-section > [data-income-service-lines],
.form-section > [data-service-lines],
.form-section > .customer-pair,
.form-section > .income-service-preview,
.form-section > .tiny-meta {
  grid-column: 1 / -1;
}

.form-section-head {
  display: grid;
  gap: 4px;
}

.form-section-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.22;
}

.form-section-head p {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.form-section .section-title {
  margin-bottom: 0;
}

.form-section .compact-title {
  align-items: center;
}

.cashier-form label {
  min-height: auto;
}

.choice-check span {
  color: var(--text-primary);
}

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

.position-picker {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,241,244,.56));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92);
}

.position-picker-summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.position-picker-summary::-webkit-details-marker {
  display: none;
}

.position-picker-summary span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.position-picker-summary strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-picker-summary small {
  color: var(--text-tertiary);
  font-size: 11.5px;
  font-weight: 850;
  line-height: 1.25;
}

.position-picker-summary i {
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid rgba(183,19,40,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
}

.position-picker-summary i::before,
.position-picker-summary i::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary-dark);
  transform: translate(-50%, -50%);
  transition: transform .18s var(--ease-ios), opacity .18s var(--ease-ios);
}

.position-picker-summary i::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.position-picker[open] .position-picker-summary {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.76);
}

.position-picker[open] .position-picker-summary i::after {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0);
}

.position-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px;
}

.position-choice-check {
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.74);
  transition: border-color .18s var(--ease-ios), background .18s var(--ease-ios), transform .18s var(--ease-ios);
}

.position-choice-check:hover {
  border-color: rgba(183,19,40,.20);
  background: rgba(255,255,255,.94);
}

.position-choice-check input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.position-choice-check span {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.25;
}

.position-choice-check:has(input:checked) {
  border-color: rgba(20,116,75,.24);
  background: linear-gradient(145deg, rgba(237,247,241,.92), rgba(255,255,255,.86));
}

.position-choice-check:has(input:disabled:not(:checked)) {
  opacity: .48;
}

.position-picker-note {
  margin-top: 7px;
  line-height: 1.35;
}

.ai-panel {
  grid-row: auto;
}

.ai-panel > .section-title {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(46,98,95,.12);
}

.ai-center-grid {
  align-items: start;
}

@media (max-width: 980px) {
  .settings-hero,
  .settings-section-grid {
    grid-template-columns: 1fr;
  }

  .settings-hero h2 {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .section-gap {
    margin-top: 12px;
  }

  .settings-page {
    gap: 12px;
  }

  .settings-hero,
  .accordion-body {
    padding: 14px;
  }

  .settings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .settings-summary-grid span {
    min-height: 64px;
    padding: 10px;
  }

  .accordion-summary {
    min-height: 64px;
    align-items: flex-start;
    padding: 14px;
  }

  .accordion-meta > span {
    display: none;
  }

  .form-section,
  .income-service-line,
  .cashier-service-line,
  .customer-pair {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 12px;
  }

  .form-section .btn.primary,
  #income-form > .btn.primary,
  .cashier-form > .btn.primary {
    width: 100%;
  }

  .top-actions.result-toolbar,
  .settings-action-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .settings-action-row .btn,
  .result-toolbar .btn {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .settings-summary-grid {
    grid-template-columns: 1fr;
  }

  .settings-hero {
    padding: 12px;
  }
}

/* v16: Principal audit - dashboard điều hành mới, role guard rõ hơn */
.dashboard-page-v3 {
  gap: 18px;
}

.dashboard-hero-v3 {
  position: relative;
  min-height: 286px;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, .84fr);
  gap: 18px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(183, 19, 40, .14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255,255,255,.95) 0%, rgba(255,241,244,.86) 42%, rgba(237,247,246,.88) 100%),
    var(--surface-solid);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.96);
}

.dashboard-hero-v3::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(183,19,40,.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(46,98,95,.07) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .42;
  mask-image: linear-gradient(135deg, #000, transparent 76%);
}

.dashboard-hero-v3::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), rgba(20,116,75,.72));
  opacity: .75;
}

.dashboard-hero-v3 > * {
  position: relative;
  z-index: 1;
}

.dashboard-command-copy {
  min-width: 0;
  align-content: space-between;
  padding: 2px 0;
}

.dashboard-command-copy h2 {
  max-width: 760px;
  margin: 10px 0 8px;
  color: var(--text-primary);
  font-size: 44px;
  font-weight: 950;
  line-height: 1.03;
  letter-spacing: 0;
}

.dashboard-command-copy p {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
}

.dashboard-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 22px;
}

.dashboard-orbit-panel {
  min-width: 0;
  display: grid;
  align-content: end;
  gap: 9px;
  padding: 20px;
  border: 1px solid rgba(46,98,95,.16);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(23,18,20,.92), rgba(116,16,31,.88) 58%, rgba(46,98,95,.82));
  color: #fff;
  box-shadow: 0 26px 58px rgba(35, 28, 31, .18), inset 0 1px 0 rgba(255,255,255,.16);
}

.dashboard-orbit-panel .panel-kicker {
  color: rgba(255,255,255,.76);
}

.dashboard-orbit-panel > strong {
  color: #fff;
  font-size: 36px;
  font-weight: 950;
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.dashboard-orbit-panel > p {
  color: rgba(255,255,255,.88);
  font-size: 13px;
  font-weight: 900;
}

.dashboard-orbit-panel > small {
  color: rgba(255,255,255,.70);
  font-size: 12.5px;
  font-weight: 760;
  line-height: 1.4;
}

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

.dashboard-pulse-item {
  min-width: 0;
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius);
  background: rgba(255,255,255,.10);
}

.dashboard-pulse-item span,
.dashboard-pulse-item small {
  color: rgba(255,255,255,.70);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
}

.dashboard-pulse-item strong {
  color: #fff;
  font-size: 23px;
  font-weight: 950;
  line-height: 1;
}

.dashboard-pulse-item.tone-ok {
  background: rgba(237,247,241,.14);
}

.dashboard-pulse-item.tone-warn {
  background: rgba(255,247,225,.15);
}

.dashboard-pulse-item.tone-danger {
  background: rgba(255,241,243,.16);
}

.dashboard-stats-grid-v3 {
  gap: 12px;
}

.dashboard-stats-grid-v3 .dashboard-stat {
  min-height: 132px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(255,255,255,.76));
}

.dashboard-stats-grid-v3 .dashboard-stat::before {
  height: 2px;
  background: linear-gradient(90deg, rgba(183,19,40,.72), rgba(46,98,95,.55));
}

.dashboard-stats-grid-v3 .dashboard-stat::after {
  display: none;
}

.dashboard-cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 16px;
  align-items: start;
}

.dashboard-cockpit-grid .finance-card-v2,
.dashboard-cockpit-grid .dashboard-payroll-panel,
.dashboard-cockpit-grid .employee-focus-panel {
  grid-column: 1 / -1;
}

.dashboard-priority-list {
  display: grid;
  gap: 10px;
}

.admin-ops-center {
  border-color: rgba(183, 29, 50, .13);
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,248,249,.78));
}

.admin-ops-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.admin-ops-card {
  min-height: 112px;
  padding: 13px;
  border: 1px solid rgba(31,24,28,.09);
  border-radius: var(--radius);
  background: rgba(255,255,255,.82);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.admin-ops-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(183, 29, 50, .24);
  box-shadow: 0 14px 30px rgba(31,24,28,.08);
}

.admin-ops-card:disabled {
  cursor: default;
}

.admin-ops-card span,
.admin-ops-card small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.admin-ops-card strong {
  display: block;
  margin: 7px 0 5px;
  color: var(--text-primary);
  font-size: 25px;
  line-height: 1;
}

.admin-ops-card.tone-ok {
  border-color: rgba(23,107,104,.18);
  background: linear-gradient(135deg, rgba(242,250,249,.92), rgba(255,255,255,.82));
}

.admin-ops-card.tone-warn {
  border-color: rgba(199,160,93,.3);
  background: linear-gradient(135deg, rgba(255,250,240,.95), rgba(255,255,255,.82));
}

.admin-ops-card.tone-danger {
  border-color: rgba(183,29,50,.24);
  background: linear-gradient(135deg, rgba(255,244,246,.95), rgba(255,255,255,.82));
}

.dashboard-priority-item {
  min-width: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.68);
}

.priority-signal {
  width: 10px;
  height: 42px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(148,96,20,.10);
}

.dashboard-priority-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 950;
  line-height: 1.25;
}

.dashboard-priority-item p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dashboard-priority-item.tone-danger {
  border-color: rgba(169,20,37,.18);
  background: linear-gradient(145deg, rgba(255,245,246,.88), rgba(255,255,255,.76));
}

.dashboard-priority-item.tone-danger .priority-signal {
  background: var(--error);
  box-shadow: 0 0 0 4px rgba(169,20,37,.10);
}

.dashboard-priority-item.tone-ok {
  border-color: rgba(20,116,75,.16);
  background: linear-gradient(145deg, rgba(237,247,241,.88), rgba(255,255,255,.76));
}

.dashboard-priority-item.tone-ok .priority-signal {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(20,116,75,.10);
}

.dashboard-priority-item .btn {
  min-height: 38px;
  padding-inline: 12px;
}

.dashboard-cockpit-grid .dashboard-announcement-card {
  background: rgba(255,255,255,.72);
}

.finance-ring.positive {
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--success) 0 62%, rgba(20,116,75,.14) 62% 100%);
}

.finance-ring.negative {
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--error) 0 62%, rgba(169,20,37,.14) 62% 100%);
}

.employee-focus-panel .finance-tile.tone-revenue {
  border-color: rgba(46,98,95,.16);
  background: rgba(237,247,246,.80);
}

@media (max-width: 1080px) {
  .dashboard-hero-v3,
  .dashboard-cockpit-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-orbit-panel {
    align-content: start;
  }
}

@media (max-width: 760px) {
  .dashboard-page-v3 {
    gap: 12px;
  }

  .dashboard-hero-v3 {
    min-height: 0;
    padding: 16px;
  }

  .dashboard-hero-v3::after {
    left: 16px;
    right: 16px;
  }

  .dashboard-command-copy h2 {
    font-size: 30px;
    line-height: 1.08;
  }

  .dashboard-command-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 16px;
  }

  .dashboard-command-actions .btn {
    width: 100%;
  }

  .dashboard-orbit-panel {
    padding: 15px;
  }

  .dashboard-orbit-panel > strong {
    font-size: 28px;
  }

  .dashboard-pulse-grid {
    grid-template-columns: 1fr;
  }

  .admin-ops-grid {
    grid-template-columns: 1fr;
  }

  .admin-ops-card {
    min-height: 86px;
  }

  .dashboard-priority-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dashboard-priority-item .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 390px) {
  .dashboard-command-copy h2 {
    font-size: 27px;
  }

  .dashboard-orbit-panel > strong {
    font-size: 25px;
  }
}

.settings-inline-fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-inline-fieldset legend {
  padding: 0 6px;
  font-weight: 800;
  color: var(--ink);
}

/* v16: logo polish (source logo) */
.brand-mark {
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(200, 25, 46, .18);
  box-shadow: 0 12px 24px rgba(28, 20, 24, .08);
  padding: 5px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none !important;
  opacity: 1 !important;
  filter: none !important;
}

/* v103: Marketing compact panels and clearer charts */
.marketing-accordion {
  border-color: rgba(183, 19, 40, .10);
}

.marketing-accordion .accordion-summary {
  min-height: 58px;
  padding: 13px 16px;
}

.marketing-accordion .accordion-title strong {
  font-size: 16px;
}

.marketing-accordion .accordion-body {
  overflow-x: auto;
}

.marketing-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 850;
}

.marketing-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.marketing-chart-legend i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--legend);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--legend) 12%, transparent);
}

.marketing-line-chart-wrap,
.marketing-bar-chart,
.marketing-trend-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.90);
  box-shadow: var(--shadow-sm);
}

.marketing-chart-panel {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.marketing-chart-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.marketing-chart-kpi {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--kpi-color) 22%, var(--border));
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--kpi-color) 10%, #fff) 0%, #fff 70%);
}

.marketing-chart-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--kpi-color);
}

.marketing-chart-kpi span,
.marketing-chart-kpi small {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
}

.marketing-chart-kpi strong {
  display: block;
  margin: 5px 0;
  color: var(--text-primary);
  font-size: 25px;
  font-weight: 950;
}

.marketing-chart-kpi .trend-up {
  color: #087a48;
}

.marketing-chart-kpi .trend-down {
  color: #b71328;
}

.marketing-line-chart {
  display: block;
  min-width: 680px;
  width: 100%;
  height: auto;
  padding: 10px;
}

.marketing-line-chart .chart-bg {
  fill: rgba(183, 19, 40, .025);
  stroke: rgba(183, 19, 40, .08);
}

.marketing-line-chart line {
  stroke: rgba(51, 43, 47, .28);
  stroke-width: 1.3;
}

.marketing-line-chart .grid-line {
  stroke: rgba(51, 43, 47, .10);
}

.marketing-line-chart text {
  fill: var(--text-tertiary);
  font-size: 12px;
  font-weight: 850;
}

.marketing-line-chart .x-label {
  fill: var(--text-secondary);
}

.marketing-bar-chart {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.marketing-bar-row {
  display: grid;
  grid-template-columns: 58px minmax(240px, 1fr);
  gap: 12px;
  align-items: center;
}

.marketing-bar-row > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
}

.marketing-bar-row > div {
  display: grid;
  gap: 5px;
}

.marketing-bar-row i {
  position: relative;
  min-height: 22px;
  display: block;
  overflow: hidden;
  border-radius: 7px;
  background: rgba(35, 30, 33, .055);
}

.marketing-bar-row i::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar);
  min-width: 0;
  border-radius: inherit;
  background: var(--bar-color);
  opacity: .88;
}

.marketing-bar-row i b {
  position: relative;
  z-index: 1;
  display: inline-flex;
  padding: 3px 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.marketing-trend-table {
  min-width: 560px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.marketing-chart-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.marketing-chart-days > div {
  min-width: 112px;
  padding: 10px;
  border: 1px solid rgba(183, 19, 40, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
}

.marketing-chart-days span,
.marketing-chart-days small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
}

.marketing-chart-days strong {
  display: block;
  margin: 3px 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 950;
}

.marketing-history-channel {
  display: grid;
  gap: 5px;
}

.marketing-history-channel small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.marketing-history-board {
  display: grid;
  gap: 16px;
}

.marketing-day-group {
  overflow: hidden;
  border: 1px solid rgba(183, 19, 40, .13);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 247, 248, .72));
  box-shadow: 0 14px 34px rgba(42, 24, 28, .07);
}

.marketing-day-header {
  display: grid;
  grid-template-columns: minmax(160px, .42fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid rgba(183, 19, 40, .10);
  background: rgba(183, 19, 40, .035);
}

.marketing-day-header h3 {
  margin: 2px 0 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 950;
}

.marketing-day-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 8px;
}

.marketing-day-stats span {
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(35, 30, 33, .07);
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
}

.marketing-day-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 950;
}

.marketing-history-cards {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.marketing-history-card {
  padding: 14px;
  border: 1px solid rgba(35, 30, 33, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
}

.marketing-history-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.marketing-compare-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 8px;
}

.marketing-compare-cell {
  position: relative;
  min-height: 94px;
  padding: 11px 11px 10px;
  border: 1px solid rgba(35, 30, 33, .08);
  border-radius: 8px;
  background: rgba(247, 247, 248, .78);
}

.marketing-compare-cell::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: #929099;
}

.marketing-compare-cell.trend-up::before {
  background: #078a55;
}

.marketing-compare-cell.trend-down::before {
  background: #b71328;
}

.marketing-compare-cell.trend-flat::before {
  background: #a18646;
}

.marketing-compare-cell > span,
.marketing-compare-cell em {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.marketing-compare-cell strong {
  display: block;
  margin: 5px 0 4px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 950;
  line-height: 1.05;
}

.marketing-compare-cell small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 900;
}

.marketing-compare-cell.trend-up small {
  color: #087a48;
}

.marketing-compare-cell.trend-down small {
  color: #b71328;
}

.marketing-history-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px dashed rgba(183, 19, 40, .18);
  border-radius: 8px;
  background: rgba(183, 19, 40, .04);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

.platform-pill {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border: 1px solid rgba(183, 19, 40, .18);
  border-radius: 999px;
  background: rgba(183, 19, 40, .07);
  color: var(--primary);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.customer-photo-gallery {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.customer-photo-gallery h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 950;
}

.customer-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.customer-photo-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 112px;
  border: 1px solid rgba(189, 32, 50, .18);
  border-radius: 10px;
  background: rgba(189, 32, 50, .035);
}

.customer-photo-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.customer-photo-thumb span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--primary);
  font-size: 11px;
  font-weight: 950;
  box-shadow: 0 6px 16px rgba(31, 20, 24, .10);
}

.crm-panel {
  border-color: rgba(200, 25, 46, .18);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,246,247,.82));
}

.link-button {
  appearance: none;
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  color: var(--primary);
}

.icon-btn {
  min-width: 42px;
  min-height: 42px;
  justify-content: center;
  padding-inline: 12px;
  font-size: 22px;
  line-height: 1;
}

.approval-section {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
}

.approval-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.approval-section > summary::-webkit-details-marker {
  display: none;
}

.approval-section > summary h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
}

.approval-section > summary p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.approval-badge {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(23, 19, 22, .08);
  color: var(--muted);
  font-weight: 950;
}

.approval-badge.has-pending {
  background: var(--danger);
  color: #fff;
}

.approval-section-body {
  padding: 0 14px 14px;
}

.approval-section-cashier { border-color: rgba(23, 107, 104, .26); }
.approval-section-leave { border-color: rgba(199, 160, 93, .32); }
.approval-section-overtime { border-color: rgba(154, 100, 23, .28); }
.approval-section-marketing { border-color: rgba(37, 91, 166, .24); }
.approval-section-income { border-color: rgba(200, 25, 46, .24); }

.approval-sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 14, 16, .42);
  backdrop-filter: blur(8px);
}

.approval-sync-box {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(183, 19, 40, .18);
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 26px 70px rgba(35, 20, 24, .26);
  text-align: center;
}

.approval-sync-logo {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
}

.approval-sync-logo img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(183, 19, 40, .18);
}

.approval-sync-logo span {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(183, 19, 40, .14);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: approval-sync-spin .9s linear infinite;
}

.approval-sync-box h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 950;
}

.approval-sync-box p {
  margin: 8px 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 750;
}

.approval-sync-progress {
  overflow: hidden;
  height: 8px;
  margin: 0 0 10px;
  border-radius: 999px;
  background: rgba(183, 19, 40, .10);
}

.approval-sync-progress i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8d1020, #c8192e, #f1a9b1);
  animation: approval-sync-progress 1.25s ease-in-out infinite;
}

.approval-sync-box small {
  color: var(--text-tertiary);
  font-weight: 850;
}

.is-loading-action {
  opacity: .72;
  pointer-events: none;
}

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

@keyframes approval-sync-progress {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(85%); }
  100% { transform: translateX(230%); }
}

[data-income-service-lines] {
  counter-reset: income-service-line;
}

.income-service-line {
  position: relative;
  counter-increment: income-service-line;
  padding-left: 42px;
}

.income-service-line::before {
  content: counter(income-service-line);
  position: absolute;
  left: 10px;
  top: 16px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.task-work-list {
  display: grid;
  gap: 12px;
}

.task-work-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.82);
}

.task-work-card.task-danger { border-color: rgba(161, 18, 34, .28); }
.task-work-card.task-warn { border-color: rgba(154, 100, 23, .24); }
.task-work-card.task-ok { border-color: rgba(29, 122, 79, .22); }

.task-work-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.task-work-head h3 {
  margin: 2px 0 4px;
  font-size: 17px;
  font-weight: 950;
}

.task-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.task-flow span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(23, 19, 22, .06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-flow span.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.payroll-lock-card {
  border-color: rgba(190, 22, 45, .16);
}

.payroll-lock-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.payroll-lock-summary span {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.payroll-lock-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 16px;
}

/* Fresh operations theme v18 */
:root {
  --bg: #f3f7ff;
  --bg-elevated: #f8fbff;
  --surface: rgba(255, 255, 255, .94);
  --surface-solid: #ffffff;
  --surface-soft: #f7faff;
  --surface-tint: #eef5ff;
  --glass: rgba(255, 255, 255, .88);
  --glass-strong: rgba(255, 255, 255, .96);
  --sidebar: #ffffff;
  --sidebar-2: #f5f9ff;
  --ink: #152033;
  --muted: #657084;
  --muted-2: #98a3b6;
  --line: rgba(34, 49, 78, .10);
  --line-strong: rgba(34, 49, 78, .18);
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf2ff;
  --secondary: #10b981;
  --danger: #dc3545;
  --ok: #12a66a;
  --warn: #f97316;
  --gold: #f59e0b;
  --teal: #14b8a6;
  --purple: #7c3aed;
  --focus-ring: rgba(37, 99, 235, .18);
  --shadow: 0 18px 42px rgba(31, 46, 80, .10);
  --shadow-soft: 0 10px 26px rgba(31, 46, 80, .08);
  --shadow-sm: 0 8px 20px rgba(31, 46, 80, .07);
  --shadow-3d: 0 14px 30px rgba(31, 46, 80, .09), inset 0 1px 0 rgba(255,255,255,.95);
}

html,
body {
  background:
    linear-gradient(180deg, #f8fbff 0%, #eef5ff 44%, #f7faff 100%),
    var(--bg);
}

body::before {
  content: none !important;
}

.app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid rgba(37, 99, 235, .10);
  box-shadow: 10px 0 34px rgba(31, 46, 80, .06);
}

.brand {
  border-bottom-color: rgba(37, 99, 235, .10);
}

.brand-mark {
  border-radius: 8px;
  border-color: rgba(37, 99, 235, .18);
  background: linear-gradient(145deg, #ffffff, #eef5ff);
  box-shadow: 0 12px 24px rgba(37, 99, 235, .12), inset 0 1px 0 rgba(255,255,255,.95);
}

.brand strong {
  color: #12213b;
}

.brand span {
  color: #2f7c73;
}

.nav {
  gap: 8px;
}

.nav button {
  min-height: 46px;
  border-radius: 8px;
  color: #3f4d63;
  background: transparent;
  font-weight: 800;
}

.nav button .nav-icon,
.nav-icon {
  color: #3465d9;
}

.nav button .nav-icon {
  border-radius: 8px;
  border-color: rgba(37, 99, 235, .12);
  background: #f3f7ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95);
}

.nav button.active {
  color: var(--primary-dark);
  border-color: rgba(37, 99, 235, .14);
  background: linear-gradient(90deg, #e9f2ff, #f5f9ff);
  box-shadow: inset 4px 0 0 var(--primary), 0 10px 22px rgba(37, 99, 235, .10);
}

.nav button.active .nav-icon {
  color: #ffffff;
  border-color: var(--primary);
  background: linear-gradient(180deg, #4f8df8, var(--primary));
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
}

.nav button:hover:not(.active) {
  color: #172033;
  background: #f7faff;
  border-color: rgba(37, 99, 235, .11);
  transform: translateX(2px);
}

.topbar {
  background: rgba(255, 255, 255, .90);
  border-bottom: 1px solid rgba(37, 99, 235, .10);
  box-shadow: 0 10px 28px rgba(31, 46, 80, .055);
}

.topbar h1,
h1 {
  color: #111827;
  font-weight: 950;
}

.topbar p,
.muted {
  color: var(--muted);
}

.content {
  background: transparent;
}

.card,
.dashboard-panel,
.finance-card-v2,
.dashboard-payroll-panel,
.employee-focus-panel,
.notice-card,
.approval-card,
.approval-section,
.marketing-history-card,
.marketing-trend-panel,
.settings-page .card,
.payroll-slip-card,
.admin-ops-card,
.task-work-card,
.cashier-approval-grid section,
.cashier-approval-card,
.leave-request-card,
.ai-insight-card,
.ai-action-card,
.ai-health-card {
  border-radius: 8px !important;
  border: 1px solid rgba(37, 99, 235, .10);
  background: var(--surface-solid);
  box-shadow: 0 12px 28px rgba(31, 46, 80, .075);
}

.card h2,
.card h3,
.dashboard-panel-header h2,
.section-title h2,
.section-title h3 {
  color: #111827;
}

.grid.three > .metric,
.dashboard-stats-grid > .dashboard-stat,
.dashboard-stats-grid-v3 > .dashboard-stat {
  border-left: 5px solid var(--primary);
}

.grid.three > .metric:nth-of-type(2),
.dashboard-stats-grid > .dashboard-stat:nth-of-type(2),
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(2) {
  border-left-color: var(--warn);
}

.grid.three > .metric:nth-of-type(3),
.dashboard-stats-grid > .dashboard-stat:nth-of-type(3),
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(3) {
  border-left-color: var(--purple);
}

.grid.three > .metric:nth-of-type(4),
.dashboard-stats-grid > .dashboard-stat:nth-of-type(4),
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(4) {
  border-left-color: var(--secondary);
}

.grid.three > .metric:nth-of-type(5),
.dashboard-stats-grid > .dashboard-stat:nth-of-type(5),
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(5) {
  border-left-color: var(--danger);
}

.metric,
.dashboard-stat {
  min-height: 118px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,251,255,.94)),
    #fff;
}

.metric::before,
.metric::after,
.dashboard-stat::before,
.dashboard-stat::after {
  content: none !important;
}

.metric span,
.dashboard-stat-copy span,
th {
  color: #5f6d83;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.metric strong,
.dashboard-stat-copy strong {
  color: var(--primary);
  font-weight: 950;
}

.grid.three > .metric:nth-of-type(2) strong,
.dashboard-stats-grid > .dashboard-stat:nth-of-type(2) .dashboard-stat-copy strong,
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(2) .dashboard-stat-copy strong {
  color: var(--warn);
}

.grid.three > .metric:nth-of-type(3) strong,
.dashboard-stats-grid > .dashboard-stat:nth-of-type(3) .dashboard-stat-copy strong,
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(3) .dashboard-stat-copy strong {
  color: var(--purple);
}

.grid.three > .metric:nth-of-type(4) strong,
.dashboard-stats-grid > .dashboard-stat:nth-of-type(4) .dashboard-stat-copy strong,
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(4) .dashboard-stat-copy strong {
  color: var(--secondary);
}

.grid.three > .metric:nth-of-type(5) strong,
.dashboard-stats-grid > .dashboard-stat:nth-of-type(5) .dashboard-stat-copy strong,
.dashboard-stats-grid-v3 > .dashboard-stat:nth-of-type(5) .dashboard-stat-copy strong {
  color: var(--danger);
}

.dashboard-hero,
.dashboard-hero-v2,
.dashboard-hero-v3 {
  border-radius: 8px !important;
  border: 1px solid rgba(37, 99, 235, .10);
  background:
    linear-gradient(135deg, #ffffff 0%, #eef5ff 58%, #f3fff9 100%);
  box-shadow: 0 18px 44px rgba(31, 46, 80, .09);
}

.dashboard-hero-v3::before,
.dashboard-hero-v3::after,
.dashboard-hero-v2::before {
  content: none !important;
}

.dashboard-command-copy h2,
.dashboard-hero h2,
.dashboard-hero-v2 h2 {
  color: #101827;
}

.btn {
  border-radius: 8px;
  border-color: rgba(37, 99, 235, .14);
  color: #1f2a44;
  background: #ffffff;
  box-shadow: 0 7px 16px rgba(31, 46, 80, .06);
}

.btn.primary {
  color: #ffffff;
  border-color: #1d4ed8;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  box-shadow: 0 12px 24px rgba(37, 99, 235, .26);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #2563eb, #1e40af);
}

.btn.danger {
  color: #ffffff;
  border-color: #c82333;
  background: linear-gradient(180deg, #ef4b5c, #c82333);
}

.btn.ghost,
.btn.subtle {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, .12);
}

.chip,
.status-badge,
.platform-pill {
  border-radius: 8px;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, .14);
  background: #eaf2ff;
}

.chip.ok,
.status-badge.ok {
  color: #08734d;
  background: #e9fbf3;
  border-color: rgba(18, 166, 106, .18);
}

.chip.warn,
.status-badge.warn {
  color: #b45309;
  background: #fff4e6;
  border-color: rgba(249, 115, 22, .20);
}

.chip.danger,
.status-badge.danger {
  color: #b42335;
  background: #fff0f2;
  border-color: rgba(220, 53, 69, .20);
}

input,
select,
textarea,
.money-input-wrap {
  border-radius: 8px !important;
}

input,
select,
textarea {
  background: #ffffff;
  border-color: rgba(34, 49, 78, .14);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, .56);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

table {
  border-radius: 8px;
  border: 1px solid rgba(37, 99, 235, .10);
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(31, 46, 80, .055);
}

thead th {
  background: #f1f6ff;
  color: #42516a;
  border-bottom-color: rgba(37, 99, 235, .12);
}

tbody td {
  background: #ffffff;
  border-bottom-color: rgba(34, 49, 78, .075);
}

tbody tr:hover td {
  background: #f7faff;
}

.approval-section-cashier { border-left: 5px solid var(--teal); }
.approval-section-leave { border-left: 5px solid var(--gold); }
.approval-section-overtime { border-left: 5px solid var(--warn); }
.approval-section-marketing { border-left: 5px solid var(--primary); }
.approval-section-income { border-left: 5px solid var(--danger); }

.approval-badge.has-pending {
  background: #fff0f2;
  color: #b42335;
}

.payroll-lock-card {
  border-left: 5px solid var(--primary);
}

.payroll-lock-summary span {
  border-radius: 8px;
  background: #f7faff;
  border-color: rgba(37, 99, 235, .10);
}

.marketing-history-card.is-up,
.marketing-history-card.metric-up {
  border-left: 5px solid var(--secondary);
}

.marketing-history-card.is-down,
.marketing-history-card.metric-down {
  border-left: 5px solid var(--danger);
}

.refresh-fab {
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  box-shadow: 0 14px 28px rgba(37, 99, 235, .28);
}

@media (max-width: 900px) {
  .sidebar {
    background: rgba(255, 255, 255, .96);
  }
  .nav button.active {
    box-shadow: inset 0 3px 0 var(--primary), 0 8px 18px rgba(37, 99, 235, .10);
  }
}

@media (max-width: 980px) {
  .marketing-chart-kpis {
    grid-template-columns: 1fr;
  }
  .marketing-day-header,
  .marketing-day-stats,
  .marketing-compare-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ai-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payroll-lock-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .marketing-day-header,
  .marketing-day-stats,
  .marketing-compare-grid {
    grid-template-columns: 1fr;
  }
  .marketing-history-card-head {
    flex-direction: column;
  }
  .approval-sync-box {
    padding: 22px;
  }
  .approval-sync-box h2 {
    font-size: 19px;
  }
  .ai-health-grid,
  .payroll-slip-identity,
  .payroll-slip-head {
    grid-template-columns: 1fr;
  }
  .ai-health-grid {
    display: grid;
  }
  .payroll-lock-summary {
    grid-template-columns: 1fr;
  }
  .payroll-slip-head,
  .payroll-slip-identity {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Mobile harmonization v19 */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: fixed !important;
    top: auto !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: auto !important;
    max-height: calc(82px + env(safe-area-inset-bottom));
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;
    overflow: hidden;
    border-right: 0;
    border-top: 1px solid rgba(37, 99, 235, .12);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -12px 28px rgba(31, 46, 80, .12);
    -webkit-backdrop-filter: blur(22px) saturate(1.16);
    backdrop-filter: blur(22px) saturate(1.16);
  }

  .brand {
    display: none !important;
  }

  .nav {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 8px;
    width: 100%;
    padding: 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
    min-height: 58px;
    display: grid !important;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 6px 5px;
    border-radius: 8px;
    text-align: center;
    font-size: 10px;
    line-height: 1.12;
    scroll-snap-align: start;
    transform: none !important;
  }

  .nav button .nav-icon,
  .nav-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    padding: 5px;
  }

  .nav-label-full {
    display: none !important;
  }

  .nav-label-compact {
    display: block !important;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-badge {
    top: 3px;
    right: 5px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: auto;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 12px !important;
    border-bottom-color: rgba(37, 99, 235, .10);
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    max-width: 100%;
    font-size: 22px !important;
    line-height: 1.16;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .topbar p {
    display: block !important;
    margin-top: 4px;
    font-size: 12px !important;
    line-height: 1.35;
  }

  .topbar .top-actions {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .topbar .top-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar .chip {
    max-width: 190px;
    min-height: 36px;
    justify-content: center;
    white-space: nowrap;
  }

  .topbar .btn {
    min-height: 36px;
    white-space: nowrap;
  }

  .content {
    width: 100%;
    max-width: none !important;
    padding: 14px 12px calc(104px + env(safe-area-inset-bottom)) !important;
  }

  .content > * + * {
    margin-top: 12px;
  }

  .card,
  .dashboard-hero,
  .dashboard-hero-v2,
  .dashboard-hero-v3,
  .dashboard-panel,
  .finance-card-v2,
  .dashboard-payroll-panel,
  .notice-card,
  .approval-section,
  .marketing-history-card,
  .settings-page .card,
  .ai-insight-card,
  .ai-action-card,
  .ai-health-card {
    width: 100%;
    max-width: 100%;
    padding: 14px !important;
    border-radius: 8px !important;
  }

  .section-title,
  .dashboard-panel-header,
  .task-work-head,
  .marketing-history-card-head,
  .approval-main,
  .cashier-return-item,
  .row {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .section-title .top-actions,
  .dashboard-panel-header .top-actions,
  .approval-actions,
  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-actions .btn,
  .approval-actions .btn,
  .section-title .btn {
    min-height: 40px;
  }

  .grid,
  .grid.two,
  .form.two,
  .form.inline-form,
  .settings-layout,
  .settings-section-grid,
  .dashboard-layout,
  .dashboard-cockpit-grid,
  .dashboard-hero-v2,
  .dashboard-hero-v3,
  .auth-layout,
  .cashier-approval-grid,
  .approval-money-grid,
  .approval-result-strip,
  .approval-group-strip,
  .income-approval-lines,
  .cashier-form,
  .form-section,
  .income-service-line,
  .cashier-service-line,
  .customer-pair,
  .payroll-slip-head,
  .payroll-slip-identity,
  .student-extra-grid,
  .student-learning-mode-group,
  .marketing-compare-grid,
  .finance-grid-v2,
  .employee-cost-grid-v2,
  .finance-summary,
  .admin-ops-grid,
  .dashboard-pulse-grid,
  .ai-center-grid {
    grid-template-columns: 1fr !important;
  }

  .grid.three,
  .dashboard-stats-grid,
  .dashboard-stats-grid-v3,
  .settings-summary-grid,
  .ai-health-grid,
  .payroll-lock-summary,
  .marketing-day-header,
  .marketing-day-stats,
  .marketing-chart-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .metric,
  .dashboard-stat,
  .dashboard-stats-grid-v3 .dashboard-stat,
  .settings-summary-grid span,
  .ai-health-card,
  .payroll-lock-summary span {
    min-height: 104px;
    padding: 12px !important;
  }

  .metric strong,
  .dashboard-stat-copy strong,
  .ai-health-card strong {
    font-size: 23px !important;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .metric span,
  .dashboard-stat-copy span,
  .metric small,
  .dashboard-stat-copy small {
    font-size: 11px !important;
    line-height: 1.25;
  }

  .dashboard-command-copy h2 {
    font-size: 28px !important;
    line-height: 1.08;
  }

  .dashboard-orbit-panel > strong {
    font-size: 26px !important;
    overflow-wrap: anywhere;
  }

  .dashboard-command-actions,
  .result-toolbar,
  .settings-action-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .dashboard-command-actions .btn,
  .result-toolbar .btn,
  .settings-action-row .btn,
  #income-form > .btn.primary,
  .cashier-form > .btn.primary {
    width: 100%;
  }

  label,
  .form-section label,
  .cashier-form label {
    min-width: 0;
  }

  input,
  select,
  textarea,
  .money-input-wrap {
    width: 100%;
    min-width: 0;
  }

  .table-scroll,
  .report-table,
  .company-expense-table-wrap,
  .marketing-trend-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  .table-scroll table,
  .report-table table,
  .company-expense-table,
  .marketing-trend-table {
    min-width: 720px;
  }

  .approval-section > summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px;
  }

  .approval-section > summary p {
    display: none;
  }

  .approval-badge {
    min-width: 30px;
    height: 30px;
  }

  .income-approval-line,
  .approval-money-grid > div,
  .approval-money-grid > label,
  .approval-result-strip,
  .approval-group-strip {
    padding: 12px;
  }

  .refresh-fab {
    right: 12px;
    bottom: calc(94px + env(safe-area-inset-bottom));
    min-height: 42px;
    padding: 9px 12px;
  }
}

@media (max-width: 430px) {
  .content {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .grid.three,
  .dashboard-stats-grid,
  .dashboard-stats-grid-v3,
  .settings-summary-grid,
  .ai-health-grid,
  .payroll-lock-summary,
  .marketing-day-header,
  .marketing-day-stats,
  .marketing-chart-kpis {
    grid-template-columns: 1fr !important;
  }

  .nav button {
    flex-basis: 66px;
    width: 66px;
    min-width: 66px;
  }

  .nav-label-compact {
    max-width: 58px;
  }

  .topbar .chip {
    max-width: 156px;
  }

  .card,
  .dashboard-hero,
  .dashboard-hero-v2,
  .dashboard-hero-v3,
  .dashboard-panel,
  .finance-card-v2,
  .dashboard-payroll-panel,
  .notice-card,
  .approval-section,
  .marketing-history-card,
  .settings-page .card,
  .ai-insight-card,
  .ai-action-card,
  .ai-health-card {
    padding: 12px !important;
  }

  .dashboard-command-copy h2 {
    font-size: 25px !important;
  }
}

/* Workflow simplification v20 */
.workflow-guide-card {
  margin-bottom: 14px;
  border: 1px solid rgba(196, 24, 53, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(253, 248, 249, 0.94));
}

.workflow-step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(150, 53, 72, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.workflow-step b {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #b91c3a;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.workflow-step div {
  min-width: 0;
}

.workflow-step strong {
  display: block;
  color: #1f1720;
  font-size: 14px;
  line-height: 1.25;
}

.workflow-step span {
  display: block;
  margin-top: 4px;
  color: #706771;
  font-size: 12px;
  line-height: 1.4;
}

.workflow-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.workflow-approval {
  border-color: rgba(37, 99, 235, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.94));
}

.workflow-payroll {
  border-color: rgba(16, 122, 94, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 253, 249, 0.94));
}

@media (max-width: 980px) {
  .workflow-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .workflow-guide-card .section-title {
    align-items: flex-start;
  }

  .workflow-step-grid {
    grid-template-columns: 1fr;
  }

  .workflow-step {
    padding: 10px;
  }

  .workflow-status-strip {
    justify-content: flex-start;
  }
}

/* Refresh button polish v21 */
.refresh-fab {
  right: 18px !important;
  bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  min-height: 44px !important;
  padding: 8px 13px 8px 9px !important;
  gap: 8px !important;
  border: 1px solid rgba(185, 28, 58, 0.18) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #8f1730 !important;
  box-shadow: 0 14px 30px rgba(69, 28, 39, 0.16), 0 3px 10px rgba(185, 28, 58, 0.08) !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
  backdrop-filter: blur(18px) saturate(1.1) !important;
}

.refresh-fab span {
  width: 28px !important;
  height: 28px !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #c81f3f, #94172d) !important;
  color: #ffffff !important;
  font-size: 17px !important;
  line-height: 1 !important;
  box-shadow: 0 8px 16px rgba(185, 28, 58, 0.24) !important;
}

.refresh-fab strong {
  color: inherit !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

.refresh-fab:hover {
  transform: translateY(-1px);
  background: #ffffff !important;
  border-color: rgba(185, 28, 58, 0.28) !important;
  box-shadow: 0 18px 36px rgba(69, 28, 39, 0.18), 0 5px 14px rgba(185, 28, 58, 0.10) !important;
}

.refresh-fab:active {
  transform: translateY(0);
}

@media (max-width: 560px) {
  .refresh-fab {
    right: 12px !important;
    bottom: calc(88px + env(safe-area-inset-bottom)) !important;
    min-height: 40px !important;
    padding: 7px 11px 7px 8px !important;
  }

  .refresh-fab span {
    width: 25px !important;
    height: 25px !important;
    font-size: 15px !important;
  }
}
