/* Turno — folha de estilo única (sem build step) */
:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #047857;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 6%), 0 1px 3px rgb(15 23 42 / 10%);
  --shadow-md: 0 10px 25px -5px rgb(15 23 42 / 18%), 0 8px 10px -6px rgb(15 23 42 / 10%);
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #94a3b8;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---------- boot / spinner ---------- */
.boot-screen { min-height: 100vh; display: grid; place-items: center; }
.boot-spinner, .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); border-color: #b6c2d4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: #eef1f6; border-color: transparent; color: var(--text); }
.btn--danger { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.btn--danger:hover { background: #fee2e2; border-color: #fca5a5; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn--icon { width: 36px; height: 36px; padding: 0; }
.btn--block { width: 100%; }
.btn__icon { width: 16px; height: 16px; flex: none; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 600; color: #334155; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { min-height: 76px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(79 70 229 / 15%);
}
.input::placeholder { color: #9aa6b8; }
.input[type='color'] { padding: 4px; min-height: 38px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-error {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b; font-size: 12.5px;
}
.inline-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  background:
    radial-gradient(800px 520px at 12% 5%, rgb(99 102 241 / 22%), transparent 62%),
    radial-gradient(720px 520px at 92% 96%, rgb(79 70 229 / 18%), transparent 58%),
    #f1f4f9;
}
.login-card {
  width: 100%; max-width: 420px; padding: 36px;
  background: var(--surface); border: 1px solid rgb(226 232 240 / 85%);
  border-radius: 18px; box-shadow: 0 22px 60px rgb(15 23 42 / 10%);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, #6366f1, #4338ca); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%);
}
.login-brand strong { display: block; font-size: 16px; letter-spacing: -0.2px; }
.login-brand span { font-size: 12px; color: var(--muted); }
.login-title { font-size: 23px; letter-spacing: -0.45px; }
.login-sub { font-size: 13px; color: var(--muted); margin: 4px 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; }
@media (max-width: 480px) {
  .login-screen { padding: 18px 14px; }
  .login-card { padding: 28px 22px; }
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-text);
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand strong { display: block; color: #f8fafc; font-size: 15px; letter-spacing: -0.2px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand span { font-size: 11px; color: var(--sidebar-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group { margin: 14px 10px 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: #64748b; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--sidebar-text);
  font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none;
}
.nav-item:hover { background: rgb(255 255 255 / 7%); color: #f1f5f9; }
.nav-item.is-active { background: #312e81; color: #fff; box-shadow: inset 0 0 0 1px #4338ca; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.sidebar-foot { border-top: 1px solid rgb(255 255 255 / 9%); padding-top: 12px; margin-top: 10px; }
.user-box { display: flex; align-items: center; gap: 9px; padding: 4px 6px 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: #3730a3; color: #e0e7ff;
}
.user-box .who { min-width: 0; }
.user-box strong { display: block; font-size: 12.5px; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box span { font-size: 11px; color: var(--sidebar-muted); }
.sidebar-foot .btn--ghost { color: var(--sidebar-muted); width: 100%; justify-content: flex-start; }
.sidebar-foot .btn--ghost:hover { background: rgb(255 255 255 / 7%); color: #f1f5f9; }

.main { min-width: 0; padding: 22px 26px 40px; }
.view { max-width: 1500px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.shell--user { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.user-header {
  min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(18px, 4vw, 64px); background: var(--surface); border-bottom: 1px solid var(--border);
}
.user-header__brand, .user-header__actions { display: flex; align-items: center; gap: 12px; }
.user-header__brand > div { display: flex; flex-direction: column; }
.user-header__brand strong { font-size: 15px; }
.user-header__brand span:not(.brand-mark) { color: var(--muted); font-size: 11px; }
.user-header__name { color: var(--muted); font-size: 13px; }
.shell--user .main { width: 100%; padding: 24px clamp(18px, 4vw, 64px) 40px; }
.shell--user .view { width: 100%; max-width: 1800px; }
.shell--user .month-grid { grid-auto-rows: minmax(108px, auto); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; letter-spacing: -0.35px; }
.page-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__head h2 { font-size: 14px; }
.card__head p { font-size: 12px; color: var(--muted); }
.card__body { padding: 16px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 16px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-main strong { font-size: 13px; font-weight: 600; display: block; }
.cell-main small { color: var(--muted); font-size: 11.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--dot, var(--border-strong)); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.badge--ok { background: var(--success-soft); border-color: #a7f3d0; color: var(--success); }
.badge--off { background: #f1f5f9; border-color: var(--border); color: #64748b; }
.badge--admin { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary-dark); }
.badge--warn { background: #fffbeb; border-color: #fde68a; color: var(--warning); }

/* ---------- calendar toolbar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.25px; min-width: 190px; }
.cal-title small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.segmented { display: inline-flex; background: #e8edf5; border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- filters ---------- */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-wrap { position: relative; }
.filter-btn { display: inline-flex; align-items: center; gap: 7px; }
.filter-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.popover {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  width: 298px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.popover--right { left: auto; right: 0; }
.popover__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.popover__head strong { font-size: 12px; }
.popover__links { display: flex; gap: 4px; }
.popover__links button {
  border: 0; background: transparent; color: var(--primary); font-size: 11.5px;
  font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.popover__links button:hover { background: var(--primary-soft); }
.checklist { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.check-row {
  display: flex; align-items: center; gap: 9px; padding: 6px 7px;
  border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.check-row:hover { background: var(--surface-2); }
.check-row input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; flex: none; }
.check-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row small { color: var(--muted); font-size: 11px; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 4px 4px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #eef2ff; border: 1px solid #c7d2fe; color: var(--primary-dark);
}
.chip-filter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-filter button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.chip-filter button:hover { background: #c7d2fe; }
.active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- calendar grid ---------- */
.calendar { overflow: hidden; }
.cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cal-dow div {
  padding: 9px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.cal-dow div.is-weekend { color: #94a3b8; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(118px, auto); }
.month-cell {
  border-right: 1px solid #eef2f7; border-bottom: 1px solid #eef2f7;
  padding: 5px 5px 7px; display: flex; flex-direction: column; gap: 4px;
  min-width: 0; position: relative; background: var(--surface);
}
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell.is-outside { background: #fbfcfe; }
.month-cell.is-outside .day-num { color: #b6c2d4; }
.month-cell.is-today { background: #f5f6ff; }
.month-cell.is-drop { background: #eef2ff; box-shadow: inset 0 0 0 2px var(--primary); }
.cell-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px; }
.day-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #334155; font-variant-numeric: tabular-nums;
}
.is-today .day-num { background: var(--primary); color: #fff; }
.cell-total { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 2px; }
.cell-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cell-add {
  border: 1px dashed transparent; background: transparent; color: transparent;
  border-radius: 6px; height: 18px; font-size: 12px; cursor: pointer;
}
.month-cell:hover .cell-add { border-color: var(--border-strong); color: var(--muted); }
.cell-add:hover { background: #fff; color: var(--primary); border-color: var(--primary); }

/* shift chips */
.chip {
  --chip: #4f46e5;
  display: block; width: 100%; text-align: left;
  border: 0; border-left: 3px solid var(--chip); border-radius: 6px;
  background: #eef2ff;
  background: color-mix(in srgb, var(--chip) 13%, #fff);
  color: #1e293b; padding: 2px 5px 3px; cursor: grab;
  font-size: 11px; line-height: 1.25; min-width: 0;
  transition: filter 0.12s, box-shadow 0.12s;
}
.chip:hover { filter: brightness(0.96); box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.chip.is-dragging { opacity: 0.45; cursor: grabbing; }
.chip-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.chip--night { background-image: linear-gradient(90deg, rgb(255 255 255 / 0), rgb(15 23 42 / 5%)); }
.chip-more {
  border: 0; background: transparent; color: var(--primary); font-size: 11px;
  font-weight: 600; text-align: left; padding: 1px 4px; cursor: pointer; border-radius: 4px;
}
.chip-more:hover { background: var(--primary-soft); }
.group-label {
  display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700;
  color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.03em;
}
.group-label .dot { width: 7px; height: 7px; }

/* week / day */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 420px; }
.week-col { border-right: 1px solid #eef2f7; display: flex; flex-direction: column; min-width: 0; }
.week-col:last-child { border-right: 0; }
.week-col-head { padding: 9px 9px 7px; border-bottom: 1px solid #eef2f7; background: var(--surface-2); }
.week-col-head .dow { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.week-col-head .dnum { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-col.is-today .week-col-head { background: #eef2ff; }
.week-col.is-today .dnum { color: var(--primary); }
.week-col.is-drop { background: #f5f7ff; box-shadow: inset 0 0 0 2px var(--primary); }
.week-col-body { padding: 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.week-col-body .chip { padding: 4px 6px; font-size: 11.5px; }
.week-empty { color: #cbd5e1; font-size: 11px; text-align: center; padding: 12px 0; }

.day-view { display: flex; flex-direction: column; }
.day-row {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
  padding: 11px 16px; border-bottom: 1px solid #eef2f7; align-items: start;
}
.day-row:last-child { border-bottom: 0; }
.day-row__time { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-row__time small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.day-row__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.empty-state p { font-size: 12.5px; }
.empty-state .btn { margin-top: 14px; }

/* ---------- summary / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { padding: 13px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat__value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: 11.5px; color: var(--muted); }
.hours-list { display: flex; flex-direction: column; }
.hours-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 12.5px; }
.hours-row:last-child { border-bottom: 0; }
.hours-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hours-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.hours-row small { color: var(--muted); font-size: 11px; }
.bar { height: 5px; border-radius: 3px; background: #eef2f7; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--bar, var(--primary)); border-radius: 3px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgb(15 23 42 / 55%);
  display: grid; place-items: center; padding: 20px;
  animation: fade 0.14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-md);
  animation: pop 0.16s ease-out;
}
.modal--wide { max-width: 720px; }
@keyframes pop { from { transform: translateY(8px) scale(0.985); opacity: 0; } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal__head h3 { font-size: 16px; letter-spacing: -0.2px; }
.modal__head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal__close {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 18px;
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 16px 20px; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 16px 16px; flex-wrap: wrap;
}
.modal__foot .grow { flex: 1; }

.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { width: 120px; flex: none; color: var(--muted); font-size: 12px; }
.detail-row dd { margin: 0; font-weight: 500; }
.series-box { background: var(--primary-soft); border: 1px solid #c7d2fe; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: #3730a3; }

/* ---------- toasts ---------- */
.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 10px; background: #0f172a; color: #f8fafc;
  box-shadow: var(--shadow-md); font-size: 12.5px; animation: toast-in 0.18s ease-out;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.toast--error { background: #7f1d1d; }
.toast--success { background: #064e3b; }
.toast strong { display: block; font-size: 12.5px; }
.toast span { color: #cbd5e1; font-size: 12px; }

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); border: 0; margin: 4px 0; }
.legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend .dot { width: 8px; height: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; user-select: none; }
.toggle input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    padding: 10px 12px; gap: 10px; overflow-x: auto;
  }
  .brand { padding: 0 8px 0 0; }
  .brand div, .brand span { display: none; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; }
  .nav-group { display: none; }
  .nav-item span { display: none; }
  .nav-item { padding: 8px; }
  .nav-item.is-active { background: #312e81; }
  .sidebar-foot { border-top: 0; padding: 0; margin: 0; display: flex; align-items: center; gap: 6px; }
  .user-box { display: none; }
  .sidebar-foot .btn--ghost { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .sidebar-foot .btn--ghost span { display: none; }
  .main { padding: 16px 14px 32px; }
}
@media (max-width: 720px) {
  .user-header { min-height: 58px; padding: 8px 14px; }
  .user-header__actions { gap: 6px; }
  .user-header__name { display: none; }
  .user-header__actions .btn { height: 34px; padding: 0 9px; font-size: 12px; }
  .shell--user .main { padding: 16px 10px 24px; }
  .shell--user .month-grid { grid-auto-rows: minmax(82px, auto); }
  .form-grid, .inline-2 { grid-template-columns: 1fr; }
  .active-filters { padding: 0 10px 10px; }
  .table-tools .input, .table-tools .select { width: 100%; min-width: 0; }
  .month-grid { grid-auto-rows: minmax(86px, auto); }
  .cal-title { min-width: 0; font-size: 15px; }
  .month-cell { padding: 4px 3px; }
  .chip { font-size: 10px; }
  .chip-name { display: none; }
  .cell-total { display: none; }
  .week-grid { grid-template-columns: repeat(7, minmax(88px, 1fr)); overflow-x: auto; }
  .page-head h1 { font-size: 18px; }
}
.cal-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--border);
  background: var(--surface-2); font-size: 12px; color: #334155;
  border-radius: 0 0 var(--radius) var(--radius);
}
.cal-foot svg { vertical-align: -2px; }
.active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; }
.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-tools .input, .table-tools .select { width: auto; min-width: 170px; }
.table-tools .input[type='search'] { min-width: 240px; }

@media print {
  .sidebar, .cal-toolbar, .filters, .page-actions, .modal__foot { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
}
