/* ==========================================================================
   TDG Employee Portal — redesign stylesheet
   Prefix: tdg-   Font: Montserrat   Palette: existing TDG purple
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --tdg-primary: #6654DC;
  --tdg-primary-strong: #5A48C2;   /* links, hover */
  --tdg-primary-ink: #4C408C;      /* text on lavender */
  --tdg-lavender: #EFECFF;         /* active nav, soft fills */
  --tdg-lavender-2: #F6F4FF;
  --tdg-ink: #15122B;              /* headings */
  --tdg-text: #252334;             /* body */
  --tdg-text-2: #433E4E;           /* secondary body */
  --tdg-muted: #686477;            /* meta, labels */
  --tdg-line: #E3E2E9;             /* borders */
  --tdg-line-soft: #F0F0F1;        /* row dividers */
  --tdg-bg: #F7F8FA;               /* page background */
  --tdg-surface: #FFFFFF;
  --tdg-sidebar-ink: #15122B;      /* logo tile */

  --tdg-warn-bg: #FFF4DF;   --tdg-warn: #9A5B00;
  --tdg-danger-bg: #FCE8EF; --tdg-danger: #A3204D;
  --tdg-ok-bg: #E6F4EC;     --tdg-ok: #1E6B3F;
  --tdg-neutral-bg: #F0F0F1;--tdg-neutral: #433E4E;

  --tdg-font: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  --tdg-radius: 14px;
  --tdg-radius-sm: 10px;
  --tdg-radius-xs: 8px;
  --tdg-sidebar-w: 264px;
  --tdg-content-max: 1180px;
  --tdg-pad: 32px;
  --tdg-shadow-pop: 0 12px 40px rgba(21, 18, 43, .16);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.tdg {
  margin: 0; background: var(--tdg-bg); color: var(--tdg-text);
  font-family: var(--tdg-font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:where(.tdg) a:not([class]), :where(.tdg) .tdg-link { color: var(--tdg-primary-strong); }
:where(.tdg) a:not([class]):hover, :where(.tdg) .tdg-link:hover { color: var(--tdg-primary-ink); }
.tdg h1, .tdg h2, .tdg h3, .tdg h4 { margin: 0; color: var(--tdg-ink); }
.tdg p { margin: 0; }
.tdg button { font: inherit; }
.tdg :focus-visible { outline: 2px solid var(--tdg-primary); outline-offset: 2px; }
.tdg-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tdg-skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: #fff; padding: 10px 14px; border-radius: 8px; }
.tdg-skip:focus { left: 8px; }
.tdg-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tdg-icon--sm { width: 16px; height: 16px; }
.tdg-icon--lg { width: 20px; height: 20px; }

/* ---------- 3. App shell ---------- */
.tdg-app { display: flex; min-height: 100vh; background: linear-gradient(90deg, var(--tdg-surface) 0 calc(var(--tdg-sidebar-w) - 1px), var(--tdg-line) 0 var(--tdg-sidebar-w), transparent 0); }
.tdg-card.tdg-col-main, .tdg-card.tdg-col-side { gap: 0; }
.tdg-main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tdg-content { width: 100%; max-width: var(--tdg-content-max); padding: var(--tdg-pad); display: flex; flex-direction: column; gap: 24px; }
.tdg-page-foot { margin-top: auto; padding: 8px var(--tdg-pad) 24px; max-width: var(--tdg-content-max); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--tdg-muted); }

/* ---------- 4. Sidebar (the one navigation) ---------- */
.tdg-sidebar {
  width: var(--tdg-sidebar-w); flex-shrink: 0; background: var(--tdg-surface); border-right: 1px solid var(--tdg-line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.tdg-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--tdg-line); text-decoration: none; }
.tdg-brand__mark { width: 40px; height: 40px; border-radius: 8px; background: var(--tdg-sidebar-ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: .04em; overflow: hidden; }
.tdg-brand__mark img { width: 100%; height: 100%; object-fit: contain; }
.tdg-brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.tdg-brand__name { font-size: 15px; font-weight: 700; color: var(--tdg-ink); }
.tdg-brand__org { font-size: 12px; color: var(--tdg-muted); }

.tdg-nav { padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 20px; }
.tdg-nav__group { display: flex; flex-direction: column; gap: 2px; }
.tdg-nav__label { padding: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tdg-muted); }
.tdg-nav__item {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--tdg-radius-xs);
  background: transparent; color: var(--tdg-text); text-decoration: none; text-align: left; width: 100%; cursor: pointer;
}
.tdg-nav__item .tdg-icon { color: var(--tdg-muted); }
.tdg-nav__item:hover { background: var(--tdg-bg); color: var(--tdg-text); }
.tdg-nav__item[aria-current="page"], .tdg-nav__item.is-current { background: var(--tdg-lavender); color: var(--tdg-primary-ink); font-weight: 600; }
.tdg-nav__item[aria-current="page"] .tdg-icon, .tdg-nav__item.is-current .tdg-icon { color: var(--tdg-primary-strong); }
.tdg-nav__text { flex-grow: 1; }
.tdg-nav__chev { transition: transform .15s; color: var(--tdg-muted); }
.tdg-nav__item[aria-expanded="true"] .tdg-nav__chev { transform: rotate(90deg); }
.tdg-nav__sub { list-style: none; margin: 2px 0 6px 21px; padding: 0 0 0 12px; border-left: 1px solid var(--tdg-line); display: flex; flex-direction: column; }
.tdg-nav__sub[hidden] { display: none; }
.tdg-nav__sub a { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 6px; color: var(--tdg-text-2); font-size: 13px; text-decoration: none; }
.tdg-nav__sub a:hover { background: var(--tdg-bg); color: var(--tdg-ink); }
.tdg-nav__sub a[aria-current="page"] { background: var(--tdg-lavender); color: var(--tdg-primary-ink); font-weight: 600; }
.tdg-nav__foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--tdg-line); }

/* ---------- 5. Top bar ---------- */
.tdg-topbar { position: sticky; top: 0; z-index: 30; background: var(--tdg-surface); border-bottom: 1px solid var(--tdg-line); }
.tdg-topbar__inner { padding: 12px var(--tdg-pad); display: flex; align-items: center; gap: 12px 16px; }
.tdg-iconbtn.tdg-menu-btn { display: none; }
.tdg-search { flex: 1 1 280px; max-width: 480px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px solid var(--tdg-line); border-radius: var(--tdg-radius-sm); background: var(--tdg-bg); color: var(--tdg-muted); }
.tdg-search input { flex-grow: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--tdg-text); outline: none; }
.tdg-kbd { font-size: 11px; font-weight: 600; padding: 2px 6px; border: 1px solid var(--tdg-line); border-radius: 4px; background: #fff; }
.tdg-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tdg-iconbtn { position: relative; width: 44px; height: 44px; border: 0; border-radius: var(--tdg-radius-sm); background: transparent; color: var(--tdg-text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tdg-iconbtn:hover { background: var(--tdg-bg); }
.tdg-dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--tdg-primary); border: 2px solid #fff; }
.tdg-account { position: relative; }
.tdg-account__btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px 0 4px; border: 0; border-radius: var(--tdg-radius-sm); background: transparent; cursor: pointer; text-align: left; }
.tdg-account__btn:hover { background: var(--tdg-bg); }
.tdg-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--tdg-line); color: var(--tdg-primary-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.tdg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tdg-avatar--lg { width: 64px; height: 64px; font-size: 20px; }
.tdg-account__who { display: flex; flex-direction: column; line-height: 1.25; }
.tdg-account__name { font-size: 14px; font-weight: 600; color: var(--tdg-ink); }
.tdg-account__role { font-size: 12px; color: var(--tdg-muted); }
.tdg-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--tdg-line); border-radius: var(--tdg-radius-sm); box-shadow: var(--tdg-shadow-pop); padding: 6px; z-index: 60; }
.tdg-menu[hidden] { display: none; }
.tdg-menu a, .tdg-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--tdg-text); text-decoration: none; cursor: pointer; text-align: left; }
.tdg-menu a:hover, .tdg-menu button:hover { background: var(--tdg-bg); color: var(--tdg-ink); }
.tdg-menu hr { border: 0; border-top: 1px solid var(--tdg-line); margin: 6px 0; }

/* ---------- 6. Page header ---------- */
.tdg-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.tdg-head__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tdg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--tdg-muted); margin-bottom: 2px; }
.tdg-crumbs a { color: var(--tdg-muted); text-decoration: none; }
.tdg-crumbs a:hover { color: var(--tdg-primary-strong); text-decoration: underline; }
.tdg-h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.tdg-lede { font-size: 15px; color: var(--tdg-muted); max-width: 70ch; }
.tdg-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- 7. Buttons ---------- */
.tdg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--tdg-radius-sm); border: 1px solid transparent; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.tdg-btn--primary { background: var(--tdg-primary); color: #fff !important; }
.tdg-btn--primary:hover { background: var(--tdg-primary-strong); }
.tdg-btn--secondary { background: #fff; border-color: var(--tdg-line); color: var(--tdg-text) !important; }
.tdg-btn--secondary:hover { border-color: #C9C7D3; background: var(--tdg-bg); }
.tdg-btn--ghost { background: transparent; color: var(--tdg-primary-strong) !important; padding: 0 10px; }
.tdg-btn--ghost:hover { background: var(--tdg-lavender); }
.tdg-btn--danger { background: #fff; border-color: #F2C4D3; color: var(--tdg-danger) !important; }
.tdg-btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--tdg-radius-xs); }
.tdg-btn--block { width: 100%; }
.tdg-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 8. Cards + layout ---------- */
.tdg-card { background: var(--tdg-surface); border: 1px solid var(--tdg-line); border-radius: var(--tdg-radius); min-width: 0; }
.tdg-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 18px 20px; border-bottom: 1px solid var(--tdg-line); }
.tdg-card__title { font-size: 17px; font-weight: 700; }
.tdg-card__sub { font-size: 13px; color: var(--tdg-muted); margin-top: 2px; }
.tdg-card__body { padding: 20px; }
.tdg-card__foot { padding: 14px 20px; border-top: 1px solid var(--tdg-line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--tdg-muted); }
.tdg-link { font-size: 13px; font-weight: 600; text-decoration: none; }
.tdg-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(var(--tdg-min, 240px), 1fr)); }
.tdg-cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.tdg-cols > .tdg-col-main { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.tdg-cols > .tdg-col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.tdg-stack { display: flex; flex-direction: column; gap: 16px; }

/* Stat card */
.tdg-stat { background: var(--tdg-surface); border: 1px solid var(--tdg-line); border-radius: var(--tdg-radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--tdg-text); }
a.tdg-stat:hover { border-color: #C9C7D3; color: var(--tdg-text); }
.tdg-stat__label { font-size: 13px; font-weight: 600; color: var(--tdg-muted); }
.tdg-stat__value { display: flex; align-items: baseline; gap: 8px; }
.tdg-stat__num { font-size: 30px; font-weight: 700; color: var(--tdg-ink); line-height: 1.1; }
.tdg-stat__unit { font-size: 14px; color: var(--tdg-muted); }
.tdg-stat__text { font-size: 20px; font-weight: 700; color: var(--tdg-ink); }
.tdg-stat__note { font-size: 12px; color: var(--tdg-muted); }

/* Progress */
.tdg-progress { height: 6px; border-radius: 3px; background: var(--tdg-lavender); overflow: hidden; }
.tdg-progress > span { display: block; height: 100%; background: var(--tdg-primary); border-radius: 3px; }
.tdg-meter { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tdg-meter__row { display: flex; justify-content: space-between; gap: 8px; }
.tdg-meter__row strong { color: var(--tdg-ink); }

/* ---------- 9. Chips + badges ---------- */
.tdg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.tdg-chip--primary { background: var(--tdg-lavender); color: var(--tdg-primary-ink); }
.tdg-chip--warn { background: var(--tdg-warn-bg); color: var(--tdg-warn); }
.tdg-chip--danger { background: var(--tdg-danger-bg); color: var(--tdg-danger); }
.tdg-chip--ok { background: var(--tdg-ok-bg); color: var(--tdg-ok); }
.tdg-chip--neutral { background: var(--tdg-neutral-bg); color: var(--tdg-neutral); }
.tdg-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--tdg-primary); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tdg-count { min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 13px; }

/* ---------- 10. Lists ---------- */
.tdg-list { list-style: none; margin: 0; padding: 0; }
.tdg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 20px; border-bottom: 1px solid var(--tdg-line-soft); }
.tdg-list > li:last-child > .tdg-row, .tdg-list > .tdg-row:last-child { border-bottom: 0; }
.tdg-row__icon { width: 38px; height: 38px; border-radius: var(--tdg-radius-sm); background: var(--tdg-lavender); color: var(--tdg-primary-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tdg-row__main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tdg-row__title { font-size: 14px; font-weight: 600; color: var(--tdg-ink); }
.tdg-row__meta { font-size: 12px; color: var(--tdg-muted); }
.tdg-kv { list-style: none; margin: 0; padding: 6px 0; }
.tdg-kv a, .tdg-kv > li > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 20px; color: var(--tdg-text); text-decoration: none; }
.tdg-kv a:hover { background: var(--tdg-bg); color: var(--tdg-ink); }
.tdg-kv__muted { color: var(--tdg-muted); font-weight: 600; }

/* ---------- 11. Tables ---------- */
.tdg-table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tdg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tdg-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--tdg-muted); padding: 12px 16px; border-bottom: 1px solid var(--tdg-line); white-space: nowrap; background: var(--tdg-lavender-2); }
.tdg-table td { padding: 14px 16px; border-bottom: 1px solid var(--tdg-line-soft); vertical-align: middle; }
.tdg-table tr:last-child td { border-bottom: 0; }
.tdg-table tbody tr:hover td { background: #FBFBFD; }
.tdg-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tdg-table__title { font-weight: 600; color: var(--tdg-ink); }
.tdg-table__sub { font-size: 12px; color: var(--tdg-muted); }

/* Toolbar above tables */
.tdg-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--tdg-line); }
.tdg-toolbar .tdg-search { background: #fff; flex-basis: 260px; }

/* ---------- 12. Tabs ---------- */
.tdg-tabs { position: relative; display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--tdg-line); overflow-x: auto; }
.tdg-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--tdg-muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; margin-bottom: -1px; }
.tdg-tab:hover { color: var(--tdg-ink); }
.tdg-tab[aria-selected="true"] { color: var(--tdg-primary-ink); border-bottom-color: var(--tdg-primary); }
.tdg-tab .tdg-count { background: var(--tdg-neutral-bg); color: var(--tdg-neutral); font-size: 12px; padding: 0 7px; min-width: 22px; }
.tdg-tab[aria-selected="true"] .tdg-count { background: var(--tdg-lavender); color: var(--tdg-primary-ink); }
[role="tabpanel"][hidden] { display: none; }

/* ---------- 13. Forms ---------- */
.tdg-form { display: flex; flex-direction: column; gap: 18px; }
.tdg-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(var(--tdg-min, 220px), 1fr)); }
.tdg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tdg-field > span:not(.tdg-help), .tdg-label { font-size: 13px; font-weight: 600; color: var(--tdg-text); }
.tdg-req { color: var(--tdg-danger); }
.tdg-help { font-size: 12px; color: var(--tdg-muted); }
.tdg-input, .tdg-select, .tdg-textarea {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #CFCDD8; border-radius: var(--tdg-radius-xs);
  background: #fff; font: inherit; font-size: 14px; color: var(--tdg-text);
}
.tdg-textarea { padding: 10px 12px; resize: vertical; min-height: 110px; line-height: 1.5; }
.tdg-input:focus, .tdg-select:focus, .tdg-textarea:focus { outline: none; border-color: var(--tdg-primary); box-shadow: 0 0 0 3px rgba(102, 84, 220, .18); }
.tdg-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tdg-fieldset legend { padding: 0; margin-bottom: 4px; font-size: 15px; font-weight: 700; color: var(--tdg-ink); }
.tdg-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.tdg-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--tdg-primary); flex-shrink: 0; }
.tdg-switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex-shrink: 0; }
.tdg-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tdg-switch span { position: absolute; inset: 0; border-radius: 13px; background: #CFCDD8; transition: background .15s; pointer-events: none; }
.tdg-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tdg-switch input:checked + span { background: var(--tdg-primary); }
.tdg-switch input:checked + span::after { transform: translateX(18px); }
.tdg-switch input:focus-visible + span { outline: 2px solid var(--tdg-primary); outline-offset: 2px; }
.tdg-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 4px; }

/* ---------- 14. Notices + empty states ---------- */
.tdg-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--tdg-radius-sm); background: var(--tdg-lavender-2); border: 1px solid #DDD8FB; color: var(--tdg-text); font-size: 14px; }
.tdg-notice .tdg-icon { color: var(--tdg-primary-strong); margin-top: 1px; }
.tdg-notice--warn { background: #FFFAF0; border-color: #F3DFB5; }
.tdg-notice--warn .tdg-icon { color: var(--tdg-warn); }
.tdg-notice__title { font-weight: 700; color: var(--tdg-ink); }
.tdg-notice__body { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.tdg-empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--tdg-muted); }
.tdg-empty__icon { width: 48px; height: 48px; border-radius: 50%; background: var(--tdg-lavender); color: var(--tdg-primary-strong); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.tdg-empty__title { font-size: 15px; font-weight: 700; color: var(--tdg-ink); }

/* ---------- 15. Drawer (forms + module guide) ---------- */
.tdg-drawer { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end; }
.tdg-drawer[hidden] { display: none; }
.tdg-drawer__scrim { position: absolute; inset: 0; background: rgba(21, 18, 43, .4); }
.tdg-drawer__panel { position: relative; width: min(560px, 100%); height: 100%; background: #fff; box-shadow: var(--tdg-shadow-pop); display: flex; flex-direction: column; }
.tdg-drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--tdg-line); }
.tdg-drawer__title { font-size: 18px; font-weight: 700; }
.tdg-drawer__body { padding: 24px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 20px; }
.tdg-drawer__foot { padding: 16px 24px; border-top: 1px solid var(--tdg-line); display: flex; justify-content: flex-end; gap: 10px; }
.tdg-guide h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tdg-muted); margin-bottom: 8px; }
.tdg-guide ol, .tdg-guide ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- 16. Timesheet grid ---------- */
.tdg-ts th, .tdg-ts td { text-align: center; }
.tdg-ts th:first-child, .tdg-ts td:first-child { text-align: left; min-width: 200px; }
.tdg-ts .tdg-input { width: 72px; min-height: 40px; text-align: center; padding: 0 6px; font-variant-numeric: tabular-nums; }
.tdg-ts .is-weekend { background: #FAFAFC; }
.tdg-ts .is-holiday { background: var(--tdg-lavender-2); }
.tdg-ts tfoot td { font-weight: 700; color: var(--tdg-ink); background: var(--tdg-lavender-2); border-top: 1px solid var(--tdg-line); }
.tdg-day { display: flex; flex-direction: column; line-height: 1.3; }
.tdg-day strong { color: var(--tdg-ink); font-size: 13px; }
.tdg-weeknav { display: flex; align-items: center; gap: 8px; }
.tdg-weeknav__label { font-weight: 700; color: var(--tdg-ink); min-width: 150px; text-align: center; }

/* ---------- 17. Holiday + calendar list ---------- */
.tdg-date { width: 52px; flex-shrink: 0; border: 1px solid var(--tdg-line); border-radius: var(--tdg-radius-xs); overflow: hidden; text-align: center; background: #fff; }
.tdg-date__m { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; background: var(--tdg-lavender); color: var(--tdg-primary-ink); padding: 2px 0; }
.tdg-date__d { display: block; font-size: 18px; font-weight: 700; color: var(--tdg-ink); padding: 3px 0; }

/* ---------- 18. Sign-in ---------- */
.tdg-auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.tdg-auth__brand { flex: 1 1 420px; background: var(--tdg-ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.tdg-auth__brand h1 { color: #fff; font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 16ch; }
.tdg-auth__brand p { color: #C9C5DD; max-width: 44ch; }
.tdg-auth__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #E5E2F5; }
.tdg-auth__points li { display: flex; gap: 10px; align-items: center; }
.tdg-auth__points .tdg-icon { color: #A99CF5; }
.tdg-auth__form { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--tdg-bg); }
.tdg-auth__card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.tdg-auth__alt { font-size: 14px; color: var(--tdg-muted); text-align: center; }
.tdg-auth .tdg-brand { border: 0; padding: 0; }
.tdg-auth .tdg-brand__mark { background: #fff; color: var(--tdg-ink); }
.tdg-auth .tdg-brand__name { color: #fff; }
.tdg-auth .tdg-brand__org { color: #C9C5DD; }

/* ---------- 19. Profile ---------- */
.tdg-profile-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.tdg-pref { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px; border-bottom: 1px solid var(--tdg-line-soft); }
.tdg-pref:last-child { border-bottom: 0; }
.tdg-pref__main { flex: 1 1 260px; min-width: 0; }
.tdg-pref__title { font-weight: 600; color: var(--tdg-ink); }
.tdg-pref .tdg-select { width: auto; min-width: 150px; }

/* ---------- 20. Responsive ---------- */
.tdg-overlay { display: none; }
@media (max-width: 1023px) {
  .tdg-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
  .tdg-sidebar.is-open { transform: none; visibility: visible; box-shadow: var(--tdg-shadow-pop); }
  .tdg-overlay.is-open { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(21, 18, 43, .4); }
  .tdg-iconbtn.tdg-menu-btn { display: inline-flex; }
  .tdg-app { background: none; }
}
@media (max-width: 720px) {
  :root { --tdg-pad: 16px; }
  .tdg-topbar__inner { flex-wrap: wrap; }
  .tdg-search { order: 3; flex-basis: 100%; max-width: none; }
  .tdg-account__who, .tdg-kbd { display: none; }
  .tdg-h1 { font-size: 24px; }
  .tdg-head__actions { width: 100%; }
  .tdg-head__actions .tdg-btn { flex: 1 1 auto; }
  .tdg-table { min-width: 680px; }
  .tdg-table td[colspan] { white-space: normal; }
  .tdg-auth__brand { padding: 32px 24px; flex-basis: 100%; }
  .tdg-auth__brand h1 { font-size: 26px; }
  .tdg-auth__brand .tdg-auth__points, .tdg-auth__brand .tdg-auth__foot { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
