:root {
  --brand-accent: #c81e28;
  --brand-accent-text: #c81e28;
  --brand: #24499a;
  --brand-hover: #1c3a7e;
  --brand-strong: #1c3a7e;
  --brand-soft: #e8eefb;
  --brand-line: #c5d2ec;
  --topbar-bg: #1c3a7e;
  --gradient-brand: linear-gradient(135deg, #2b55b0 0%, #1a3774 100%);
  --trait: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M2 3 Q50 12 98 3' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --red: #b91c1c;
  --red-soft: #fdf1f1;
  --danger-fill: #c81e28;
  --gold: #e0ad3c;
  --gold-strong: #8a6516;
  --gold-on-dark: #f2c45a;
  --green: #0f7a4b;
  --green-soft: #e8f6ee;
  --success-fill: #0f7a4b;
  --amber: #92400e;
  --amber-soft: #fef5e4;
  --violet: #6b21a8;
  --violet-soft: #f3ecfd;
  --ink: #1b2437;
  --surface: #f1f4f9;
  --card: #ffffff;
  --card-alt: #f7f9fd;
  --border: #e3e8f1;
  --border-strong: #858fa3;
  --divider: #cdd5e4;
  --muted: #566180;
  --light: #5f6a85;
  --input: #ffffff;
  --readout: #f4f7fc;
  --focus: #b45309;
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --shadow-xs: 0 1px 3px rgba(16, 32, 64, 0.06);
  --shadow-sm: 0 2px 8px rgba(16, 32, 64, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 32, 64, 0.12);
  --shadow-lg: 0 18px 48px rgba(16, 32, 64, 0.2);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --text-xs: 0.72rem;
  --text-sm: 0.8rem;
  --text-md: 0.875rem;
  --text-lg: 1.05rem;
  --text-xl: 1.35rem;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --z-sticky: 100;
  --z-topbar: 200;
  --z-popover: 1200;
  --z-toast: 1300;
  --duration: 0.18s;
  --tap-size: 40px;
  --topbar-height: 64px;
  --people-width: 300px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #3460c0;
  --brand-hover: #2a52a8;
  --brand-strong: #a9c1f5;
  --brand-soft: #1b2746;
  --brand-line: #2f3d5f;
  --topbar-bg: #142a5c;
  --gradient-brand: linear-gradient(135deg, #2a4f9e 0%, #172d5f 100%);
  --red: #f87171;
  --red-soft: #3a1a1d;
  --gold: #e3bb5e;
  --gold-strong: #e3bb5e;
  --green: #4ade80;
  --green-soft: #12291d;
  --amber: #fbbf24;
  --amber-soft: #2e2410;
  --violet: #c4a1ff;
  --violet-soft: #2a2140;
  --ink: #e8edf8;
  --surface: #0f1626;
  --card: #161f33;
  --card-alt: #1a2440;
  --border: #273252;
  --border-strong: #6b7799;
  --divider: #36425f;
  --muted: #a7b2cc;
  --light: #93a0bd;
  --input: #0f1626;
  --readout: #1a2440;
  --focus: #fbbf24;
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-strong) 30%, transparent);
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

.data-table,
.people-stats,
.person-net,
.stat-value,
.readout,
.batch-summary,
.rts-table,
.result-grid,
.result-line,
.exemption {
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

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

img {
  max-width: 100%;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  vertical-align: -0.18em;
}

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

.muted { color: var(--muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-brand { color: var(--brand-strong); }
.success-text { color: var(--green); font-weight: 600; }
.link { color: var(--brand-strong); font-weight: 600; }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color var(--duration) ease, border-color var(--duration) ease, color var(--duration) ease, box-shadow var(--duration) ease, opacity var(--duration) ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible,
.icon-button:focus-visible,
.menu-item:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-gold { background: var(--gold); color: #1b2437; }
.btn-gold:hover { background: #e8bc5a; }
.btn-light { background: var(--card); color: var(--ink); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-light:hover { border-color: var(--brand); color: var(--brand-strong); }
.btn-danger { background: var(--danger-fill); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-green { background: var(--success-fill); color: #fff; }
.btn-green:hover { filter: brightness(1.08); }
.btn-red { background: var(--danger-fill); color: #fff; }
.btn-red:hover { filter: brightness(1.08); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.72rem; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--duration) ease, color var(--duration) ease, background-color var(--duration) ease;
}

.icon-button:hover { border-color: var(--brand); color: var(--brand-strong); }
.icon-button-sm { width: 30px; height: 30px; box-shadow: none; }
.icon-button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: none; }
:root[data-theme="dark"] .theme-moon { display: inline; }

.tone-primary { --tone: var(--brand-strong); --tone-fill: var(--brand); --tone-soft: var(--brand-soft); }
.tone-success { --tone: var(--green); --tone-fill: var(--success-fill); --tone-soft: var(--green-soft); }
.tone-warning { --tone: var(--amber); --tone-fill: #b45309; --tone-soft: var(--amber-soft); }
.tone-violet { --tone: var(--violet); --tone-fill: #6d28d9; --tone-soft: var(--violet-soft); }

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-height);
  padding: 0 1.75rem;
  border-bottom: 3px solid var(--brand-accent);
  background: var(--topbar-bg);
  color: #fff;
}

.topbar :focus-visible { outline-color: #fff; }

.topbar-logo { display: flex; align-items: center; flex-shrink: 0; }
.topbar-logo img { display: block; height: 38px; max-width: 120px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px 6px; }

.topbar-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-sm);
  color: #fff;
  transition: background-color var(--duration) ease, border-color var(--duration) ease, color var(--duration) ease;
}

.topbar-launcher .icon { width: 1.2em; height: 1.2em; }
.topbar-launcher:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.6); }
.topbar-launcher.is-active { background: #fff; border-color: #fff; color: var(--topbar-bg); }

.topbar-title { display: flex; flex-direction: column; min-width: 0; font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.topbar-title small { color: rgba(255, 255, 255, 0.8); font-size: 0.72rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar .icon-button,
.topbar .period-picker,
.topbar .switcher-button,
.topbar .user-menu .user-chip {
  border-color: rgba(255, 255, 255, 0.32);
  background: transparent;
  color: #fff;
  box-shadow: none;
}

.topbar .icon-button:hover,
.topbar .period-picker:hover,
.topbar .switcher-button:hover,
.topbar .user-menu .user-chip:hover { border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.1); color: #fff; }
.topbar .switcher-button > .icon:first-child { color: inherit; }

.module-bar {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  padding: 0 1.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.module-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.7rem 1.25rem 0.7rem 0;
  border-right: 1px solid var(--border);
  color: var(--tone);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.module-bar-name .icon { width: 1.2em; height: 1.2em; }
.module-bar-name:hover span { text-decoration: underline; text-underline-offset: 3px; }

.module-bar-tabs {
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.module-bar-tabs::-webkit-scrollbar { display: none; }

.module-bar-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.8rem 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--duration) ease, background-color var(--duration) ease;
}

.module-bar-tab:hover { color: var(--ink); background: var(--card-alt); }
.module-bar-tab.is-active { color: var(--ink); font-weight: 700; }
.module-bar-tab.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 1px;
  height: 7px;
  background: var(--tone-fill);
  -webkit-mask: var(--trait) center / 100% 100% no-repeat;
  mask: var(--trait) center / 100% 100% no-repeat;
}

.module-bar-tab:focus-visible { outline-offset: -2px; }

.module-bar-count {
  min-width: 20px;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.module-bar-shortcuts {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  flex-shrink: 0;
}

.module-bar-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--brand-strong);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.module-bar-shortcut:hover { background: var(--brand-soft); }

.desk { max-width: 1240px; margin: 0 auto; }

.desk-hello { margin: 0.5rem 0 1.5rem; }
.desk-hello h1 {
  position: relative;
  display: inline-block;
  padding-bottom: 0.75rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.desk-hello h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(100%, 220px);
  height: 9px;
  background: var(--brand-accent);
  -webkit-mask: var(--trait) center / 100% 100% no-repeat;
  mask: var(--trait) center / 100% 100% no-repeat;
}

.desk-hello p { margin-top: 0.5rem; color: var(--muted); }

.month-strip {
  display: flex;
  align-items: stretch;
  margin-bottom: 2rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.month-strip-title {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.8rem 1.15rem;
  border-right: 3px solid var(--brand-accent);
  background: var(--topbar-bg);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.month-strip-list { display: flex; flex: 1; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.month-strip-list > li {
  display: flex;
  flex: 1 1 220px;
  margin: -1px 0 0 -1px;
  border-top: 1px dashed var(--divider);
  border-left: 1px dashed var(--divider);
}

.month-strip-line {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.15rem;
  transition: background-color var(--duration) ease;
}

.month-strip-value { color: var(--tone); font-size: 1.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.month-strip-label { color: var(--muted); font-size: 0.84rem; line-height: 1.3; }
.month-strip-line::after {
  content: "→";
  margin-left: auto;
  padding-left: 0.4rem;
  color: var(--tone);
  font-weight: 700;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--duration) ease, transform var(--duration) ease;
}

.month-strip-line:hover { background: var(--card-alt); }
.month-strip-line:hover .month-strip-label { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.month-strip-line:hover::after,
.month-strip-line:focus-visible::after { opacity: 1; transform: none; }
.month-strip-line:focus-visible { outline-offset: -3px; }
.month-strip-empty { flex: 1; align-self: center; padding: 0.8rem 1.15rem; color: var(--muted); }

.launcher {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 2.1rem 1.25rem;
  margin: 0;
  padding: 1rem 0 2rem;
  list-style: none;
}

.launcher > li { display: flex; }

.folder {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.25rem 1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--tone-fill);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.folder::before {
  content: "";
  position: absolute;
  top: -15px;
  left: -1px;
  width: 42%;
  height: 12px;
  border-radius: 6px 6px 0 0;
  background: var(--tone-fill);
}

.folder:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.folder:has(.folder-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }

.folder-head { display: flex; align-items: center; gap: 0.75rem; }
.folder-head h2 { font-size: 1.12rem; font-weight: 700; line-height: 1.25; }

.folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--tone-soft);
  color: var(--tone);
}

.folder-icon .icon { width: 1.35em; height: 1.35em; }
.folder-link { color: var(--ink); }
.folder-link:focus-visible { outline: none; }
.folder-link::after { content: ""; position: absolute; inset: -15px 0 0 0; }
.folder:hover .folder-link { color: var(--tone); }
.folder-description { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

.folder-screens {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: auto 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px dashed var(--divider);
  list-style: none;
}

.folder-screens a { color: var(--brand-strong); font-size: 0.85rem; font-weight: 600; }
.folder-screens a:hover { text-decoration: underline; text-underline-offset: 3px; }
.folder-screens .folder-shortcut { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-weight: 500; }
.folder-shortcut .icon { width: 1em; height: 1em; }

.folder-count {
  margin-left: 0.3rem;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.72rem;
  font-weight: 700;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: var(--z-popover);
  min-width: 260px;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.menu-label {
  padding: 0.6rem 0.7rem 0.25rem;
  color: var(--light);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.menu-item .icon { color: var(--brand-strong); }
.menu-item:hover { background: var(--brand-soft); }

.period-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  flex-shrink: 0;
}

.period-label { display: inline-flex; }

.period-picker input {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.switcher { position: relative; }
.switcher-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 240px;
  height: 38px;
  padding: 0 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.switcher-button:hover { border-color: var(--brand); }
.switcher-button::-webkit-details-marker { display: none; }
.switcher-button > .icon:first-child { color: var(--brand-strong); }
.switcher-button span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { font-size: 0.7rem; opacity: 0.8; }

.switcher-menu {
  width: 320px;
  max-height: 60vh;
  overflow-y: auto;
}

.switcher-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.switcher-item:hover,
.switcher-item.active { background: var(--brand-soft); }
.switcher-item img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--border); }
.switcher-item span { display: flex; flex-direction: column; flex: 1; }
.switcher-item small { color: var(--muted); font-size: 0.7rem; }
.switcher-item .icon { color: var(--green); }
.switcher-empty { padding: 1rem; color: var(--muted); }

.main {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  margin: 0 auto;
  padding: 1.25rem 1.75rem 3rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--people-width);
  gap: 1.1rem;
  align-items: start;
}

.content { min-width: 0; }

.people-column {
  position: sticky;
  top: calc(var(--topbar-height) + 0.75rem);
  max-height: calc(100vh - var(--topbar-height) - 1.5rem);
  display: flex;
  flex-direction: column;
}

.people {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.people-head { gap: 0.5rem; }
.people-head h2 { flex: 1; }
.people-tools { display: flex; align-items: center; gap: 0.35rem; }

.search-box {
  position: relative;
  margin: 0.85rem 1rem 0.6rem;
}

.search-box .icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--light);
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
}

.search-box input:focus { border-color: var(--brand); background: var(--input); box-shadow: var(--ring); }

.bulk-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 1rem 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.75rem;
}

.people[data-multiselect="on"] .bulk-bar { display: flex; }

.bulk-count { width: 100%; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bulk-actions button {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.bulk-actions .bulk-delete { background: var(--danger-fill); border-color: var(--danger-fill); }
.bulk-actions .bulk-delete:disabled { opacity: 0.5; cursor: not-allowed; }

.people-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.people-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0 1rem 0.6rem;
}

.people-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}

.people-stats strong { font-size: 1.05rem; color: var(--brand-strong); }
.people-stats span { font-size: 0.64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.people-items {
  flex: 1;
  margin: 0;
  padding: 0 0.5rem 0.75rem;
  list-style: none;
  overflow-y: auto;
}

.person {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color var(--duration) ease, border-color var(--duration) ease;
}

.person:hover { background: var(--card-alt); border-color: var(--border); }
.person.active { background: var(--brand-soft); border-color: var(--brand-line); }

.person-check {
  display: none;
  padding-left: 0.4rem;
}

.person-check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.people[data-multiselect="on"] .person-check { display: flex; }
.people[data-multiselect="on"] .person-delete { display: none; }
.person:has(.person-check input:checked) { background: var(--brand-soft); border-color: var(--brand); }

.person-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.55rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.person-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.person-meta strong,
.person-meta small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-meta strong { font-size: 0.82rem; }
.person-meta small { font-size: 0.7rem; color: var(--muted); }

.person-net {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.person-net strong { font-size: 0.8rem; color: var(--green); }
.person-net small { font-size: 0.6rem; color: var(--light); text-transform: uppercase; }

.person-delete {
  display: inline-flex;
  padding: 0.35rem;
  margin-right: 0.3rem;
  border-radius: 6px;
  color: var(--light);
  opacity: 0;
  transition: opacity var(--duration) ease, color var(--duration) ease;
}

.person:hover .person-delete,
.person-delete:focus-visible { opacity: 1; }
.person-delete:hover { color: var(--red); background: var(--red-soft); }

.people-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.people-empty .icon { width: 2rem; height: 2rem; color: var(--light); }

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand-strong);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.link-button:hover { text-decoration: underline; }

.people-hidden {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.7rem;
  text-align: center;
}

.saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green);
  animation: fade-out 2.5s ease forwards 1.5s;
}

@keyframes fade-out {
  to { opacity: 0; }
}

.grid {
  display: grid;
  gap: 0.75rem 0.9rem;
}

.grid + .grid { margin-top: 0.75rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.required { color: var(--red); font-style: normal; }

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.toolbar-search,
.input-table input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="file"] { padding: 0.4rem; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar-search:focus,
.input-table input:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.field input[data-amount] { text-align: right; font-variant-numeric: tabular-nums; }
.field-accent input { border-color: var(--brand); }
.field-strong input { font-size: 1.05rem; font-weight: 700; color: var(--brand-strong); }

.has-error input,
.has-error select { border-color: var(--red); }
.field-error { color: var(--red); font-size: 0.72rem; font-weight: 600; }
.field-hint { color: var(--light); font-size: 0.7rem; }

.card {
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.card-head > .icon,
.card-head-title > .icon {
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.card-head h2,
.card-head h3 { margin: 0; font-size: 0.92rem; font-weight: 700; color: var(--ink); }
.card-head-split { justify-content: space-between; }
.card-head-title { display: flex; align-items: center; gap: 0.7rem; }
.card-body { padding: 1rem 1.15rem 1.15rem; }
.card-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--border);
  background: var(--card-alt);
  border-radius: 0 0 var(--radius) var(--radius);
}

.card-foot-split { justify-content: space-between; flex-wrap: wrap; }
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid-1 { grid-template-columns: minmax(0, 1fr); }
.button-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

.dp-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.field,
.period-picker { position: relative; }

.dp-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--ink);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dp-trigger:hover,
.dp-trigger.is-open { border-color: var(--brand); box-shadow: var(--ring); }
.dp-trigger-icon { display: inline-flex; color: var(--brand); }
.dp-trigger-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-trigger-text.is-placeholder { color: var(--light); }
.dp-trigger-chevron { display: inline-flex; color: var(--light); }
.dp-trigger-chevron .icon { width: 0.8em; height: 0.8em; }
.field-accent .dp-trigger { border-color: var(--brand); }

.has-error .dp-trigger { border-color: var(--red); }

.period-picker .dp-trigger {
  width: auto;
  min-width: 140px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 700;
  box-shadow: none;
}

.period-picker .dp-trigger:hover,
.period-picker .dp-trigger.is-open { box-shadow: none; }
.period-picker .dp-trigger-icon { display: none; }
.period-picker .dp-trigger-chevron { color: inherit; opacity: 0.8; }

.dp-popup {
  position: fixed;
  z-index: 1200;
  width: 300px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: dp-in 0.18s ease-out;
}

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

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.dp-nav,
.dp-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.dp-nav { width: 30px; height: 30px; border-radius: 8px; }
.dp-nav:hover { background: var(--brand-soft); color: var(--brand-strong); }
.dp-title { flex: 1; padding: 0.3rem; border-radius: 8px; font-weight: 700; font-size: 0.9rem; }
button.dp-title:hover { background: var(--brand-soft); color: var(--brand-strong); }

.dp-grid { display: grid; gap: 0.3rem; }
.dp-grid-months { grid-template-columns: repeat(3, 1fr); }
.dp-grid-days { grid-template-columns: repeat(7, 1fr); }
.dp-weekday { text-align: center; font-size: 0.68rem; font-weight: 700; color: var(--light); padding: 0.2rem 0; }

.dp-cell {
  padding: 0.5rem 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  cursor: pointer;
}

.dp-day { padding: 0.35rem 0; }
.dp-cell:hover { background: var(--brand-soft); }
.dp-cell.is-other { color: var(--light); }
.dp-cell.is-today { border-color: var(--band); font-weight: 700; }

.dp-cell.is-selected { background: var(--brand); color: #fff; font-weight: 700; }

.dp-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.dp-button {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.dp-button:hover { background: var(--brand-soft); }
.dp-button-clear { color: var(--red); }
.dp-button-confirm { background: var(--brand); border-color: var(--brand); color: #fff; }

.readout {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px dashed var(--divider);
  border-radius: var(--radius-sm);
  background: var(--readout);
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.readout-green { color: var(--green); background: var(--green-soft); border-color: #a7dcc0; border-style: solid; }
.readout-big {
  color: var(--gold-on-dark);
  background: var(--gradient-brand);
  border: none;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.75rem 0.9rem;
}

.exemption {
  margin: 0.9rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.exemption-ok { background: var(--green-soft); border-color: #a7f3d0; }
.exemption-alert { background: var(--amber-soft); border-color: #fcd34d; }

.exemption-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  font-size: 0.82rem;
}

.exemption-row + .exemption-row { border-top: 1px dashed var(--divider); }
.exemption-excess { color: var(--amber); font-weight: 600; }
.exemption-base { color: var(--brand-strong); }

.rts {
  margin-bottom: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rts-title {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rts-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.rts-table th {
  padding: 0.45rem 0.85rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.rts-table td { padding: 0.45rem 0.85rem; border-bottom: 1px solid var(--border); }
.rts-table td:nth-child(n + 2),
.rts-table th:nth-child(n + 2) { text-align: right; font-variant-numeric: tabular-nums; }
.rts-table .is-inactive { color: var(--light); }
.rts-table .is-active td:last-child strong { color: var(--red); }
.rts-table tfoot td { font-weight: 700; background: var(--card-alt); border-bottom: none; }
.rts-table tfoot td:last-child { color: var(--red); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.82rem;
  font-weight: 500;
}

.alert .icon { margin-top: 0.1em; }
.alert-error { background: var(--red-soft); border-color: #fca5a5; color: var(--red); }
.alert-warning { background: var(--amber-soft); border-color: #fcd34d; color: var(--amber); }
.alert-success { background: var(--green-soft); border-color: #86efac; color: var(--green); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  border: 2px dashed var(--divider);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty-icon .icon { width: 2.2rem; height: 2.2rem; }
.empty-state h2 { font-size: 1.2rem; }
.empty-state p { max-width: 460px; color: var(--muted); }

.modal {
  width: min(560px, 96vw);
  max-height: 92vh;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.modal:has(.modal-md) { width: min(760px, 96vw); }
.modal:has(.modal-lg) { width: min(900px, 96vw); }
.modal:has(.modal-sm) { width: min(480px, 96vw); }

.modal::backdrop {
  background: rgba(14, 22, 40, 0.55);
}

.modal[open] { animation: modal-in 0.18s ease-out; }

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

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  background: var(--gradient-brand);
  color: #fff;
}

.modal-head h1,
.modal-head h2,
.modal-head h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1rem; font-weight: 700; }

.modal-head :focus-visible { outline-color: #fff; }

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.28); }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--card-alt);
}

.modal-foot form { margin: 0; }

.standalone {
  display: flex;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.standalone .modal-card { width: min(860px, 100%); max-height: none; }

.tabs .tab-list {
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-alt);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.9rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover { color: var(--brand-strong); }
.tab.active { color: var(--brand-strong); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-tip {
  margin-top: 1rem;
  padding: 0.55rem 0.8rem;
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--muted);
  font-size: 0.76rem;
}

.toasts {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(420px, 92vw);
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--brand);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
.toast-info { border-left-color: var(--brand); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); }

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

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.page-head h1,
.page-head h2 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0; font-size: 1.4rem; font-weight: 800; line-height: 1.25; }
.page-head h1 .icon,
.page-head h2 .icon { color: var(--brand-strong); }
.page-head p { margin-top: 0.3rem; max-width: 72ch; font-size: 0.84rem; color: var(--muted); }

.batch {
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  background: var(--gradient-brand);
  color: #fff;
  cursor: pointer;
  list-style: none;
}

.batch-head::-webkit-details-marker { display: none; }
.batch-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 700; }
.batch-meta { margin-top: 0.15rem; font-size: 0.74rem; opacity: 0.85; }
.batch-chevron { transition: transform 0.2s ease; }
.batch[open] .batch-chevron { transform: rotate(180deg); }

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-alt);
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--brand-strong);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.action:hover { background: var(--brand-soft); border-color: var(--brand); }
.action-express { background: var(--gold); border-color: var(--gold); color: #1b2437; }
.action-express:hover { background: #e8bc5a; }
.action-danger { color: var(--red); }
.action-danger:hover { background: var(--red-soft); border-color: var(--red); }

.batch-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}

.batch-summary div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  border-right: 1px solid var(--border);
}

.batch-summary div:last-child { border-right: none; }
.batch-summary strong { font-size: 1.05rem; font-weight: 800; color: var(--brand-strong); }
.batch-summary span { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.batch-summary .gold strong { color: var(--gold-strong); }

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th {
  padding: 0.6rem 0.55rem;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table td { padding: 0.55rem 0.55rem; border-bottom: 1px solid var(--border); }
.data-table tbody th {
  position: static;
  padding: 0.55rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}

.data-table tbody th small { display: block; color: var(--light); font-size: 0.7rem; font-weight: 500; }
.data-table tbody tr:hover { background: var(--card-alt); }
.data-table abbr { text-decoration: none; cursor: help; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .center { text-align: center; }
.data-table tfoot td,
.data-table tfoot th {
  padding: 0.65rem 0.55rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  border-bottom: none;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  position: static;
}

.data-table tfoot .num { text-align: right; }
.data-table .th-accent { background: var(--brand); color: #fff; }
.data-table .row-link:hover { color: var(--brand-strong); text-decoration: underline; }
.row-error td { background: var(--red-soft); color: var(--red); }
.cell-accent { background: var(--brand-soft); }
.cell-strong { font-weight: 800; color: var(--brand-strong); background: var(--brand-soft); }

.batch-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  background: var(--card-alt);
  color: var(--muted);
  font-size: 0.72rem;
}

.net-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.row-action {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-strong);
}

.row-action:hover { background: var(--brand-soft); }
.row-action-pdf { color: var(--red); }

.input-table input { padding: 0.35rem 0.5rem; font-size: 0.8rem; text-align: right; min-width: 90px; }
.input-table .cell-accent input { border-color: var(--brand); font-weight: 700; color: var(--brand-strong); }
.input-table .cell-days input { min-width: 64px; text-align: center; }

.selection-summary {
  padding: 0.65rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--card-alt);
  font-size: 0.85rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tag-red { background: #fee2e2; color: #991b1b; }
.tag-green { background: #d1fae5; color: #047857; }
.tag-amber { background: #fef3c7; color: #b45309; }

.steps {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.steps li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.7rem;
}

.steps .current { border-color: var(--brand); color: var(--brand-strong); }
.steps .current span { background: var(--brand); color: #fff; }
.steps .done { color: var(--green); }
.steps .done span { background: var(--green); color: #fff; }

.import-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border: 2px dashed #b45309;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  font-size: 0.84rem;
}

:root[data-theme="dark"] .import-band { background: var(--amber-soft); color: var(--amber); }
.import-title { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; margin-bottom: 0.2rem; }
.import-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-upload { margin: 0; }

.divider-text {
  margin: 1rem 0;
  text-align: center;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--light);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.toolbar-search { flex: 1; min-width: 200px; width: auto; }
.toolbar-count { font-size: 0.82rem; color: var(--brand-strong); font-weight: 600; }

.check-list {
  max-height: 420px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.check-list li + li { border-top: 1px solid var(--border); }
.check-list label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}

.check-list label:hover { background: var(--card-alt); }
.check-list input { width: 18px; height: 18px; accent-color: var(--brand); }
.check-list-main { display: flex; flex-direction: column; flex: 1; }
.check-list-main strong { color: var(--brand-strong); }
.check-list-main small { color: var(--muted); font-size: 0.74rem; }
.check-list-side { font-size: 0.8rem; color: var(--muted); }
.check-list-empty { padding: 1.5rem; text-align: center; color: var(--muted); }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--kpi, var(--brand));
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.kpi span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted); }
.kpi strong { font-size: 1.3rem; color: var(--kpi, var(--brand)); font-variant-numeric: tabular-nums; }
.kpi-green { --kpi: #047857; }
.kpi-amber { --kpi: #b45309; }
.kpi-red { --kpi: #dc2626; }
.kpi-blue { --kpi: #0369a1; }
.kpi-violet { --kpi: #6b21a8; }

.callout {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  background: #f0f9ff;
}

:root[data-theme="dark"] .callout { background: #0c2233; border-color: #164e6a; }
.callout-title { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; font-weight: 600; color: #0c4a6e; }
:root[data-theme="dark"] .callout-title { color: #7dd3fc; }

.advanced { margin: 0.75rem 0 1rem; }
.advanced summary { cursor: pointer; color: var(--brand-strong); font-weight: 600; font-size: 0.84rem; margin-bottom: 0.6rem; }

.result-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  color: #fff;
  text-align: center;
}

.result-hero span { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.result-hero strong { font-size: 2rem; font-weight: 800; color: var(--gold-on-dark); }
.result-hero small { opacity: 0.75; }

.result-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-alt);
}

.result-panel-soft { background: var(--brand-soft); border-color: var(--brand-line); }

.result-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--divider);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-strong);
}

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

.result-grid div { display: flex; justify-content: space-between; font-size: 0.84rem; }
.result-grid dt { color: var(--muted); }
.result-grid dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.result-line {
  display: flex;
  justify-content: space-between;
  padding-top: 0.35rem;
  font-size: 0.84rem;
}

.result-line-strong {
  margin-top: 0.4rem;
  padding-top: 0.55rem;
  border-top: 1.5px solid var(--brand);
  color: var(--brand-strong);
  font-weight: 700;
}

.report-list {
  max-height: 260px;
  margin: 0 0 1rem;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-size: 0.8rem;
}

.report-list li { display: flex; gap: 0.4rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--border); }
.report-ok { color: var(--green); }
.report-error { color: var(--red); }

.confirm-target {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--red);
  border-radius: 4px;
  background: var(--red-soft);
  font-weight: 600;
}

.confirm-details {
  max-height: 200px;
  margin: 0 0 0.9rem;
  padding-left: 1.2rem;
  overflow-y: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-tabs .tab-list {
  margin-bottom: 1rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
}

.section-title {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-strong);
}

.section-title:not(:first-child) { margin-top: 1.25rem; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.list-head .section-title { margin: 0; }

.logo-upload {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-top: 0.75rem;
}

.logo-upload .field { flex: 1; }

.logo-preview {
  width: 96px;
  height: 64px;
  object-fit: contain;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 4px;
}

.company-card {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.company-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
}

.company-identity { display: flex; align-items: center; gap: 0.85rem; }
.company-identity img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.company-identity strong { display: block; color: var(--brand-strong); }
.company-identity small { color: var(--muted); font-size: 0.74rem; }

.company-edit,
.company-users { border-top: 1px solid var(--border); padding: 0.75rem 1.25rem; }
.company-edit summary { cursor: pointer; color: var(--brand-strong); font-weight: 600; font-size: 0.84rem; }
.company-edit[open] summary { margin-bottom: 0.85rem; }

.user-row { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.user-row summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.user-row summary::-webkit-details-marker { display: none; }
.user-row form { padding: 0 0.75rem 0.75rem; }

.payslip-preview { background: #e9edf5; }
.payslip-preview .payslip {
  max-width: 210mm;
  margin: 0 auto;
  padding: 8mm;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
}
.payslip-preview .payslip table { border-collapse: collapse; }

.login-page { background: var(--surface); }

.login {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.4rem;
  padding: 3.5rem clamp(2rem, 6vw, 5.5rem);
  border-right: 4px solid var(--brand-accent);
  background: var(--topbar-bg);
  color: #fff;
}

.login-brand img { align-self: flex-start; height: 72px; width: auto; border-radius: 8px; background: #fff; padding: 6px 10px; }
.login-domain { color: rgba(255, 255, 255, 0.8); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.login-pitch { max-width: 560px; font-size: clamp(1.75rem, 3.2vw, 2.6rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.login-pitch em { position: relative; font-style: normal; white-space: nowrap; }
.login-pitch em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 9px;
  background: var(--brand-accent);
  -webkit-mask: var(--trait) center / 100% 100% no-repeat;
  mask: var(--trait) center / 100% 100% no-repeat;
}

.login-motto { color: rgba(255, 255, 255, 0.88); font-size: 0.95rem; font-style: italic; }

.login-side { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }

.login-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(440px, 100%);
  padding: 2.25rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-md);
}

.login-kicker { color: var(--brand-accent-text); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-align: center; text-transform: uppercase; }
:root[data-theme="dark"] .login-kicker { color: var(--red); }
.login-card h1 { margin-top: -0.6rem; color: var(--brand-strong); font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; text-align: center; }
.login-subtitle { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.9rem; text-align: center; }
.login-card .btn-lg { min-height: 46px; }

.login-foot {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--light);
  font-size: 0.78rem;
  text-align: center;
}

.login-foot strong { color: var(--muted); font-size: 0.84rem; letter-spacing: 0.04em; }

.password-box { position: relative; }
.password-box input { padding-right: 2.75rem !important; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  display: inline-flex;
  padding: 0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.login-theme { position: absolute; top: 1rem; right: 1rem; }

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.main:focus,
.standalone:focus,
.error-shell:focus { outline: none; }

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--brand-strong);
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.skip-link:focus { top: var(--space-2); }

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-toast);
  width: 0;
  height: 3px;
  background: var(--band);
  opacity: 0;
  transition: width 0.6s ease, opacity 0.3s ease;
}

body.is-loading .loading-bar { width: 85%; opacity: 1; }
[aria-busy="true"] { cursor: progress; }
.sheet[aria-busy="true"] { opacity: 0.85; }

.caret { width: 0.8em; height: 0.8em; opacity: 0.85; }

.user-menu { position: relative; }

.user-menu .user-chip {
  height: 40px;
  cursor: pointer;
  list-style: none;
  padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.user-menu .user-chip::-webkit-details-marker { display: none; }

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: var(--topbar-bg);
  font-weight: 800;
  font-size: 0.8rem;
}

.user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; text-align: left; }
.user-info small { color: rgba(255, 255, 255, 0.8); font-size: 0.68rem; font-weight: 500; }

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-panel {
  right: 0;
  width: 260px;
  min-width: 0;
}

.user-menu-head {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-3) var(--space-3);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}

.user-menu-head small { color: var(--light); font-size: var(--text-xs); }
.user-menu-panel form { margin: 0; }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-size);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: var(--text-md);
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover { background: var(--brand-soft); }
.user-menu-danger { color: var(--red); }
.user-menu-danger:hover { background: var(--red-soft); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 1.1rem 0.95rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--accent, var(--brand));
}

.stat-blue { --accent: var(--brand); }
.stat-red { --accent: var(--danger-fill); }
.stat-amber { --accent: #b45309; }
.stat-green { --accent: var(--success-fill); }

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.stat-value small { font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.stat-note { font-size: var(--text-xs); color: var(--light); }
.stat-highlight { background: var(--gradient-brand); border-color: transparent; }
.stat-highlight::before { display: none; }
.stat-highlight .stat-label,
.stat-highlight .stat-note,
.stat-highlight .stat-value small { color: #cfdcf8; }
.stat-highlight .stat-value { color: var(--gold-on-dark); }

.journey {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 0;
  padding: 1rem 1.15rem 1.15rem;
  list-style: none;
}

.journey-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-alt);
}

.journey-step strong { display: block; font-size: 0.88rem; }
.journey-step p { margin: 0.2rem 0 0.65rem; color: var(--muted); font-size: var(--text-sm); }

.journey-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.journey-step.is-done .journey-index { background: var(--success-fill); }

.section-nav {
  position: sticky;
  top: var(--topbar-height);
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin: 0 0 1.1rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.section-nav a {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  color: var(--brand-strong);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.section-nav a:hover { background: var(--brand-soft); }

.autosave-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  padding: 0 var(--space-2);
  color: var(--light);
  font-size: var(--text-xs);
}

.card[id] { scroll-margin-top: calc(var(--topbar-height) + 60px); }

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.action-group-label {
  width: 100%;
  margin-bottom: 0.15rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--light);
}

.action-end { margin-left: auto; align-self: center; }
.table-wrap:focus-visible { outline-offset: -3px; }

.error-page { background: radial-gradient(circle at top, var(--brand) 0%, var(--topbar-bg) 60%); }

.error-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-6);
}

.error-card {
  width: min(520px, 100%);
  padding: var(--space-8);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.error-logo { max-height: 60px; margin-bottom: var(--space-4); }
.error-code { color: var(--red); font-weight: 700; font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.1em; }
.error-card h1 { margin: var(--space-2) 0 var(--space-3); font-size: 1.5rem; font-weight: 800; color: var(--brand-strong); }
.error-text { color: var(--muted); margin-bottom: var(--space-6); }
.error-actions { display: flex; justify-content: center; gap: var(--space-2); flex-wrap: wrap; }

@media (max-width: 1400px) {
  :root { --people-width: 272px; }

  .switcher-button span { display: none; }
  .switcher-button { padding: 0 0.6rem; }
  .module-bar-shortcut span { display: none; }
}

@media (max-width: 1280px) {
  .data-table .col-optional { display: none; }
  .grid-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .people-column { position: static; max-height: none; }
  .people-items { max-height: 360px; }
  .cards-2 { grid-template-columns: minmax(0, 1fr); }
  .person-delete { opacity: 1; }
}

@media (max-width: 960px) {
  .grid-4,
  .grid-5,
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batch-summary { grid-template-columns: repeat(2, 1fr); }
  .batch-summary div:nth-child(2) { border-right: none; }
  .batch-summary div:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .journey { grid-template-columns: minmax(0, 1fr); }
  .user-info { display: none; }
  .topbar-title { display: none; }
  .action-end { margin-left: 0; }
  .autosave-note { width: 100%; margin-left: 0; }
  .module-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 1rem; padding: 0 1rem; }
  .module-bar-shortcuts { grid-column: 1 / -1; margin-left: 0; padding: 0.35rem 0; border-top: 1px solid var(--border); overflow-x: auto; }
  .module-bar-shortcut span { display: inline; }
  .month-strip { flex-direction: column; }
  .month-strip-title { border-right: none; border-bottom: 3px solid var(--brand-accent); }
  .login { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-side { align-items: flex-start; }
  .login-brand { gap: 0.9rem; padding: 2rem 1.5rem; border-right: none; border-bottom: 4px solid var(--brand-accent); }
  .login-brand img { height: 56px; }
  .login-pitch { font-size: 1.6rem; }
}

@media (max-width: 640px) {
  :root { --topbar-height: 56px; }

  .topbar { gap: var(--space-2); padding: 0 var(--space-3); }
  .topbar-logo img { height: 30px; max-width: 80px; }
  .topbar-launcher { width: 34px; height: 34px; }
  .topbar-right { gap: var(--space-1); }
  .topbar-right .icon-button { width: 34px; height: 34px; }
  .period-picker { height: 34px; padding: 0 0.6rem; }
  .period-picker .dp-trigger { min-width: 0; font-size: 0.78rem; }
  .period-picker .dp-trigger-chevron,
  .user-chip .caret { display: none; }
  .user-menu .user-chip { height: 34px; padding: 0.2rem; }
  .user-avatar { width: 26px; height: 26px; }
  .switcher { display: none; }
  .module-bar { padding: 0 0.75rem; }
  .module-bar-name { padding-right: 0.75rem; }
  .module-bar-name span { display: none; }
  .main { padding: var(--space-4) var(--space-3) var(--space-8); }
  .launcher { grid-template-columns: minmax(0, 1fr); }
  .desk-hello h1 { font-size: 1.4rem; }
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .grid-6 { grid-template-columns: minmax(0, 1fr); }
  .result-grid { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .page-head .button-row { width: 100%; }
  .page-head .btn,
  .page-head form,
  .page-head form .btn { width: 100%; }
  .page-head .button-row .btn { flex: 1; }
  .col-compact { display: none; }
  .section-nav { flex-wrap: nowrap; overflow-x: auto; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; }
  .modal-card { max-height: 92dvh; border-radius: 14px 14px 0 0; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
  .toasts { right: var(--space-2); left: var(--space-2); bottom: var(--space-2); max-width: none; }
  .steps { flex-wrap: wrap; }
  .error-card { padding: var(--space-6) var(--space-4); }
  .btn { min-height: var(--tap-size); }
  .login-card { padding: 1.75rem 1.25rem; }
  .login-pitch { font-size: 1.35rem; }
  .login-motto { display: none; }
}

.alert-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }

.stepper { margin: 0 0 var(--space-5); }
.stepper ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
}

a.stepper-link:hover { border-color: var(--brand); background: var(--brand-soft); }
.stepper-text { display: flex; flex-direction: column; line-height: 1.25; }
.stepper-text strong { color: var(--ink); font-size: var(--text-md); }
.stepper-text small { font-size: var(--text-xs); color: var(--light); }

.stepper-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  font-weight: 800;
  color: var(--muted);
}

.stepper-item.is-current .stepper-link { border-color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.stepper-item.is-current .stepper-index { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper-item.is-done .stepper-index { background: var(--success-fill); border-color: var(--success-fill); color: #fff; }

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--brand-line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}

.resume-banner form { margin: 0; }

.choice-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.choice-card { margin: 0; }
.choice-intro { margin-bottom: var(--space-3); color: var(--muted); font-size: var(--text-md); }
.check-list-side { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.check-list-side small { color: var(--light); font-size: var(--text-xs); }
.check-list-side strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.sticky-foot {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  align-items: center;
  box-shadow: 0 -6px 16px rgba(15, 28, 48, 0.08);
}

.howto { margin: 0 0 var(--space-3); padding-left: 1.2rem; display: grid; gap: var(--space-2); font-size: var(--text-md); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-6) var(--space-4);
  border: 2px dashed var(--brand-line);
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-strong);
  text-align: center;
  cursor: pointer;
}

.dropzone .icon { width: 1.8rem; height: 1.8rem; }
.dropzone small { color: var(--muted); }
.dropzone:hover { border-color: var(--brand); }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.empty-inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px dashed var(--divider);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.fill-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--card-alt);
}

.fill-title { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 600; font-size: var(--text-sm); color: var(--brand-strong); }
.fill-bar select,
.fill-bar input {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input);
  font-size: var(--text-sm);
}

.fill-bar input { width: 140px; text-align: right; }
.fill-progress { margin-left: auto; font-size: var(--text-sm); color: var(--muted); }

.data-table .group-row th { text-align: center; }
.data-table thead tr + tr th { top: 34px; }
.data-table .employee-cell { font-weight: 400; text-align: left; white-space: nowrap; background: inherit; position: static; text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; padding: 0.5rem; }
.row-invalid td,
.row-invalid .employee-cell { background: var(--red-soft); }
.data-table .employee-cell small { display: block; color: var(--light); font-size: 0.7rem; }
.row-invalid input[aria-invalid="true"] { border-color: var(--red); }

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

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.filter-label { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 32px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.filter-chip .count { padding: 0 0.4rem; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-strong); font-size: var(--text-xs); }
.filter-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-chip[aria-pressed="true"] .count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.trend { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 700; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.filter-empty td { padding: var(--space-6); text-align: center; color: var(--muted); }
.selection-summary { margin: 0; padding: 0; border: none; background: none; }

.tab-count {
  padding: 0 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: var(--text-xs);
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--space-4);
}

.company-grid .company-card { display: flex; flex-direction: column; margin: 0; }
.company-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-line); }
.company-card h2 { margin: 0 0 0.2rem; font-size: 1rem; color: var(--brand-strong); }
.company-card-head form { margin: 0; }

.company-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0 var(--space-5) var(--space-3);
  font-size: var(--text-sm);
}

.company-meta dt { color: var(--light); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.company-colors { grid-column: 1 / -1; }
.swatch { display: inline-block; width: 18px; height: 18px; margin-right: 0.25rem; border: 1px solid var(--border); border-radius: 50%; vertical-align: -4px; }

.company-meta dd { margin: 0; overflow-wrap: anywhere; }

.company-counters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0 var(--space-5) var(--space-4);
  list-style: none;
}

.company-counters li { padding: 0.25rem 0.7rem; border-radius: var(--radius-pill); background: var(--card-alt); border: 1px solid var(--border); font-size: var(--text-sm); color: var(--muted); }
.company-counters strong { color: var(--ink); }

.company-users-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.company-users-head h3 { margin: 0; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-strong); }
.user-row-identity { display: flex; align-items: center; gap: var(--space-2); }
.user-row-identity > span:last-child { display: flex; flex-direction: column; }
.user-row-identity small { font-weight: 400; color: var(--light); font-size: var(--text-xs); }
.company-edit { margin-top: auto; }
.form-actions-split { justify-content: space-between; }
.empty-note { font-size: var(--text-sm); font-style: italic; }

@media (max-width: 1280px) {
  .stat-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid-5 .stat:nth-child(4) { grid-column: span 2; }
}

@media (max-width: 960px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .company-grid { grid-template-columns: minmax(0, 1fr); }
  .fill-progress { width: 100%; margin-left: 0; }
}

@media (max-width: 640px) {
  .stepper ol { grid-template-columns: minmax(0, 1fr); }
  .stepper-text small { display: none; }
  .company-meta { grid-template-columns: minmax(0, 1fr); }
  .sticky-foot { flex-direction: column; align-items: stretch; }
  .sticky-foot .button-row { width: 100%; }
  .sticky-foot .btn { width: 100%; }
  .fill-bar input { flex: 1; width: auto; }
}

@media (max-width: 640px) {
  .stepper ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper-link { flex-direction: column; gap: var(--space-1); padding: var(--space-2); text-align: center; }
  .stepper-text strong { font-size: var(--text-xs); }
  .stat-grid,
  .stat-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid-5 .stat:nth-child(4) { grid-column: auto; }
  .stat-grid-5 .stat:last-child { grid-column: span 2; }
  .stat { padding: var(--space-3); }
  .stat-value { font-size: 1.05rem; }
  .stat-note { display: none; }
  .page-head .button-row { width: 100%; flex-direction: column; }
}

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

@media print {
  .topbar,
  .module-bar,
  .section-nav,
  .toasts,
  .loading-bar,
  .skip-link { display: none !important; }
  .main { padding: 0; }
}
