/* ATRA HR Panel.

   Shares the navy masthead with the Transport Panel so the two read as one
   company, but the working colour is moss rather than teal: with both open in
   adjacent tabs you can tell at a glance which one you are typing into.

   Expiry is the thing this panel exists to surface, so urgency is carried by a
   left rule plus a written label, never by colour on its own. */

:root {
  --ink: #16241f;
  --ink-soft: #5c6f68;
  --paper: #f7f8f6;
  --card: #ffffff;
  --line: #e0e5e1;
  --navy: #12343b;
  --moss: #3f6b52;
  --moss-deep: #335844;
  --moss-soft: #e6efe9;
  --expired: #a4262c;
  --soon: #8a5a00;
  --steady: #2c6e49;
  --radius-lg: 14px;
  --radius-sm: 8px;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--moss); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--moss);
  outline-offset: 2px;
}

/* ---------- Shell ---------- */

.masthead {
  background: var(--navy);
  color: #eef5f3;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.masthead__brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-decoration: none;
}
.masthead__brand span { color: #8fc4a8; font-weight: 400; }
.masthead nav { display: flex; gap: 20px; flex-wrap: wrap; }
.masthead nav a {
  color: #d3e5dc;
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: #ffffff; }
.masthead nav a[aria-current="page"] { color: #ffffff; border-bottom-color: #8fc4a8; }
.masthead__user { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.masthead__user a { color: #d3e5dc; }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 72px; }
.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page__head h1 { margin: 0; font-size: 27px; font-weight: 600; }
.page__head p { margin: 4px 0 0; color: var(--ink-soft); }

/* ---------- Cards, stats, tables ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card > h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.card__note { color: var(--ink-soft); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat__value { font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat__label { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.stat--expired .stat__value { color: var(--expired); }
.stat--soon .stat__value { color: var(--soon); }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-weight: 600; color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.row-flag { border-left: 4px solid transparent; }
.row-flag--expired { border-left-color: var(--expired); }
.row-flag--critical { border-left-color: var(--soon); }
.row-flag--due-soon { border-left-color: var(--moss); }

/* ---------- Tags ---------- */

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid;
}
.tag--expired { color: var(--expired); border-color: #eccdcf; background: #fdf3f4; }
.tag--critical { color: var(--soon); border-color: #ecdcc0; background: #fdf8f0; }
.tag--due-soon { color: var(--moss); border-color: #c8ddd0; background: var(--moss-soft); }
.tag--ok { color: var(--steady); border-color: #cbe0d3; background: #f1f8f4; }
.tag--muted { color: var(--ink-soft); border-color: var(--line); background: var(--paper); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: 14px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field input[type="number"], .field input[type="file"],
.field select, .field textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.field textarea { min-height: 110px; resize: vertical; }
.field--check { flex-direction: row; align-items: center; gap: 9px; }
.field--check label { font-weight: 500; }
.field__hint { color: var(--ink-soft); font-size: 13px; }
.field__error { color: var(--expired); font-size: 13px; }

.fieldset-title {
  margin: 26px 0 12px;
  font-size: 15px;
  font-weight: 600;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.fieldset-title:first-of-type { margin-top: 0; }

.actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--moss);
  background: var(--moss);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--moss-deep); }
.btn--quiet { background: #fff; color: var(--moss); }
.btn--quiet:hover { background: var(--moss-soft); }
.btn--danger { background: #fff; color: var(--expired); border-color: #e2bdbf; }
.btn--danger:hover { background: #fdf3f4; }
.btn--small { padding: 5px 12px; font-size: 13.5px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select, .filters input[type="search"], .filters input[type="date"] {
  font: inherit; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}

/* ---------- Flashes, empties, definitions ---------- */

.flashes { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); border-left: 4px solid; }
.flash--success { background: #f1f8f4; border-color: var(--steady); }
.flash--error { background: #fdf3f4; border-color: var(--expired); }

.empty { padding: 26px 10px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.definition { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 22px; }
.definition div { display: flex; flex-direction: column; }
.definition dt { color: var(--ink-soft); font-size: 13.5px; }
.definition dd { margin: 0; font-weight: 500; }

.person { font-weight: 600; text-decoration: none; color: var(--navy); }
.sensitive { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* ---------- Sign in ---------- */

.signin { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.signin__card { background: #fff; border-radius: var(--radius-lg); padding: 34px; width: 100%; max-width: 400px; }
.signin__card h1 { margin: 0 0 6px; font-size: 23px; }
.signin__card p { margin: 0 0 22px; color: var(--ink-soft); }
.signin__card .btn { width: 100%; }

@media (max-width: 640px) {
  .page { padding: 20px 16px 60px; }
  .masthead { padding: 12px 16px; gap: 14px; }
  .masthead__user { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Department dialogs ---------- */

.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.dept-card {
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--moss);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  color: inherit;
}
.dept-card:hover { background: var(--moss-soft); }
.dept-card__count { font-size: 25px; font-weight: 600; line-height: 1.1; }
.dept-card__name { font-weight: 600; margin-top: 2px; }
.dept-card__meta { color: var(--ink-soft); font-size: 13.5px; }
.dept-card--empty { border-left-color: var(--line); }
.dept-card--empty .dept-card__count { color: var(--ink-soft); }

dialog.sheet {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(680px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  color: var(--ink);
  background: var(--card);
}
dialog.sheet::backdrop { background: rgba(18, 52, 59, 0.55); }
.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet__head h2 { margin: 0; font-size: 18px; }
.sheet__head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.sheet__body { padding: 6px 22px 22px; overflow: auto; max-height: 60vh; }
