/* ==========================================================================
   Foresight HR - shared design system
   Every page links this file; no page should carry its own colour or spacing
   values. Tokens first, then primitives, then components, then responsive.
   ========================================================================== */

/* ---------- Webfont (self-hosted: the CSP in server.js allows 'self' only) ---------- */
@font-face {
  font-family: 'Noto Sans Georgian';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/noto-sans-georgian-georgian.woff2') format('woff2');
  unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+205A, U+2D00-2D2F, U+2E31;
}
@font-face {
  font-family: 'Noto Sans Georgian';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/noto-sans-georgian-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --navy-900: #091329;
  --navy-800: #0f1f3d;
  --navy-700: #16295a;
  --navy-600: #223a72;
  --navy-500: #34508f;
  --yellow:      #f5c518;
  --yellow-dark: #e0b400;
  --yellow-soft: #fff6d6;

  /* Surfaces & text */
  --bg:          #f2f5fa;
  --surface:     #ffffff;
  --surface-alt: #f7f9fc;
  --border:      #e3e8f1;
  --border-strong: #cfd7e6;
  --text:        #16203a;
  --text-soft:   #45536e;
  --muted:       #7a879e;

  /* Status */
  --green:   #1e8449;  --green-bg:  #e3f5e9;
  --amber:   #8a6d00;  --amber-bg:  #fdf3d0;
  --red:     #c0392b;  --red-bg:    #fbe3e0;
  --blue:    #1e5aa8;  --blue-bg:   #e2ecfb;
  --grey-bg: #eceff5;
  --pink:    #b3376b;  --pink-bg: #fbe4ee;

  /* The team calendar's three categories. Every kind of absence is one colour - the
     calendar says who is away, not why - with remote days apart from it because the
     person is working, and birthdays in the yellow accent with dark text so they read
     as a celebration rather than as another kind of absence. Violet and blue are far
     enough apart to tell at a glance in a 10px chip, which the shades of navy these
     replaced were not, and both carry white text well above 4.5:1. */
  --cal-leave:    #5b21b6;   /* violet, white text - 8.98:1 */
  --cal-remote:   #0e6fa8;   /* blue,   white text - 5.44:1 */
  --cal-birthday: #f5c518;   /* yellow, dark text */
  --holiday-mark: #c98a00;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Elevation */
  --sh-sm: 0 1px 2px rgba(16, 30, 60, .06), 0 1px 3px rgba(16, 30, 60, .04);
  --sh-md: 0 2px 4px rgba(16, 30, 60, .04), 0 8px 24px rgba(16, 30, 60, .07);
  --sh-lg: 0 12px 40px rgba(9, 19, 41, .18);

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);

  --sidebar-w: 258px;

  --font: "Noto Sans Georgian", "BPG Nino Mtavruli", system-ui, -apple-system,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--navy-800); line-height: 1.25; }
p { margin: 0 0 .75rem; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--navy-700); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--yellow-dark);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted     { color: var(--muted); font-size: .85rem; }
.req       { color: var(--red); font-weight: 700; }
.hidden    { display: none !important; }

/* ==========================================================================
   AUTH PAGES (login / forgot / reset)
   ========================================================================== */
body.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1100px 620px at 12% -10%, var(--navy-600) 0%, transparent 62%),
    radial-gradient(900px 520px at 105% 110%, #1c3566 0%, transparent 58%),
    var(--navy-900);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 2.5rem 2.25rem 2rem;
  box-shadow: var(--sh-lg);
  animation: rise .45s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.auth-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy-800);
  letter-spacing: -.01em;
  margin-bottom: .35rem;
}
.auth-logo .mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--navy-800);
  color: var(--yellow);
  font-size: .95rem;
  flex-shrink: 0;
}
.auth-logo .accent { color: var(--yellow-dark); }

.auth-title { font-size: 1.05rem; margin: 1.4rem 0 .3rem; }
.auth-sub   { color: var(--text-soft); font-size: .88rem; margin-bottom: 1.4rem; }

.auth-card form { margin: 0; }
.auth-foot {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .86rem;
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
body.app { height: 100vh; height: 100dvh; overflow: hidden; }

.shell { display: flex; height: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #e8ecf6;
  padding: 1.25rem 0 .75rem;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.25rem 1.15rem;
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
}
.sidebar-brand .mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--yellow);
  color: var(--navy-800);
  font-size: .9rem;
  font-weight: 800;
  flex-shrink: 0;
}
.sidebar-brand .accent { color: var(--yellow); }

.nav { padding: 0 .7rem; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #6f7f9f;
  padding: .9rem .6rem .4rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .65rem;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: #b8c3da;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
  position: relative;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link.active {
  background: rgba(245, 197, 24, .13);
  color: #fff;
  font-weight: 600;
}
.nav-link.active svg { opacity: 1; color: var(--yellow); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--yellow);
}

.sidebar-foot {
  margin-top: auto;
  padding: .9rem 1.25rem 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
}
.who {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}

/* The sidebar initials double as the way into the profile page. */
.avatar-btn {
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition: box-shadow .15s var(--ease);
}
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--yellow); }

.who .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-600);
  color: var(--yellow);
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.who-text { min-width: 0; display: block; }
/* Picture at one end, day count at the other, name between them - the two ends
   carry the same visual weight so the block reads as balanced. */
.who-days {
  display: none;                 /* shown once a hire date is known */
  margin-left: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 38px;
  padding: .25rem .35rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .06);
  line-height: 1.05;
  cursor: default;
}
.who-days b {
  font-size: .95rem;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: -.02em;
}
.who-days small {
  font-size: .6rem;
  color: #8d9ab5;
  letter-spacing: .04em;
}

.who-name {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who-role { display: block; font-size: .74rem; color: #8d9ab5; }

.sidebar-actions { display: flex; gap: .4rem; }
.sidebar-actions button {
  flex: 1;
  font-family: inherit;
  font-size: .78rem;
  padding: .42rem .5rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s var(--ease);
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent;
  color: #c3cde2;
}
.sidebar-actions button:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar-actions button.logout { border-color: rgba(245, 197, 24, .45); color: var(--yellow); }
.sidebar-actions button.logout:hover { background: rgba(245, 197, 24, .13); }

/* ---------- Topbar (mobile) ---------- */
.topbar {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: var(--navy-800);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .brand { font-weight: 700; font-size: .98rem; }
.topbar .brand .accent { color: var(--yellow); }
.hamburger {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--r-sm);
  background: transparent;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(9, 19, 41, .55);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.main-inner { max-width: 1180px; padding: 2rem 2.25rem 4rem; }
/* The outstanding-work bar floats over the bottom-right corner, so without this the
   last thing on a page sits underneath it and cannot be clicked. Only reserved while
   the bar actually has something in it. */
body.has-alerts .main-inner { padding-bottom: 15rem; }
@media (max-width: 720px) { body.has-alerts .main-inner { padding-bottom: 19rem; } }

.page { display: none; animation: fade .25s var(--ease) both; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.page-head { margin-bottom: 1.5rem; }
.page-head h2 { font-size: 1.5rem; letter-spacing: -.015em; }
.page-head p  { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.card-head h3 { font-size: .98rem; }
.card-head .sub { font-size: .82rem; color: var(--muted); margin: .15rem 0 0; }
.card-body { padding: 1.35rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-body.flush { padding: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  padding: .62rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), box-shadow .15s var(--ease),
              border-color .15s var(--ease), transform .06s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--yellow);
  color: var(--navy-800);
  box-shadow: 0 1px 2px rgba(120, 95, 0, .22);
}
.btn-primary:hover:not(:disabled) { background: var(--yellow-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--navy-700);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--muted); }

.btn-danger { background: var(--red-bg); color: var(--red); border-color: #f2c9c3; }
.btn-danger:hover:not(:disabled) { background: #f7d5d0; }

.btn-sm { padding: .38rem .7rem; font-size: .8rem; }

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 500;
  color: var(--navy-600);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.btn-link:hover { color: var(--navy-800); border-bottom-color: currentColor; }
.btn-link.danger { color: var(--red); }

/* ---------- Forms ---------- */
input, select, textarea {
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: .55rem .7rem;
  width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(52, 80, 143, .13);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%237a879e' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 11px;
  padding-right: 2rem;
}

input[type="file"] {
  padding: .42rem .55rem;
  background: var(--surface-alt);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  margin-right: .7rem;
  padding: .35rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--navy-700);
  cursor: pointer;
}
input[type="checkbox"] { width: auto; accent-color: var(--navy-700); }

.field { display: block; margin-bottom: 1rem; }
.field > span.label,
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: .35rem;
}
.field .hint { display: block; font-size: .76rem; color: var(--muted); margin-top: .3rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
}
.form-grid .field { margin-bottom: 0; }
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}
.form-row .field { margin-bottom: 0; flex: 1 1 190px; min-width: 0; }
.form-actions {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  margin-top: 1.35rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .86rem;
  color: var(--text-soft);
  cursor: pointer;
}

/* Inline feedback under a form */
.form-msg { font-size: .85rem; margin-top: .9rem; min-height: 1.1em; }
.form-msg.ok    { color: var(--green); }
.form-msg.error { color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
table.data thead th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-alt);
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-soft);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-alt); }
table.data td.name, table.data td strong { color: var(--text); font-weight: 600; }
table.data td .btn-link + .btn-link { margin-left: .8rem; }
/* Long, unbreakable values (emails, filenames) must yield rather than push the
   action column off the edge of a wide table. */
table.data td.wrap { overflow-wrap: anywhere; }
table.data td select { font-size: .8rem; padding: .35rem .5rem; min-width: 130px; }

.empty { color: var(--muted); font-size: .87rem; padding: 1.6rem 1.35rem; text-align: center; }
td.empty { text-align: center; }

/* A reminder that has been ticked off stays legible but stops competing for
   attention with the ones still outstanding. */
table.data tr.is-done td { opacity: .55; }
table.data tr.is-done td.name { font-weight: 500; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: var(--r-pill);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.pending, .badge.open, .badge.expiring { background: var(--amber-bg); color: var(--amber); }
.badge.approved, .badge.present, .badge.active { background: var(--green-bg); color: var(--green); }
.badge.rejected, .badge.missing { background: var(--red-bg); color: var(--red); }
.badge.reviewed { background: var(--blue-bg); color: var(--blue); }
.badge.closed, .badge.optional, .badge.inactive { background: var(--grey-bg); color: var(--muted); }
.badge.restricted { background: var(--navy-800); color: var(--yellow); }
.badge.expired { background: var(--red); color: #fff; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}
.stat {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-alt);
}
.stat .num {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--navy-800);
  letter-spacing: -.02em;
}
.stat .label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: .3rem;
}
.stat.accent { background: var(--yellow-soft); border-color: #f0dfa6; }
.stat.accent .num { color: #7a5f00; }

/* ---------- Employee directory ---------- */
.dir-toolbar { margin-bottom: 1rem; }
.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: .8rem;
}
.dir-card {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease),
              transform .15s var(--ease);
}
.dir-card:hover {
  border-color: var(--yellow);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}
.dir-card .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-700);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  flex-shrink: 0;
}
.dir-card.is-inactive { opacity: .6; }
.dir-card.is-inactive .avatar { background: var(--muted); }
.dir-card .meta { min-width: 0; }
.dir-card .name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dir-card .dept { font-size: .76rem; color: var(--muted); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy-600);
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 1rem;
  cursor: pointer;
  font-family: inherit;
}
.back-link:hover { color: var(--navy-800); }

/* Section heading inside a card */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.35rem .6rem;
  border-top: 1px solid var(--border);
}
.section-head:first-child { border-top: none; }
.section-head h4 { font-size: .9rem; color: var(--navy-800); }
.section-head .muted { font-size: .8rem; }

/* Progress bar for the checklist completeness */
.progress {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--grey-bg);
  overflow: hidden;
  margin-top: .5rem;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .4s var(--ease);
}
.progress.warn > span { background: var(--yellow-dark); }

/* ---------- Toasts (pop-up announcements) ---------- */
/* Fixed above everything, including the mobile drawer, and never blocks clicks on
   the page behind it - only the toasts themselves are interactive. */
.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-600);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: .85rem 2.2rem .95rem 1rem;
  overflow: hidden;
  animation: toast-in .3s var(--ease) both;
}
.toast.important { border-left-color: var(--yellow-dark); background: #fffdf5; }
.toast.leaving { animation: toast-out .3s var(--ease) both; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(18px) scale(.98); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(18px) scale(.98); } }

.toast .toast-kicker {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
}
.toast.important .toast-kicker { color: var(--amber); }
.toast .toast-title { font-size: .92rem; font-weight: 700; color: var(--text); }
.toast .toast-body {
  font-size: .84rem;
  color: var(--text-soft);
  margin-top: .2rem;
  white-space: pre-wrap;
  /* Long announcements are truncated in the pop-up; the full text lives on the page. */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.toast .toast-meta { font-size: .74rem; color: var(--muted); margin-top: .45rem; }
.toast .toast-close {
  position: absolute;
  top: .45rem; right: .45rem;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.toast .toast-close:hover { background: var(--grey-bg); color: var(--text); }
/* Drains left-to-right so the reader can see how long the toast has left. */
.toast .toast-timer {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--yellow);
  transform-origin: left;
  animation: toast-timer linear both;
}
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 720px) {
  .toast-stack { top: auto; bottom: 1rem; left: 1rem; right: 1rem; width: auto; }
  .toast { animation-name: toast-in-up; }
  .toast.leaving { animation-name: toast-out-down; }
  @keyframes toast-in-up   { from { opacity: 0; transform: translateY(18px); } }
  @keyframes toast-out-down { to  { opacity: 0; transform: translateY(18px); } }
}

/* Someone who prefers reduced motion still needs the timer to run, just not to
   animate - the global reduce rule would otherwise freeze the bar at full width. */
@media (prefers-reduced-motion: reduce) {
  .toast .toast-timer { display: none; }
}

/* ---------- Document viewer (preview without downloading) ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 200;                 /* above the toast stack */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(9, 19, 41, .62);
  backdrop-filter: blur(3px);
}
.viewer.open { display: flex; animation: fade .18s var(--ease) both; }

.viewer-panel {
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  height: min(88vh, 100%);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: rise .22s var(--ease) both;
}

.viewer-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem .8rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
}
.viewer-title {
  font-size: .93rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.viewer-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.viewer-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.viewer-close:hover { background: var(--grey-bg); color: var(--text); }

.viewer-body {
  flex: 1;
  min-height: 0;
  background: #5b6474;          /* neutral mat, so a white page reads as a page */
  display: grid;
  place-items: center;
  overflow: auto;
}
.viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}
.viewer-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.viewer-empty {
  color: #e8ecf6;
  font-size: .9rem;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 380px;
}
.viewer-empty strong { display: block; color: #fff; margin-bottom: .4rem; font-size: .95rem; }

@media (max-width: 720px) {
  .viewer { padding: 0; }
  .viewer-panel { width: 100%; height: 100%; border-radius: 0; }
  /* On a phone the label would crowd out the buttons. */
  .viewer-actions .btn .label-wide { display: none; }
}

/* ---------- Timesheet grid ---------- */
/* A month is 31 columns wide, so it scrolls sideways with the name column pinned.
   This table opts out of the phone card-stacking that the data tables use - a grid
   only means anything as a grid. */
.ts-wrap { width: 100%; overflow-x: auto; }
table.ts { border-collapse: separate; border-spacing: 0; font-size: .8rem; width: max-content; min-width: 100%; }

table.ts th, table.ts td { border-bottom: 1px solid var(--border); }

table.ts .ts-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  padding: .5rem 1rem;
  min-width: 190px;
  border-right: 1px solid var(--border);
}
table.ts thead .ts-name { background: var(--surface-alt); z-index: 3; }
table.ts tbody tr:hover .ts-name { background: var(--surface-alt); }
.ts-person { display: block; font-weight: 600; color: var(--text); white-space: nowrap; }
.ts-dept { display: block; font-size: .72rem; color: var(--muted); }

table.ts .ts-day {
  width: 30px;
  min-width: 30px;
  padding: .5rem 0;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-alt);
}
table.ts .ts-day.is-weekend { color: var(--text-soft); background: #eef1f7; }
table.ts .ts-day.is-holiday { color: #8a6200; background: #fff3d8; }

table.ts .ts-cell {
  width: 30px;
  text-align: center;
  padding: .45rem 0;
  font-weight: 700;
  color: var(--text-soft);
}
/* Each state reads at a glance without needing the legend every time. */
.ts-cell.code-present  { color: #9aa6bd; font-weight: 500; }
.ts-cell.code-weekend  { background: #f1f4f9; color: #c2cadb; }
.ts-cell.code-holiday  { background: #fff3d8; color: #8a6200; }
.ts-cell.code-annual   { background: var(--blue-bg);  color: var(--blue); }
.ts-cell.code-day_off  { background: #e7e2fb;         color: #5b46b8; }
.ts-cell.code-unpaid   { background: var(--grey-bg);  color: var(--text-soft); }
.ts-cell.code-sick     { background: var(--red-bg);   color: var(--red); }
.ts-cell.code-remote   { background: var(--green-bg); color: var(--green); }
.ts-cell.code-none     { color: #c2cadb; }

table.ts .ts-total small {
  display: block;
  font-size: .66rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: .1rem;
}
table.ts .ts-total {
  padding: .45rem .8rem;
  text-align: center;
  font-weight: 800;
  color: var(--navy-800);
  background: var(--surface-alt);
  border-left: 1px solid var(--border);
}

.ts-key {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--grey-bg);
  color: var(--text);
  font-size: .72rem;
  margin-right: .3rem;
}

/* ---------- Conference rooms ---------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.room-col {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-alt);
  padding: .9rem;
  min-height: 140px;
}
.room-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  padding-bottom: .6rem;
  margin-bottom: .7rem;
  border-bottom: 1px solid var(--border);
}
.room-name { font-weight: 700; color: var(--navy-800); font-size: .93rem; }
.room-empty { margin: .6rem 0 0; text-align: center; }

.booking {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--navy-500);
  border-radius: var(--r-sm);
  padding: .6rem .7rem;
  margin-bottom: .55rem;
}
/* Your own bookings stand out, because those are the ones you might cancel. */
.booking.own { border-left-color: var(--yellow); background: var(--yellow-soft); }
.booking-time { font-size: .82rem; font-weight: 800; color: var(--navy-800); }
.booking-purpose { font-size: .86rem; color: var(--text); margin-top: .1rem; }
.booking-meta { font-size: .76rem; color: var(--muted); margin-top: .25rem; }
.booking-people {
  font-size: .76rem;
  color: var(--text-soft);
  margin-top: .35rem;
  padding-top: .35rem;
  border-top: 1px dashed var(--border);
  overflow-wrap: anywhere;
}
.booking-cancel { position: absolute; top: .55rem; right: .6rem; font-size: .76rem; }

/* ---------- Announcement feed ---------- */
.ann-list { display: flex; flex-direction: column; gap: .85rem; }
.ann {
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-600);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 1rem 1.15rem;
}
.ann.important { border-left-color: var(--yellow-dark); background: #fffdf5; }
.ann.unread { box-shadow: 0 0 0 2px rgba(245, 197, 24, .35); }
.ann-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.ann-title { font-size: .98rem; font-weight: 700; color: var(--text); }
.ann-body {
  font-size: .89rem;
  color: var(--text-soft);
  margin-top: .4rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ann-meta {
  display: flex;
  align-items: center;
  gap: .5rem .9rem;
  flex-wrap: wrap;
  margin-top: .7rem;
  padding-top: .6rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--muted);
}
.ann-meta .who { font-weight: 600; color: var(--text-soft); }
.ann-tags { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* A count of who has opened it - HR only. */
.read-bar {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .76rem;
  color: var(--muted);
}
.read-bar .track {
  width: 64px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--grey-bg);
  overflow: hidden;
}
.read-bar .track > span {
  display: block; height: 100%;
  background: var(--green);
  border-radius: inherit;
}

/* Unread counter next to the sidebar link */
.nav-link .count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--yellow);
  color: var(--navy-800);
  font-size: .7rem;
  font-weight: 800;
  display: none;
  place-items: center;
}
.nav-link .count.show { display: grid; }

/* ---------- Calendar ---------- */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.cal-head h3 { font-size: 1rem; }
.cal-nav { display: flex; gap: .4rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .35rem 0;
}
.cal-day {
  min-height: 84px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: .35rem;
  font-size: .78rem;
  overflow: hidden;
}
.cal-day.empty { background: var(--surface-alt); border-color: transparent; min-height: 0; }
.cal-day .num { font-weight: 700; color: var(--text-soft); font-size: .8rem; }
.cal-day.weekend { background: var(--surface-alt); }
.cal-day.today { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.cal-day.today .num {
  display: inline-grid; place-items: center;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy-800);
}
.cal-event {
  margin-top: 3px;
  font-size: .68rem;
  font-weight: 600;
  background: var(--cal-leave);
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event.type-leave  { background: var(--cal-leave); }
.cal-event.type-remote { background: var(--cal-remote); }
.cal-day.holiday { background: #fff7e6; border-color: #f0dca6; }
.cal-holiday {
  margin-top: 2px;
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.25;
  color: #8a6200;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cal-event.type-birthday {
  background: var(--cal-birthday);
  color: var(--navy-800);
}
.cal-more { font-size: .68rem; color: var(--muted); margin-top: 2px; font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
/* Matches how a public holiday actually appears in the grid - a tinted day, not a
   chip - which is also what keeps it from reading as a second yellow label. */
.legend i.swatch-holiday { background: #fff7e6; border: 1px solid #f0dca6; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Tablet & below: sidebar slides in over the content */
@media (max-width: 1024px) {
  .shell { flex-direction: column; }

  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 280px;
    max-width: 84vw;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    box-shadow: var(--sh-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .main-inner { padding: 1.35rem 1.25rem 3.5rem; }
  .page-head h2 { font-size: 1.3rem; }
}

/* Phones: tables become stacked cards, forms go single column */
@media (max-width: 720px) {
  body { font-size: 14.5px; }

  .card-head, .card-body { padding-left: 1rem; padding-right: 1rem; }
  .section-head { padding-left: 1rem; padding-right: 1rem; }

  .form-grid { grid-template-columns: 1fr; }
  .form-row  { flex-direction: column; align-items: stretch; }
  .form-row .field { flex: 1 1 auto; }
  .form-actions .btn { width: 100%; }

  .dir-grid { grid-template-columns: 1fr 1fr; }

  /* Each row becomes its own labelled card. Labels come from td[data-label],
     which every JS render function sets alongside the matching <th>. */
  .table-wrap { overflow-x: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tbody { padding: .85rem; }
  table.data tr {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: .35rem .85rem;
    margin-bottom: .7rem;
    box-shadow: var(--sh-sm);
  }
  table.data tr:last-child { margin-bottom: 0; }
  table.data tbody tr:hover { background: var(--surface); }
  table.data td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  table.data tr td:last-child { border-bottom: none; }
  table.data td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
  }
  /* Rows with no label and no content (spacer cells) collapse away */
  table.data td:not([data-label]):empty { display: none; }
  table.data td.empty { display: block; text-align: center; }
  table.data td.empty::before { content: none; }
  table.data td select { min-width: 0; }

  .cal-day { min-height: 62px; padding: .25rem; }
  .cal-event { font-size: .6rem; padding: 1px 3px; }
  .cal-day .num { font-size: .72rem; }

  .auth-card { padding: 2rem 1.5rem 1.75rem; }
}

@media (max-width: 400px) {
  .dir-grid { grid-template-columns: 1fr; }
  .cal-grid { gap: 3px; }
}

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

/* Printing a personal file / policy list should not carry the chrome */
@media print {
  .sidebar, .topbar, .scrim, .form-actions, .btn { display: none !important; }
  body.app { height: auto; overflow: visible; }
  .main { overflow: visible; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Password reveal ---------- */
/* The eye button sits inside the box, so the input keeps its own full width. */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 2.6rem; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: .45rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.pw-toggle:hover  { color: var(--navy-700); background: var(--surface-alt); }
.pw-toggle:active { color: var(--navy-700); }

/* ---------- Birthday greeting ---------- */
.bday {
  position: fixed;
  inset: 0;
  z-index: 300;                 /* the one thing that outranks everything */
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(9, 19, 41, .82);
  animation: fade .25s var(--ease) both;
}
.bday.closing { animation: fade .2s var(--ease) reverse both; }
.bday-sky { position: absolute; inset: 0; width: 100%; height: 100%; }

.bday-card {
  position: relative;           /* above the canvas */
  text-align: center;
  width: min(430px, 100%);
  padding: 2rem 1.75rem 1.75rem;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  animation: rise .3s var(--ease) both;
}
.bday-cake { font-size: 3.4rem; line-height: 1; animation: bday-bob 2.4s var(--ease) infinite; }
.bday-title {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--navy-700);
  margin: .7rem 0 .6rem;
}
.bday-text { font-size: .92rem; line-height: 1.65; color: var(--text-soft); margin: 0; }
.bday-signature { font-size: .84rem; color: var(--muted); margin: .9rem 0 1.3rem; }
.bday-close { min-width: 150px; }

@keyframes bday-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-9px) rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
  .bday-cake { animation: none; }
}

/* ---------- Quote of the day ---------- */
/* Bottom-left of the content, beside the sidebar and never over it. The toasts own
   the top-right corner and the outstanding-work bar the bottom-right, so this is the
   corner nothing else uses. It stays under the mobile drawer and its scrim (35/40):
   opening the menu covers the quote, not the other way round. */
.quote {
  position: fixed;
  left: calc(var(--sidebar-w) + 1.25rem);
  bottom: 1.25rem;
  z-index: 34;
  width: 380px;
  max-width: calc(100vw - var(--sidebar-w) - 2.5rem);
  padding: 1rem 2.6rem 1rem 1.25rem;
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(360px 160px at 0% 0%, rgba(245, 197, 24, .16), transparent 70%),
    linear-gradient(160deg, var(--navy-700) 0%, var(--navy-900) 100%);
  color: #e8ecf6;
  box-shadow: var(--sh-lg);
  animation: quote-in .45s var(--ease) both;
}
.quote.leaving { animation: quote-out .25s var(--ease) both; }
/* The oversized opening mark. z-index -1 puts it under the text but still above the
   card's own background, since the card's z-index makes it a stacking context. */
.quote::before {
  content: '\201C';
  position: absolute;
  z-index: -1;
  top: .9rem;
  left: .55rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 7.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, .07);
  pointer-events: none;
}

.quote-hello {
  font-size: .8rem;
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: .5rem;
}
.quote-text {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.08rem;
  line-height: 1.5;
  color: #fff;
}
.quote-word {
  display: inline-block;
  animation: quote-word .4s var(--ease) both;
  animation-delay: calc(.35s + var(--i) * 45ms);
}

.quote-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .85rem;
  font-size: .72rem;
  color: #8f9dbb;
}
.quote-n { font-weight: 700; color: #b8c3da; font-variant-numeric: tabular-nums; }
/* How far through the year's quotes today is. */
.quote-progress {
  height: 3px;
  margin-top: .4rem;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}
.quote-progress > span {
  display: block;
  height: 100%;
  background: var(--yellow);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  animation: quote-fill 1.2s .5s var(--ease) both;
}

.quote-close {
  position: absolute;
  top: .55rem;
  right: .55rem;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 7px;
  background: none;
  color: #8f9dbb;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.quote-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }

@keyframes quote-in   { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes quote-out  { to   { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes quote-word { from { opacity: 0; transform: translateY(5px); filter: blur(2px); } }
@keyframes quote-fill { from { transform: scaleX(0); } }

/* While it is up, let the last thing on the page scroll clear of it. */
@media (min-width: 721px) {
  body.has-quote .main-inner { padding-bottom: 15rem; }
}

/* Tablet: the sidebar becomes a drawer, so the card moves to the screen edge, and
   narrows enough to sit beside the work bar rather than under it. */
@media (max-width: 1024px) {
  .quote { left: 1rem; bottom: 1rem; width: 360px; max-width: calc(100vw - 2rem); }
}

/* Phones: the toasts and the work bar both run along the bottom, so the card goes to
   the top instead, just under the menu bar (a 38px button with .7rem either side). */
@media (max-width: 720px) {
  .quote {
    top: calc(38px + 2rem);
    bottom: auto;
    right: 1rem;
    width: auto;
    padding: .9rem 2.4rem .9rem 1rem;
    animation-name: quote-in-down;
  }
  .quote.leaving { animation-name: quote-out-up; }
  .quote-text { font-size: 1rem; }
  @keyframes quote-in-down { from { opacity: 0; transform: translateY(-12px); } }
  @keyframes quote-out-up  { to   { opacity: 0; transform: translateY(-12px); } }
}

@media (prefers-reduced-motion: reduce) {
  .quote-word, .quote-progress > span { animation: none; }
}
@media print {
  .quote { display: none; }
}

/* ---------- Profile page ---------- */

.profile-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 55%, #3c5a94 100%);
  box-shadow: var(--sh-md, 0 1px 3px rgba(9, 19, 41, .12));
  padding: 1.6rem 1.5rem 1.25rem;
  margin-bottom: 1.15rem;
}
/* A soft highlight so the flat gradient has somewhere to catch the light. */
.profile-hero::after {
  content: '';
  position: absolute;
  top: -55%; right: -12%;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, .22), transparent 68%);
  pointer-events: none;
}
.profile-hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.avatar.avatar-xl {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-500, #34508f);
  color: #fff;
  font-size: 1.9rem;
  font-weight: 700;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 4px 14px rgba(9, 19, 41, .3);
}

.profile-id { min-width: 0; }
.profile-id h3 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 .2rem;
  line-height: 1.25;
}
.profile-id p { color: rgba(255, 255, 255, .74); font-size: .87rem; margin: 0; }
.profile-id .form-msg { color: #fff; margin-top: .4rem; }
.profile-id .form-msg.ok { color: #9fe8c8; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.15rem;
  align-items: start;
}

/* Label/value pairs, readable as a column on a phone and a grid on a desktop. */
.detail-list { margin: 0; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .62rem 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-row dt { font-size: .8rem; color: var(--text-soft); font-weight: 600; flex-shrink: 0; }
.detail-row dd {
  margin: 0;
  font-size: .88rem;
  color: var(--text);
  text-align: right;
  word-break: break-word;
  min-width: 0;
}

/* ---------- Outstanding-work bar ---------- */
/* Sits under the announcement toasts, same column. No timer: these persist until the
   person opens the section they point at. */
.alertbar {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: 300px;
  max-width: calc(100vw - 2rem);
  /* Four of these on a short window would otherwise run off the bottom of the screen,
     taking the last one out of reach. */
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-left: 4px;                /* room for the hover nudge, which shifts left */
}
.alertbar:empty { display: none; }

.alert-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .7rem .85rem;
  text-align: left;
  font-family: inherit;
  border: 1px solid var(--border);
  border-left: 4px solid var(--yellow);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  cursor: pointer;
  animation: alert-in .28s var(--ease) both;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.alert-item:hover { transform: translateX(-3px); box-shadow: 0 10px 26px rgba(9, 19, 41, .2); }

.alert-n {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--navy-700);
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
}
.alert-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.alert-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.alert-go { font-size: .74rem; color: var(--muted); }

@keyframes alert-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .alert-item { animation: none; }
  .alert-item:hover { transform: none; }
}

/* Quiet credit under the sign-in card: there for anyone who looks, in the way of
   nobody who does not. Darkens on hover, so it reads as deliberate rather than
   as something left behind by accident. */
.made-by {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: .68rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  /* The sign-in background is dark navy, so this is a light tone held back by
     opacity rather than a grey that would vanish into it entirely. */
  color: #fff;
  opacity: .3;
  transition: opacity .2s var(--ease);
  user-select: none;
}
.made-by:hover { opacity: .72; }

/* A field whose control is optional. The tick sits on the label's own line rather than
   above it, so the cell is one label plus one control like every other cell in the grid
   - a tick on its own line made these two sit a whole row lower than their neighbours.
   The control slot always holds something of the same height, so nothing shifts when
   the box is ticked. */
.label-tick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
/* Both kinds of label must produce the same line box. Left to `normal`, a label
   carrying a tick came out a pixel taller than a plain one and dropped its control a
   pixel below its neighbours' - small, but it is the whole of what "not symmetrical"
   means in a grid. */
.field > span.label, .label-tick, .tick { line-height: 1.35; }
/* Pinned to exactly one line of the label's own type. The tick box is shorter than
   that, so it cannot push the line box a fraction taller and round the control below
   it down a pixel. Both ticked labels are short and single-line by design. */
.label-tick { height: calc(.8rem * 1.35); }
.tick {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  font-size: .74rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
/* Shorter than the label's own line, so adding a tick to a label does not make that
   one label a pixel taller than the rest and drop its control out of line. */
.tick input[type="checkbox"] { width: auto; height: .8rem; margin: 0; }

.field-fallback {
  display: flex;
  align-items: center;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
/* Three columns rather than as many as fit. The employee forms hold nine and eleven
   fields, and at four across that leaves a single field stranded on a row of its own
   with three empty slots beside it. Three divides the nine exactly. */
.form-grid.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { .form-grid.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .form-grid.grid-3 { grid-template-columns: 1fr; } }

/* One height for every control in a form grid, so a row is level whether its cell
   holds a date box, a select, or the note that stands in for one. */
.form-grid .field > input,
.form-grid .field > select,
.form-grid .field > .field-fallback { min-height: 2.35rem; }

/* ---------- Layout rhythm ---------- */
/* Cards that belong together sit in one row and share a baseline, instead of stacking
   into a tall column that leaves most of the page empty. They fall back to stacking
   when there is no longer room for the columns. */
.card-row {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-row > .card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
/* Only where the cards hold the same shape of content. A heading that wraps to two
   lines in one card and one in the next would start the figures below them on
   different lines, so the bodies hang from the bottom instead and the numbers align.
   Applied to a row of lists it would do the opposite - strand short cards under a gap. */
.card-row.stats-row > .card > .card-body { margin-top: auto; }
.card-row.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card-row.cols-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

/* Fields in a grid must hang from a common top edge. Stretching them to equal height
   pushed shorter controls out of line with their neighbours wherever one field carried
   a tick box or a hint and the next did not. */
.form-grid { align-items: start; }

/* Three figures side by side inside a card that is itself one of three: the wide
   padding that suited a full-width card wastes the space here. */
.card-row .stat-grid { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.card-row .stat { padding: .85rem .7rem; text-align: center; }
.card-row .stat .num { font-size: 1.65rem; }
.card-row .stat .label { font-size: .72rem; }

/* ---------- Stat alignment ---------- */
/* In a row of cards the figures must sit on one line across all of them. A label that
   wraps to two lines in one card and one in the next is what tilts the row, so the
   label reserves the taller of the two either way. */
.stat { display: flex; flex-direction: column; }
.stat .label { margin-top: .3rem; }
.card-row .stat .label { min-height: 2.1em; }

/* The meeting topic leads a booking: it is what tells a passer-by whether the room is
   theirs to interrupt. */
.booking-topic {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-top: .15rem;
}

/* ---------- Communication colour ---------- */
/* Colour and shape together. Around one man in twelve cannot separate red from green,
   and a register whose meaning is carried by hue alone is unreadable to them, so the
   shape says the same thing independently. */
.comm {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}
.comm-shape { font-size: .9rem; line-height: 1; }
.comm-red    { color: #b91c1c; }
.comm-blue   { color: #0e6fa8; }
.comm-yellow { color: #9a7000; }
.comm-green  { color: #15803d; }

/* The key on the register page: the same shapes at legend size. */
.legend i.comm-swatch {
  width: auto;
  height: auto;
  font-size: .95rem;
  line-height: 1;
  border-radius: 0;
  background: none;
}

/* ---------- In-page section switch ---------- */
/* For a page with two distinct jobs - your own leave, and administering everyone
   else's - shown only to the people who have both. */
.subnav {
  display: flex;
  gap: .3rem;
  padding: .3rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-alt);
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}
.subnav-btn {
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: .45rem .95rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.subnav-btn:hover { color: var(--text); }
.subnav-btn.active {
  background: var(--surface);
  color: var(--navy-700);
  box-shadow: var(--sh-sm);
}

/* ---------- Adding to the team calendar ---------- */
/* Only the people who may add anything get the affordance, so a day does not look
   clickable to someone it would refuse. */
.cal-day.addable { cursor: pointer; position: relative; }
.cal-day.addable:hover { border-color: var(--navy-500); background: var(--surface); }
.cal-day.addable:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }
/* Visible at rest, not only on hover. Hidden until hovered, the whole feature was
   invisible: the calendar looked exactly like a calendar nobody could edit, and on a
   touch screen there is no hover to reveal it with. */
.cal-add {
  position: absolute;
  top: .15rem; right: .25rem;
  display: grid;
  place-items: center;
  width: 17px; height: 17px;
  border-radius: 5px;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  opacity: .55;
  transition: opacity .12s var(--ease), background .12s var(--ease), color .12s var(--ease);
}
.cal-day.addable:hover .cal-add,
.cal-day.addable:focus-visible .cal-add {
  opacity: 1;
  background: var(--yellow);
  color: var(--navy-800);
  border-color: var(--yellow);
}

/* A pinned note is not an absence, so it does not borrow an absence's colour. */
.cal-event.type-note {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

.day-panel { height: auto; max-height: min(88vh, 100%); width: min(680px, 100%); }
.day-body { overflow-y: auto; padding: 1.35rem; }
.day-existing { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.day-existing h4 { font-size: .86rem; color: var(--text-soft); margin: 0 0 .6rem; }
.day-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.day-note:last-child { border-bottom: 0; }

/* Told in words as well as by the marker, for anyone who does not read a small + as
   an invitation. Shown only to the people who can act on it. */
.cal-edit-hint {
  margin-top: .35rem !important;
  font-size: .84rem;
  color: var(--navy-600);
  font-weight: 600;
}

/* ---------- Several companies on one form ---------- */
/* Someone can work for more than one company, so the choice is a row of tick boxes
   rather than a single select. Same height as the controls beside it in the grid. */
.label-note { font-weight: 500; color: var(--muted); margin-left: .25rem; }
.company-boxes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1rem;
  min-height: 2.35rem;
  padding: .2rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.company-boxes label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}
.company-boxes input[type="checkbox"] { width: auto; margin: 0; }

/* ---------- The calendar day panel's list ---------- */
.day-note > span:first-child { min-width: 0; }
.day-actions { display: inline-flex; gap: .8rem; flex-shrink: 0; }
.day-kind {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: .45rem;
  vertical-align: middle;
}
.day-kind.kind-leave { background: var(--cal-leave); }
.day-kind.kind-note { background: var(--surface-alt); border: 1px solid var(--border-strong); }

/* ---------- Communication type ---------- */
/* The badge is focusable so a tap or the keyboard brings up the same description a
   pointer does. The tooltip is one element on the page, positioned against the badge,
   so a table's scroll box cannot cut it off. */
.comm[data-comm] { cursor: help; border-radius: 4px; }
.comm[data-comm]:focus-visible { outline: 2px solid var(--yellow-dark); outline-offset: 2px; }
.comm-tooltip {
  position: fixed;
  z-index: 90;
  max-width: 300px;
  padding: .65rem .8rem;
  border-radius: var(--r-sm);
  background: var(--navy-800);
  color: #fff;
  box-shadow: var(--sh-lg);
  font-size: .8rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .12s var(--ease), transform .12s var(--ease);
  border-top: 3px solid transparent;
}
.comm-tooltip.show { opacity: 1; transform: none; }
.comm-tooltip.tip-red    { border-top-color: #ef4444; }
.comm-tooltip.tip-blue   { border-top-color: #38a3e0; }
.comm-tooltip.tip-yellow { border-top-color: var(--yellow); }
.comm-tooltip.tip-green  { border-top-color: #22c55e; }
.comm-tip-row { display: flex; flex-direction: column; }
.comm-tip-row + .comm-tip-row { margin-top: .4rem; }
.comm-tip-row > span { font-size: .68rem; font-weight: 600; letter-spacing: .04em; color: #aab6cf; }
.comm-tip-row > b { font-weight: 600; }

/* The key on the register page: each colour with its type and description written out. */
.comm-key {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .9rem;
}
.comm-key-item {
  padding: .8rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-alt);
}
.comm-key-type { font-weight: 700; color: var(--text); font-size: .9rem; margin-top: .35rem; }
.comm-key-traits { font-size: .8rem; color: var(--text-soft); margin-top: .15rem; }

/* ==========================================================================
   MAIN PAGE - the workforce at a glance (home.js)
   ========================================================================== */
/* Chart colours do one job each. --viz-1 is the single series; --viz-2 appears only
   where two things are told apart; --viz-none is "not recorded", grey so a gap in the
   register never reads as data. --viz-1 and --viz-2 are slots 1 and 2 of the validated
   categorical palette: they pass the colour-vision, lightness and 3:1 contrast checks
   against the white card surface. */
:root {
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-none: #c3cad8;
  --viz-grid: #e9edf4;
  --viz-axis: #cfd7e6;
}
.viz-s1 { background: var(--viz-1); }
.viz-s2 { background: var(--viz-2); }
.viz-none { background: var(--viz-none); }

#homeBody { transition: opacity .2s var(--ease); }
#homeBody.is-loading { opacity: .55; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.kpi {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
}
.kpi-label { font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.kpi-value {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy-800);
  letter-spacing: -.02em;
  margin-top: .3rem;
}
.kpi-note { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.kpi-hero { background: var(--navy-800); border-color: var(--navy-800); }
.kpi-hero .kpi-label { color: #aab6cf; }
.kpi-hero .kpi-value { color: #fff; font-size: 3rem; }
.kpi-hero .kpi-note { color: #c9d2e4; }

.viz-card .card-body { display: flex; flex-direction: column; gap: .9rem; }
.viz-toggle { font-size: .8rem; }
.viz-note { font-size: .78rem; color: var(--muted); margin: 0; }
.viz-empty { margin: 0; }
.viz-table .table-wrap { border: 1px solid var(--border); border-radius: var(--r-sm); }

/* Part-to-whole: one bar, its segments parted by a 2px gap in the surface colour. */
.stack-bar {
  display: flex;
  gap: 2px;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: .3rem;
}
.stack-seg { flex-basis: 0; min-width: 4px; cursor: default; }
.stack-seg:hover, .stack-seg:focus-visible { filter: brightness(1.08); outline: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.viz-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.viz-legend li { display: flex; align-items: center; gap: .55rem; font-size: .86rem; color: var(--text-soft); }
.viz-legend li b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.viz-legend li .muted { min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* Columns for the age bands: thin, square at the baseline, rounded at the top, the value
   standing on each one. */
.col-chart {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: .4rem;
  height: 190px;
  padding-top: .2rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--viz-axis);
}
.col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; min-width: 0; outline: none; }
.col-plot { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col-fill { width: 22px; max-width: 70%; border-radius: 4px 4px 0 0; min-height: 2px; transition: filter .12s var(--ease); }
.col-value { font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; font-variant-numeric: tabular-nums; }
.col-label {
  font-size: .72rem;
  color: var(--muted);
  padding-top: .4rem;
  margin-bottom: -1.5rem;
  white-space: nowrap;
}
.col:hover .col-fill, .col:focus-visible .col-fill { filter: brightness(1.1); }
.col:focus-visible .col-label { color: var(--text); font-weight: 700; }

/* Horizontal bars for companies and departments, the value just past the end of each. */
.bar-list { display: flex; flex-direction: column; gap: .55rem; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(70px, 34%) 1fr;
  align-items: center;
  gap: .75rem;
  outline: none;
  border-radius: 4px;
}
.bar-label { font-size: .84rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.bar-fill { height: 14px; border-radius: 0 4px 4px 0; min-width: 2px; transition: filter .12s var(--ease); }
.bar-value { font-size: .8rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.bar-row:hover .bar-fill, .bar-row:focus-visible .bar-fill { filter: brightness(1.1); }
.bar-row:focus-visible .bar-label { color: var(--text); font-weight: 700; }

/* The headcount line. */
.line-chart { width: 100%; }
.line-chart svg { display: block; max-width: 100%; overflow: visible; outline: none; }
.line-chart svg:focus-visible { outline: 2px solid var(--yellow-dark); outline-offset: 4px; border-radius: 4px; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-tick { font-size: 11px; fill: var(--muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.viz-area { fill: var(--viz-1); fill-opacity: .1; stroke: none; }
.viz-line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { fill: var(--viz-1); stroke: var(--surface); stroke-width: 2; }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; }
.viz-end { font-size: 12px; font-weight: 700; fill: var(--text); font-family: var(--font); }

/* One tooltip for every chart: the value leads, what it is follows. */
.viz-tooltip {
  position: fixed;
  z-index: 90;
  min-width: 120px;
  padding: .55rem .75rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s var(--ease);
}
.viz-tooltip.show { opacity: 1; }
.viz-tip-value { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.viz-tip-title { font-size: .78rem; color: var(--text-soft); }
.viz-tip-sub { font-size: .74rem; color: var(--muted); }

@media (max-width: 720px) {
  .kpi-row { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .kpi { padding: .85rem 1rem; }
  .kpi-value { font-size: 1.7rem; }
  .kpi-hero { grid-column: 1 / -1; }
  .kpi-hero .kpi-value { font-size: 2.4rem; }
  /* The hero takes a row of its own, which leaves the last of the other three alone. */
  .kpi-row .kpi:last-child:nth-child(4) { grid-column: 1 / -1; }
  .day-note { flex-wrap: wrap; }
}

/* A second, quieter line inside a table cell - the department under a position. */
.cell-sub { display: block; font-size: .76rem; color: var(--muted); margin-top: .1rem; }
table.data td.nowrap { white-space: nowrap; }
@media (max-width: 720px) { .cell-sub { display: inline; margin-left: .4rem; } }

/* The day panel borrows the document viewer's frame but not its grey mat: that mat is
   there so a white page reads as a page, and under a form it only drowned the labels
   and squeezed the list of the day's entries into the middle. */
.viewer-body.day-body { background: var(--surface); display: block; place-items: normal; }

/* ---------- Audit log ---------- */
.audit-filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.audit-detail { font-size: .78rem; color: var(--muted); max-width: 420px; }
.audit-more { text-align: center; border-top: 1px solid var(--border); }

/* A leave entry that was cancelled: kept in the history, out of every count. */
.badge.cancelled { background: var(--grey-bg); color: var(--muted); text-decoration: line-through; }

/* ---------- Personal file: companies, and several files per slot ---------- */
/* The company switcher sits on the right of the file's heading. */
.company-switch { display: flex; align-items: center; gap: .5rem; margin: 0; }
.company-switch .label { font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.company-switch select { min-width: 10rem; }

/* Which company a slot or document is for. */
.co-tag {
  display: inline-block;
  padding: .05rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--navy-500);
  color: var(--navy-700);
  font-size: .72rem;
  font-weight: 600;
  vertical-align: middle;
}

/* An annex or amendment, set in under its main contract. */
tr.file-child td[data-label="ფაილი"] { padding-left: 2rem; }
.child-mark { color: var(--muted); margin-right: .35rem; }
.kind-badge { margin-right: .25rem; }
.file-kind { white-space: nowrap; }
/* Up to three actions on a file; they wrap rather than push the table wider. */
table.data td.row-actions .btn-link { display: inline-block; margin: .1rem .8rem .1rem 0; }
table.data td.row-actions .btn-link + .btn-link { margin-left: 0; }

/* "Adding annexes to: contract.pdf" above the upload form. */
.attach-note {
  margin-bottom: 1rem;
  padding: .6rem .85rem;
  border-radius: 8px;
  background: var(--yellow-soft);
  font-size: .85rem;
}
.attach-note .btn-link { margin-left: .6rem; }

.details-editor { border-top: 1px solid var(--border); background: var(--surface-alt); }
.details-editor-title { margin: 0 0 .8rem; font-weight: 600; color: var(--navy-800); }

@media (max-width: 720px) {
  tr.file-child td[data-label="ფაილი"] { padding-left: 1rem; }
  /* On a phone the badge keeps its line and the file name wraps under it. */
  .file-cell { flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .file-cell .file-kind { display: inline-block; }
  .file-cell .btn-link { text-align: right; }
  .company-switch { width: 100%; }
  .company-switch select { flex: 1; }
}

/* Why a leave request was turned down, under its status badge. */
.rejection-note { margin-top: .3rem; white-space: normal; }
/* "Not employed then" under a cycle that ended before the person joined. */
.not-employed { font-size: .8rem; white-space: normal; }

@media (max-width: 720px) {
  /* On a phone the status cell is a flex row (label, then value), which squeezed the
     reason into a narrow column beside the badge. It wraps instead: label and badge
     on the first line, the reason on a full-width line of its own beneath them. */
  table.data td.leave-status { flex-wrap: wrap; row-gap: .3rem; }
  table.data td.leave-status .rejection-note { flex: 1 0 100%; margin-top: 0; text-align: left; }
  /* The same for the "not employed then" note under a balance's cycle. */
  table.data td:has(> .not-employed) { flex-wrap: wrap; row-gap: .2rem; }
  table.data td .not-employed { flex: 1 0 100%; text-align: right; }
}
