/* Meridian HR — design system
   One accent (Signal), muted status tones, hairline structure.
   The renewal horizon on the dashboard is the only glowing element. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #080a0f;
  --surface: #0e1117;
  --raised: #141821;
  --field: #0b0e14;
  --hover: rgba(142, 162, 255, 0.05);
  --line: rgba(160, 174, 205, 0.09);
  --line-strong: rgba(160, 174, 205, 0.16);
  --text: #e6eaf2;
  --text-2: #a7afbf;
  --muted: #6d7588;
  --accent: #8ea2ff;
  --accent-strong: #a9b8ff;
  --accent-ink: #0a0f26;
  --accent-soft: rgba(142, 162, 255, 0.12);
  --accent-line: rgba(142, 162, 255, 0.35);
  --ok: #72c7a2;
  --ok-soft: rgba(114, 199, 162, 0.12);
  --warn: #e5b56e;
  --warn-soft: rgba(229, 181, 110, 0.12);
  --danger: #f08b80;
  --danger-soft: rgba(240, 139, 128, 0.12);
  --neutral-soft: rgba(160, 174, 205, 0.1);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  --radius-s: 8px;
  --radius: 10px;
  --radius-l: 16px;
  --sidebar: 252px;
  --font: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --raised: #f7f8fa;
  --field: #ffffff;
  --hover: rgba(66, 87, 214, 0.04);
  --line: rgba(20, 28, 48, 0.08);
  --line-strong: rgba(20, 28, 48, 0.15);
  --text: #0d111a;
  --text-2: #4d5566;
  --muted: #7c8495;
  --accent: #4257d6;
  --accent-strong: #3246c4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(66, 87, 214, 0.09);
  --accent-line: rgba(66, 87, 214, 0.35);
  --ok: #1c8a5b;
  --ok-soft: rgba(28, 138, 91, 0.1);
  --warn: #a8660a;
  --warn-soft: rgba(196, 128, 20, 0.12);
  --danger: #c2372b;
  --danger-soft: rgba(194, 55, 43, 0.09);
  --neutral-soft: rgba(20, 28, 48, 0.06);
  --shadow: 0 24px 60px -24px rgba(20, 28, 48, 0.25);
}

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

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }
fieldset { min-width: 0; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

.muted { color: var(--muted); }
.soft { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px 12px;
  overflow-y: auto; scrollbar-width: thin;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line-strong); color: var(--accent); }
.brand-mark svg { width: 20px; height: 20px; }
.brand strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.brand span { display: block; font-size: 12px; color: var(--muted); }

.nav { display: grid; gap: 1px; }
.nav-group { padding: 16px 10px 6px; font-size: 12px; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-s);
  color: var(--text-2); font-size: 13.5px; font-weight: 450;
}
.nav a .i { color: var(--muted); }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a:hover .i { color: var(--text-2); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .i { color: var(--accent); }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; height: 18px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); }
.me a { flex: 1; min-width: 0; }
.me strong { display: block; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { display: block; font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  flex: 0 1 440px; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); font-size: 13.5px; text-align: left;
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-trigger span { flex: 1; }
kbd { font: 500 11px/1 var(--font); padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--line); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.menu-btn { display: none; }

.ask-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 12px;
  border-radius: var(--radius); border: 1px solid var(--accent-line);
  background: var(--accent-soft); color: var(--text); font-size: 13.5px; font-weight: 500;
}
.ask-btn .i { color: var(--accent); }
.ask-btn:hover { border-color: var(--accent); }

.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 30px 32px 64px; }

/* ---------- Page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.025em; }
.page-head p { margin-top: 6px; color: var(--text-2); max-width: 68ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn .i { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--hover); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-s); }
.btn-block { width: 100%; height: 44px; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }

/* ---------- Panels ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; }
.panel-head h2 { font-size: 15px; }
.panel-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 0 20px 20px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.link-more { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.link-more:hover { color: var(--accent-strong); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .panel + .panel { margin-top: 0; }
.grid-eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-eq > .panel + .panel { margin-top: 0; }

/* Metric strip: one panel, cells divided by hairlines */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); margin-bottom: 16px; overflow: hidden; }
.metric { padding: 16px 20px; border-left: 1px solid var(--line); display: block; }
.metric:first-child { border-left: 0; }
a.metric:hover { background: var(--hover); color: inherit; }
.metric b { display: block; font-size: 26px; font-weight: 550; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.metric.is-active { background: var(--accent-soft); }
.metric.tone-danger b { color: var(--danger); }
.metric.tone-warn b { color: var(--warn); }
.metric.tone-ok b { color: var(--ok); }

/* ---------- Badges ---------- */

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); }
.badge.tone-ok { background: var(--ok-soft); color: var(--ok); }
.badge.tone-warn { background: var(--warn-soft); color: var(--warn); }
.badge.tone-danger { background: var(--danger-soft); color: var(--danger); }
.badge.tone-accent { background: var(--accent-soft); color: var(--accent-strong); }
.date-cell { display: inline-flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.date-cell > span:first-child { font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-title { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.row-link { display: flex; align-items: center; gap: 12px; }
.row-actions { display: inline-flex; gap: 2px; opacity: .55; transition: opacity .15s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }

/* ---------- Toolbar & filters ---------- */

.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1 1 260px; }
.toolbar .search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar .search input { padding-left: 38px; }
.toolbar select { width: auto; min-width: 150px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .page-actions { gap: 6px; }

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

label, .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url],
input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
:root:not([data-theme="light"]) input[type=date]::-webkit-calendar-picker-indicator,
:root:not([data-theme="light"]) input[type=time]::-webkit-calendar-picker-indicator { filter: invert(1); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.req { color: var(--danger); margin-left: 2px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line); }
.form-actions .spacer { flex: 1; }
.form-section { padding: 20px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section h3 { font-size: 14px; margin-bottom: 4px; }
.form-section > p { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text); cursor: pointer; margin: 0; font-weight: 400; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.seg label, .seg button { margin: 0; height: 30px; padding: 0 11px; display: grid; place-items: center; border-radius: 7px; border: 0; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

/* ---------- Lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.list li > .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list a.grow:hover .title { color: var(--accent-strong); }
.when { font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.when.tone-danger { color: var(--danger); }
.when.tone-warn { color: var(--warn); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 28px; height: 28px; margin: 0 auto 12px; color: var(--muted); opacity: .7; }
.empty strong { display: block; color: var(--text); font-weight: 550; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); overflow: hidden; }
dl.facts > div { padding: 14px 20px; border-top: 1px solid var(--line); margin-top: -1px; }
dl.facts dt { font-size: 12.5px; color: var(--muted); }
dl.facts dd { margin: 3px 0 0; font-weight: 500; }

/* ---------- Dashboard ---------- */

.greeting h1 { font-size: 28px; }

.horizon { padding: 20px 22px 22px; margin-bottom: 16px; position: relative; overflow: hidden; }
.horizon-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.horizon-head h2 { font-size: 15px; }
.horizon-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.horizon-figures { display: flex; gap: 28px; }
.horizon-figures div { text-align: right; }
.horizon-figures b { display: block; font-size: 24px; font-weight: 550; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.horizon-figures span { font-size: 12px; color: var(--muted); }
.horizon-figures .f-danger b { color: var(--danger); }
.horizon-figures .f-accent b { color: var(--accent-strong); }

.track { position: relative; height: 112px; margin: 0 4px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, var(--danger-soft), var(--line-strong) 13%, var(--line-strong) 90%, transparent); }
.track-overdue { position: absolute; left: 0; top: 8px; bottom: 26px; width: 11%; border-radius: 10px; background: linear-gradient(90deg, var(--danger-soft), transparent); }
.track-window { position: absolute; top: 4px; bottom: 22px; left: 12%; border-radius: 10px; background: linear-gradient(90deg, var(--accent-soft), transparent 95%); border-left: 1px solid var(--accent-line); }
.track-window::after { content: attr(data-label); position: absolute; right: 8px; top: 6px; font-size: 11.5px; color: var(--accent-strong); opacity: .85; white-space: nowrap; }
.tick { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tick::before { content: ""; position: absolute; left: 50%; bottom: 20px; width: 1px; height: 8px; background: var(--line-strong); }
.tick.first { transform: none; }
.tick.first::before { left: 0; }
.blip {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--surface), 0 0 14px 2px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .15s;
}
.blip.r-expired { background: var(--danger); box-shadow: 0 0 0 3px var(--surface), 0 0 14px 2px color-mix(in srgb, var(--danger) 50%, transparent); }
.blip.r-later { background: var(--muted); box-shadow: 0 0 0 3px var(--surface); }
.blip:hover, .blip:focus-visible { transform: scale(1.5); z-index: 3; }
.blip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: 7px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 12px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; box-shadow: var(--shadow);
}
.blip:hover::after, .blip:focus-visible::after { opacity: 1; }
.horizon-empty { position: absolute; left: 12%; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: var(--muted); font-size: 13px; background: var(--surface); padding: 4px; }

.att-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--neutral-soft); margin: 4px 0 14px; }
.att-bar i { display: block; height: 100%; }
.att-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px 14px; font-size: 13px; }
.att-legend span { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.att-legend b { margin-left: auto; font-weight: 550; color: var(--text); font-variant-numeric: tabular-nums; }
.sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.c-present { background: var(--ok); } .c-late { background: var(--warn); } .c-absent { background: var(--danger); }
.c-on_leave { background: var(--accent); } .c-remote { background: color-mix(in srgb, var(--accent) 55%, var(--ok)); } .c-unmarked { background: var(--line-strong); }

.prio { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--muted); }
.prio.p-high { background: var(--danger); } .prio.p-medium { background: var(--warn); } .prio.p-low { background: var(--ok); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13px; }
.chip .i { width: 14px; height: 14px; color: var(--accent); }
.chip:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }

/* ---------- Employee profile ---------- */

.profile-head { display: flex; gap: 18px; align-items: center; padding: 22px; }
.profile-head h1 { font-size: 24px; }
.profile-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; color: var(--text-2); font-size: 13.5px; }
.profile-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.meter { height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Attendance roster ---------- */

.roster-row td { padding-top: 10px; padding-bottom: 10px; }
.roster-row .seg label { padding: 0 9px; }
.roster-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; }
.roster-row.saving { opacity: .6; }
.roster-row input[type=time] { width: 128px; height: 34px; }
.seg label.t-ok:has(input:checked) { color: var(--ok); background: var(--ok-soft); box-shadow: none; }
.seg label.t-warn:has(input:checked) { color: var(--warn); background: var(--warn-soft); box-shadow: none; }
.seg label.t-danger:has(input:checked) { color: var(--danger); background: var(--danger-soft); box-shadow: none; }
.seg label.t-accent:has(input:checked) { color: var(--accent-strong); background: var(--accent-soft); box-shadow: none; }
.leave-hint { font-size: 12px; color: var(--accent-strong); }

/* ---------- Candidates ---------- */

.score { display: inline-flex; align-items: center; gap: 10px; }
.score-ring { --v: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(var(--c, var(--accent)) calc(var(--v) * 1%), var(--neutral-soft) 0); }
.score-ring.lg { width: 76px; height: 76px; font-size: 18px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; }
.kw span { font-size: 12px; padding: 3px 9px; border-radius: 11px; }
.kw .hit { background: var(--ok-soft); color: var(--ok); }
.kw .miss { background: var(--danger-soft); color: var(--danger); }
.dropzone { border: 1px dashed var(--line-strong); border-radius: var(--radius-l); padding: 22px; text-align: center; background: var(--field); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .i { margin: 0 auto 8px; color: var(--accent); width: 22px; height: 22px; }
.dropzone strong { display: block; font-weight: 550; }
.dropzone small { color: var(--muted); }
.dropzone input { display: none; }
.dropzone.ready { border-style: solid; border-color: var(--ok); }

/* ---------- Tools ---------- */

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.tool { background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-height: 150px; position: relative; }
.tool:hover { background: var(--raised); }
.tool-top { display: flex; align-items: center; gap: 12px; }
.monogram { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--raised); border: 1px solid var(--line-strong); color: var(--text-2); }
.tool h3 { font-size: 14.5px; }
.tool .cat { font-size: 12px; color: var(--muted); }
.tool p { font-size: 13px; color: var(--text-2); flex: 1; }
.tool-foot { display: flex; align-items: center; justify-content: space-between; }
.tool-open { font-size: 13px; color: var(--accent-strong); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.tool-open::after { content: ""; position: absolute; inset: 0; }
.tool-foot .row-actions { position: relative; z-index: 1; }

/* ---------- Markdown (AI output) ---------- */

.md { line-height: 1.6; overflow-wrap: anywhere; }
.md > * + * { margin-top: .7em; }
.md h3, .md h4 { font-size: 14px; margin-top: 1.1em; }
.md ul, .md ol { padding-left: 1.2em; margin: .5em 0; }
.md li + li { margin-top: .25em; }
.md code { font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--neutral-soft); }
.md pre { padding: 12px; border-radius: var(--radius); background: var(--field); border: 1px solid var(--line); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { font-size: 13px; border: 1px solid var(--line); border-radius: 8px; display: block; overflow-x: auto; }
.md th, .md td { padding: 7px 10px; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 2px solid var(--accent-line); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line); }

/* ---------- AI panel ---------- */

.ai-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transform: translateX(102%); transition: transform .28s cubic-bezier(.2,.8,.2,1); visibility: hidden;
}
.ai-panel.open { transform: none; visibility: visible; }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.ai-orb { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); flex: none; }
.ai-head h2 { font-size: 14.5px; }
.ai-head p { font-size: 12px; color: var(--muted); }
.ai-head .grow { flex: 1; min-width: 0; }
.ai-body { flex: 1; overflow-y: auto; padding: 20px; scroll-behavior: smooth; }
.ai-intro h3 { font-size: 18px; letter-spacing: -0.02em; margin-bottom: 6px; }
.ai-intro p { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; }
.ai-intro .chips { flex-direction: column; align-items: stretch; }
.ai-intro .chip { height: auto; min-height: 38px; padding: 8px 12px; border-radius: var(--radius); text-align: left; justify-content: flex-start; }
.msg { margin-bottom: 18px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user div { max-width: 86%; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-ai { display: flex; gap: 10px; }
.msg-ai .ai-orb { width: 26px; height: 26px; border-radius: 8px; }
.msg-ai .ai-orb .i { width: 14px; height: 14px; }
.msg-ai .md { flex: 1; min-width: 0; padding-top: 2px; }
.msg-tools { display: flex; gap: 4px; margin-top: 8px; }
.msg-tools button { height: 26px; padding: 0 8px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.msg-tools button:hover { background: var(--hover); color: var(--text); }
.msg-err { color: var(--danger); font-size: 13px; padding: 10px 12px; border-radius: var(--radius); background: var(--danger-soft); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.ai-input { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--field); }
.ai-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-input textarea { border: 0; background: transparent; box-shadow: none !important; min-height: 24px; max-height: 180px; padding: 7px 0; resize: none; }
.ai-input .btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; flex: none; }
.ai-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; text-align: center; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(4, 6, 10, 0.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Command palette ---------- */

.palette { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(4, 6, 10, 0.55); backdrop-filter: blur(4px); }
.palette-box { width: min(620px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-l); box-shadow: var(--shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input .i { color: var(--muted); }
.palette-input input { border: 0; background: transparent; height: 54px; font-size: 15px; box-shadow: none !important; padding: 0; }
.palette-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s); cursor: pointer; }
.palette-item .i { color: var(--muted); }
.palette-item small { color: var(--muted); margin-left: auto; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.palette-item.sel { background: var(--accent-soft); }
.palette-item.sel .i { color: var(--accent); }
.palette-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- Toasts & dialogs ---------- */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 13.5px; animation: toast-in .25s ease-out; }
.toast .i { margin-top: 1px; }
.toast.t-success .i { color: var(--ok); }
.toast.t-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line-strong)); }
.toast.t-error .i { color: var(--danger); }
.toast.t-info .i { color: var(--accent); }
.toast button { margin-left: auto; border: 0; background: none; color: var(--muted); padding: 0 0 0 8px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog { border: 1px solid var(--line-strong); border-radius: var(--radius-l); background: var(--surface); color: var(--text); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4, 6, 10, 0.6); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 4px; }
.dialog-head h2 { font-size: 16px; }
.dialog-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.dialog-body { padding: 16px 20px 20px; }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--raised); font-size: 13.5px; color: var(--text-2); }
.notice .i { color: var(--accent); margin-top: 1px; }
.notice.warn .i { color: var(--warn); }
.notice strong { color: var(--text); font-weight: 550; }

/* ---------- Bare layout: sign in & setup ---------- */

.bare { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; position: relative; overflow: hidden; }
.bare::before {
  content: ""; position: absolute; width: 1200px; height: 1200px; left: 50%; top: -760px; transform: translateX(-50%);
  border-radius: 50%; border: 1px solid var(--line-strong);
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  mask-image: linear-gradient(180deg, transparent 45%, #000 70%, transparent 100%);
  pointer-events: none;
}
.auth-card { position: relative; width: min(420px, 100%); }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }
.auth-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 18px; }
.auth-brand .brand-mark svg { width: 26px; height: 26px; }
.auth-brand h1 { font-size: 24px; letter-spacing: -0.025em; }
.auth-brand p { color: var(--text-2); margin-top: 6px; }
.auth-card .panel { padding: 24px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 28px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; }
.pw-toggle:hover { color: var(--text); background: var(--hover); }
.strength { display: flex; gap: 4px; margin-top: 8px; }
.strength i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-strong); transition: background .2s; }
.strength[data-s="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-s="3"] i:nth-child(-n+3) { background: var(--ok); }
.strength[data-s="4"] i { background: var(--ok); }

.setup { position: relative; width: min(980px, 100%); display: grid; grid-template-columns: 280px minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.setup-side { padding: 28px 24px; border-right: 1px solid var(--line); background: var(--raised); display: flex; flex-direction: column; }
.setup-side .brand { padding: 0 0 28px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius); color: var(--muted); font-size: 13.5px; }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.steps li.on { color: var(--text); background: var(--surface); }
.steps li.on::before { border-color: var(--accent); color: var(--accent); }
.steps li.done { color: var(--text-2); }
.steps li.done::before { content: "✓"; background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.setup-side .foot { margin-top: auto; font-size: 12.5px; color: var(--muted); padding-top: 24px; }
.setup-main { padding: 32px 36px; display: flex; flex-direction: column; min-height: 580px; }
.setup-main h2 { font-size: 22px; letter-spacing: -0.02em; }
.setup-main .lead { color: var(--text-2); margin: 6px 0 24px; max-width: 62ch; }
.setup-step { display: none; flex: 1; }
.setup-step.on { display: block; animation: toast-in .25s ease-out; }
.setup-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--line); }
.checklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; }
.checklist .st.ok { background: var(--ok-soft); color: var(--ok); }
.checklist .st.bad { background: var(--danger-soft); color: var(--danger); }
.checklist .st.warn { background: var(--warn-soft); color: var(--warn); }
.checklist .grow { flex: 1; }
.checklist small { display: block; color: var(--muted); font-size: 12.5px; }
.db-status { margin-top: 16px; font-size: 13.5px; min-height: 22px; }
.db-status.ok { color: var(--ok); } .db-status.bad { color: var(--danger); }

.error-page { text-align: center; max-width: 440px; }
.error-page .code { font-size: 64px; font-weight: 600; letter-spacing: -0.05em; color: var(--accent); line-height: 1; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.error-page p { color: var(--text-2); margin: 10px 0 22px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > .panel + .panel { margin-top: 0; }
}

@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 58; width: var(--sidebar); transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 22px 16px 56px; }
  .setup { grid-template-columns: 1fr; }
  .setup-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .steps { grid-template-columns: repeat(4, auto); overflow-x: auto; }
  .steps li span { display: none; }
  .setup-side .foot { display: none; }
}

@media (max-width: 720px) {
  .form-grid, .grid-eq { grid-template-columns: minmax(0, 1fr); }
  .search-trigger span, .search-trigger kbd, .ask-btn span { display: none; }
  .search-trigger { flex: 0 0 38px; padding: 0; justify-content: center; }
  .ask-btn { padding: 0 11px; }
  .page-head h1 { font-size: 22px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(odd) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .horizon-figures { gap: 18px; }
  .track-window::after, .tick.first { display: none; }
  .horizon-head { margin-bottom: 18px; }
  .profile-head { flex-wrap: wrap; }
  .profile-head .actions { margin-left: 0; width: 100%; }
  .setup-main { padding: 24px 20px; }
  .row-actions { opacity: 1; }
}

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

@media print {
  .sidebar, .topbar, .page-actions, .row-actions, .ai-panel, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
}

/* Inputs that sit inside a styled wrapper show focus on the wrapper instead */
.ai-input textarea:focus-visible, .palette-input input:focus-visible { outline: none; }
