/* Fidelity HRMS admin — teal look from the approved app prototype. */
:root {
  --teal: #0e5a55;
  --teal-dark: #0a403c;
  --teal-tint: #e3efec;
  --ground: #f3f4f1;
  --card: #ffffff;
  --ink: #16201f;
  --muted: #5b6664;
  --line: #dde1dc;
  --field: #c9cfc8;
  --good: #1b6e43;
  --good-tint: #e1f1e7;
  --warn: #8a5200;
  --warn-tint: #fbefd9;
  --bad: #a3272b;
  --bad-tint: #f8e1e1;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid var(--line); }
.brand img { width: 40px; height: 32px; object-fit: contain; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--ground); }
.nav a.active { background: var(--teal-tint); color: var(--teal-dark); font-weight: 600; }
/* Expandable modules */
.nav details.module { border-radius: 8px; }
.nav details.module > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-weight: 600; color: var(--ink); user-select: none; }
.nav details.module > summary::-webkit-details-marker { display: none; }
.nav details.module > summary::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.nav details.module[open] > summary::after { transform: rotate(45deg); }
.nav details.module > summary:hover { background: var(--ground); }
.nav details.module > summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.nav details.module > a { padding-left: 22px; }
.nav details.module[open] { padding-bottom: 4px; }
.nav .count { margin-left: auto; background: var(--warn-tint); color: var(--warn); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.side .foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.side .foot b { display: block; }
.side .foot .links { display: flex; gap: 12px; margin-top: 6px; }
.main { flex: 1 1 auto; min-width: 0; padding: 24px 28px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .side { display: none; }
  .mobile-nav { display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .mobile-nav img { width: 34px; }
  .mobile-nav select { flex: 1; }
  .main { padding: 16px; }
}

/* Surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--field); background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--bad); }
.btn.link { border: 0; background: none; padding: 0 4px; min-height: 28px; color: var(--teal); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time], input[type=search], select, textarea {
  border: 1px solid var(--field); border-radius: 10px; padding: 8px 10px; background: #fff; min-height: 38px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar .field { min-width: 150px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; color: var(--muted); }
.tabs button.on { color: var(--teal-dark); border-color: var(--teal); }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid #ecefea; text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbf9; position: sticky; top: 0; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f7f9f6; }

/* Chips */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #ecefea; color: #3e4846; white-space: nowrap; margin: 1px 2px 1px 0; }
.chip.good { background: var(--good-tint); color: var(--good); }
.chip.warn { background: var(--warn-tint); color: var(--warn); }
.chip.bad { background: var(--bad-tint); color: var(--bad); }
.chip.teal { background: var(--teal-tint); color: var(--teal-dark); }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar .top { display: flex; justify-content: space-between; font-size: 13px; }
.bar .track { height: 10px; background: #ecefea; border-radius: 5px; margin-top: 4px; }
.bar .fill { height: 10px; background: var(--teal); border-radius: 5px; }

/* Modal / drawer */
.overlay { position: fixed; inset: 0; background: rgba(22, 32, 31, .35); display: flex; justify-content: flex-end; z-index: 20; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.drawer { background: #fff; width: min(640px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.08); }
.dialog { background: #fff; width: min(460px, 100%); border-radius: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.drawer header, .dialog header { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2, .dialog header h2 { margin: 0; flex: 1; }
.drawer .body, .dialog .body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer footer, .dialog footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; }
.close:hover { background: var(--ground); }

/* Toasts */
#toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--teal-dark); color: #fff; padding: 10px 14px; border-radius: 10px; max-width: 360px; box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.toast.error { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login .logo { width: 150px; margin: 0 auto; display: block; }
.login h1 { text-align: center; }
.login p { margin: 0; text-align: center; color: var(--muted); }

.notice { padding: 10px 12px; border-radius: 10px; background: var(--teal-tint); color: var(--teal-dark); font-size: 13px; }
.notice.warn { background: var(--warn-tint); color: var(--warn); }
.notice.bad { background: var(--bad-tint); color: var(--bad); }
.secret { font: 600 22px/1.2 ui-monospace, monospace; letter-spacing: .06em; padding: 12px; text-align: center; background: var(--ground); border-radius: 10px; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline .step { display: flex; gap: 10px; }
.timeline .dot { width: 12px; height: 12px; border-radius: 6px; margin-top: 4px; flex: none; background: var(--field); }
.timeline .dot.APPROVED { background: var(--teal); }
.timeline .dot.PENDING { background: #e8a33d; }
.timeline .dot.REJECTED { background: var(--bad); }
.timeline .dot.RETURNED { background: #e8a33d; }

/* ---------- Support desk ---------- */
.brand { position: relative; }
.bell { margin-left: auto; position: relative; background: none; border: 0; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; }
.bell:hover { background: var(--teal-tint); }
.bell-count { position: absolute; top: -2px; right: -4px; background: #b42323; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 5px; line-height: 1.3; }
.notifs { list-style: none; margin: 0; padding: 0; }
.notifs li button { display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line, #dde1dc); padding: 10px 4px; cursor: pointer; font: inherit; color: inherit; }
.notifs li.unread button { background: var(--teal-tint); }
.notifs li button:hover { background: #f3f4f1; }
.prio { display: inline-block; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 1px 6px; }
.prio.P1 { background: #fde2e2; color: #8f1b1b; } .prio.P2 { background: #fdebd3; color: #8a4b0a; }
.prio.P3 { background: var(--teal-tint); color: var(--teal-dark); } .prio.P4 { background: #eef0ec; color: #4b5553; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.section-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #5b6664); margin: 18px 0 6px; font-weight: 700; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; margin: 0; }
.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #5b6664); }
.kv dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos a { display: block; border-radius: 8px; overflow: hidden; background: #eef0ec; aspect-ratio: 4 / 3; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.events { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--teal-tint); }
.events li { padding: 4px 0 8px 12px; position: relative; }
.events li::before { content: ''; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.update { border: 1px solid var(--line, #dde1dc); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.pad-wrap { position: relative; border: 1px dashed #9aa5a2; border-radius: 10px; background: #fff; height: 170px; touch-action: none; }
.pad-wrap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.pad-wrap .hint { position: absolute; inset: auto 0 10px; text-align: center; color: #9aa5a2; pointer-events: none; }
.lines-edit .line { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.drawer.wide { width: min(880px, 100vw); }

/* Users and access rights */
.access-mod { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.access-mod > label.check { font-weight: 600; }
.access-mod .pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; margin: 6px 0 0 24px; }
.side .foot.tally-line { margin-top: auto; padding: 8px 16px; }
.side .foot.tally-line + .foot { margin-top: 0; }
.side .foot.tally-line a { color: var(--ink); text-decoration: none; font-size: 13px; }
.view-as-banner { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 16px; background: var(--warn-tint); color: var(--warn); border-bottom: 1px solid #e8c88f; }
