:root {
  --ink: #15283c;
  --navy: #061b2a;
  --navy-soft: #0b2b3f;
  --gold: #d9a441;
  --gold-bright: #f7ce73;
  --muted: #8492a6;
  --line: #e7edf5;
  --paper: #f5f7fb;
  --card: #ffffff;
  --green: #1aa053;
  --red: #c03221;
  --amber: #f16a1b;
  --blue: #3a57e8;
  --cyan: #08b5dd;
  --coral: #ff7a59;
  --lavender: #8f7cff;
  --shadow: 0 10px 30px rgba(21, 40, 60, 0.08);
  --chart-col-width: 92px;
  --chart-height: 300px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Verdana, Geneva, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(58, 87, 232, 0.09), transparent 24rem),
    radial-gradient(circle at 82% 2%, rgba(217, 164, 65, 0.16), transparent 22rem),
    linear-gradient(135deg, #f5f7fb 0%, #eef3f9 100%);
}

button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: wait; opacity: 0.62; }
.shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
body:not(.authenticated) .shell { display: none; }
body.authenticated .login-screen { display: none; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); display: grid; gap: 14px; padding: 34px; border-radius: 24px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(21, 40, 60, 0.14); }
.login-card .brand-mark { margin-bottom: 4px; }
.login-card h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.05; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.login-card small { color: var(--muted); font-weight: 800; }
.sidebar { padding: 24px; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-soft) 100%); color: #fff8e6; position: sticky; top: 0; height: 100vh; box-shadow: 12px 0 30px rgba(6, 27, 42, 0.12); }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 34px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--navy); font-family: Georgia, serif; font-weight: 700; box-shadow: 0 10px 24px rgba(217, 164, 65, 0.32); }
.brand small, .role-card small, .role-card span { display: block; color: rgba(255, 248, 230, 0.72); }
nav { display: grid; gap: 8px; }
.nav-item { text-align: left; color: rgba(255, 248, 230, 0.78); background: transparent; padding: 13px 14px; border-radius: 12px; border-left: 3px solid transparent; }
.nav-item.active, .nav-item:hover { background: rgba(255, 255, 255, 0.1); color: var(--gold-bright); border-left-color: var(--gold-bright); }
.role-card { position: absolute; left: 24px; right: 24px; bottom: 24px; padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(242, 199, 107, 0.24); }
.role-card button { margin-top: 12px; width: 100%; }
main { min-width: 0; padding: 28px 32px; overflow-x: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; padding: 18px 22px; border-radius: 22px; background: rgba(255, 255, 255, 0.72); border: 1px solid var(--line); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: var(--muted); font-weight: 800; }
h1, h2 { font-family: Georgia, serif; margin: 0; }
h1 { font-size: clamp(30px, 4vw, 44px); }
h2 { font-size: 24px; }
.actions { display: flex; gap: 12px; }
.primary, .ghost { padding: 11px 16px; border-radius: 12px; font-weight: 800; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.primary { background: linear-gradient(135deg, var(--blue), #6177f1); color: #ffffff; box-shadow: 0 12px 24px rgba(58, 87, 232, 0.22); }
.ghost { background: #ffffff; color: var(--ink); border: 1px solid var(--line); }
.danger-action { color: var(--red); border-color: #ffd5ce; background: #fff7f5; }
.primary:hover, .ghost:hover { transform: translateY(-1px); }
.full { width: 100%; }
.view { display: none; animation: rise 0.35s ease both; }
.view.active { display: block; }
.admin-only { display: none; }
.can-manage-users .admin-only { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hero-grid { display: grid; grid-template-columns: 1.8fr 0.9fr; gap: 18px; margin-bottom: 18px; }
.hero-card { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 220px; gap: 24px; padding: 30px; border-radius: 24px; color: #fff8e6; background: linear-gradient(135deg, #061b2a 0%, #0e3349 48%, #172a48 100%); box-shadow: 0 24px 60px rgba(6, 27, 42, 0.22); }
.hero-card::before { content: ""; position: absolute; inset: -40% auto auto 45%; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(247, 206, 115, 0.32), transparent 64%); }
.hero-card::after { content: ""; position: absolute; right: 22px; bottom: 20px; width: 160px; height: 90px; border-radius: 999px; background: rgba(8, 181, 221, 0.18); filter: blur(16px); }
.hero-copy, .hero-metric { position: relative; z-index: 1; }
.hero-copy h2 { max-width: 720px; font-size: clamp(30px, 4vw, 48px); line-height: 1.02; margin: 14px 0; }
.hero-copy p { max-width: 650px; color: rgba(255, 248, 230, 0.78); font-size: 16px; line-height: 1.7; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--gold-bright); font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #27e6a8; box-shadow: 0 0 0 6px rgba(39, 230, 168, 0.14); }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.hero-metric { align-self: center; display: grid; place-items: center; gap: 8px; padding: 24px; border-radius: 22px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(247, 206, 115, 0.22); }
.hero-metric span { color: rgba(255, 248, 230, 0.76); font-weight: 800; }
.hero-metric strong { font-family: Georgia, serif; font-size: 48px; color: var(--gold-bright); }
.mini-ring { width: 116px; height: 116px; padding: 12px; border-radius: 50%; background: conic-gradient(var(--gold-bright) 0deg 260deg, rgba(255,255,255,0.14) 260deg 360deg); }
.mini-ring i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #102d3f; }
.insight-card { padding: 24px; border-radius: 24px; background: linear-gradient(180deg, #ffffff 0%, #fff9ea 100%); border: 1px solid #f1dfb4; box-shadow: var(--shadow); }
.insight-card h3 { margin: 0 0 20px; font-size: 22px; line-height: 1.25; }
.insight-stack { display: grid; gap: 12px; }
.insight-stack span { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: #ffffff; border: 1px solid #f3e5c2; color: var(--ink); font-weight: 800; }
.insight-stack b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: var(--navy); color: var(--gold-bright); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.stat, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(14px); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.stat:hover, .panel:hover, .workflow-card:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(21, 40, 60, 0.12); }
.stat span, .stat small { color: var(--muted); display: block; }
.stat strong { font-family: Georgia, serif; font-size: 38px; display: block; margin: 8px 0; }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: 18px; top: 18px; width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, rgba(58, 87, 232, 0.16), rgba(8, 181, 221, 0.16)); }
.stat.good::after { background: linear-gradient(135deg, rgba(26, 160, 83, 0.18), rgba(8, 181, 221, 0.12)); }
.stat.warn::after { background: linear-gradient(135deg, rgba(192, 50, 33, 0.15), rgba(255, 122, 89, 0.16)); }
.stat.info::after { background: linear-gradient(135deg, rgba(217, 164, 65, 0.22), rgba(247, 206, 115, 0.22)); }
.good strong { color: var(--green); } .warn strong { color: var(--red); } .info strong { color: var(--blue); }
.panel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.overview-panels { display: grid; gap: 18px; }
.workflow-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.workflow-card { position: relative; overflow: hidden; display: grid; gap: 8px; padding: 20px; min-height: 150px; border-radius: 18px; background: #ffffff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.workflow-card::after { content: ""; position: absolute; right: -34px; top: -34px; width: 92px; height: 92px; border-radius: 50%; background: rgba(58, 87, 232, 0.1); }
.workflow-card:nth-child(2)::after { background: rgba(217, 164, 65, 0.18); }
.workflow-card:nth-child(3)::after { background: rgba(255, 122, 89, 0.14); }
.workflow-card:nth-child(4)::after { background: rgba(26, 160, 83, 0.14); }
.workflow-card span { color: var(--gold); font-family: Georgia, serif; font-size: 30px; font-weight: 700; }
.workflow-card strong { font-size: 17px; }
.workflow-card small { color: var(--muted); line-height: 1.6; }
.wide { min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-head.compact { margin-bottom: 12px; }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { padding: 8px 11px; border-radius: 999px; background: #fff4d8; color: #8b6115; font-weight: 800; font-size: 12px; }
.change-chip { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #edf1f7; color: #526070; }
.change-chip.new-version, .change-chip.added { background: #e9f8ef; color: #17783f; }
.change-chip.changed { background: #fff4d8; color: #8b6115; }
.change-chip.removed { background: #fff1ee; color: #a53225; }
.change-chip.same { background: #edf1f7; color: #526070; }
.danger { background: #ffe9e5; color: var(--red); }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: #ffffff; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; background: #f8fafc; }
tbody tr:hover { background: #fbfcff; }
.flow { display: grid; gap: 10px; margin-top: 16px; }
.flow span { padding: 13px; border-radius: 12px; background: #f6f8ff; border: 1px solid #edf1ff; font-weight: 800; }
.flow b { height: 18px; width: 2px; background: var(--line); margin-left: 20px; }
.search, select, input[type="date"], input[type="month"], input[type="text"], input[type="number"] { width: 100%; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: #ffffff; color: var(--ink); }
.search:focus, select:focus, input:focus { outline: 3px solid rgba(58, 87, 232, 0.12); border-color: #9aa8ff; }
.editor-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }
.editor-layout.single { grid-template-columns: 1fr; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 800; margin: 16px 0; }
.allocation-bar { display: flex; height: 32px; border-radius: 999px; overflow: hidden; background: #edf1f7; margin: 18px 0; }
.allocation-bar span { min-width: 4px; }
.status-line { font-weight: 800; margin-bottom: 16px; }
.allocation-control-panel { position: relative; z-index: 10; overflow: visible; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 8px 20px rgba(21, 40, 60, 0.06); }
.allocation-control-panel:hover { transform: none; box-shadow: 0 8px 20px rgba(21, 40, 60, 0.06); }
.allocation-control-head { display: grid; grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr); gap: 14px; align-items: end; margin-bottom: 10px; }
.allocation-control-head .eyebrow { font-size: 10px; margin-bottom: 3px; }
.allocation-control-head h2 { font-family: Verdana, Geneva, sans-serif; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.allocation-control-grid { display: grid; grid-template-columns: minmax(260px, 1.4fr) minmax(160px, 0.8fr) minmax(260px, 1.3fr) minmax(160px, 0.8fr); gap: 10px; align-items: end; }
.allocation-control-grid label { gap: 5px; margin: 0; font-size: 11px; letter-spacing: 0.02em; }
.allocation-control-grid input, .allocation-control-grid select { min-height: 36px; padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.employee-search-box { position: relative; min-width: 0; }
.employee-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 200; display: none; max-height: 320px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff; box-shadow: 0 18px 42px rgba(21, 40, 60, 0.16); }
.employee-suggest.show { display: grid; gap: 5px; }
.employee-suggest button { display: grid; gap: 3px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; background: #fbfcff; color: var(--ink); }
.employee-suggest button:hover { background: #eef3ff; }
.employee-suggest strong { font-size: 12px; line-height: 1.25; }
.employee-suggest small, .employee-suggest-empty { color: var(--muted); font-size: 11px; font-weight: 800; }
.employee-suggest-empty { padding: 10px; }
.allocation-control-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; justify-content: flex-start; flex-wrap: nowrap; }
.allocation-control-actions .primary, .allocation-control-actions .ghost { padding: 8px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.allocation-meter { min-width: 0; }
.allocation-meter .allocation-bar { height: 18px; margin: 0 0 6px; }
.allocation-meter .status-line { margin: 0; font-size: 12px; line-height: 1.25; text-align: right; }
.active-snapshot { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; }
.active-snapshot strong { min-width: 0; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.sheet-tools { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; align-items: center; margin-bottom: 12px; }
.sheet-tools small { grid-column: 1 / -1; }
.sheet-tools small { color: var(--muted); font-weight: 800; }
.sheet-wrap { width: 100%; max-width: calc(100vw - 350px); overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 16px; background: #ffffff; }
.sheet-table { min-width: 1120px; }
.sheet-table th { position: sticky; top: 0; z-index: 1; resize: horizontal; overflow: auto; min-width: 92px; background: #eef3ff; }
.sheet-table th, .sheet-table td { padding: 8px 10px; font-size: 12px; }
.sheet-table td, .sheet-table th { border-right: 1px solid var(--line); }
.sheet-table td:last-child, .sheet-table th:last-child { border-right: 0; }
.sheet-row:focus-within { background: #fff8e8; outline: 2px solid rgba(217, 164, 65, 0.22); }
.sheet-row.group-0 { background: #ffffff; }
.sheet-row.group-1 { background: #f8fbff; }
.sheet-row.warning td:first-child { box-shadow: inset 4px 0 0 #d9a441; }
.sheet-row.error td:first-child { box-shadow: inset 4px 0 0 #d94b3d; }
.sheet-row.active-rule-group { background: #fff8e8; outline: 2px solid rgba(217, 164, 65, 0.28); outline-offset: -2px; }
.sheet-row.active-rule-row td { background: #fff1ee; box-shadow: inset 0 -1px 0 rgba(217, 75, 61, 0.22), inset 0 1px 0 rgba(217, 75, 61, 0.22); }
.sheet-row.active-rule-row td:first-child { box-shadow: inset 4px 0 0 #d94b3d, inset 0 -1px 0 rgba(217, 75, 61, 0.22), inset 0 1px 0 rgba(217, 75, 61, 0.22); }
.row-num { width: 48px; color: var(--muted); font-weight: 900; text-align: right; background: #f6f8fc; }
.sheet-cell { min-width: 96px; height: 28px; border: 0; border-radius: 0; background: transparent; padding: 6px 8px; box-shadow: none; cursor: cell; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-cell:focus { outline: 2px solid #3a57e8; background: #ffffff; white-space: normal; overflow: visible; }
.sheet-cell.selected { background: rgba(58, 87, 232, 0.16); box-shadow: inset 0 0 0 1px rgba(58, 87, 232, 0.42); }
.sheet-cell.invalid { background: #fff1ee; box-shadow: inset 0 0 0 1px rgba(192, 50, 33, 0.42); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 12px 16px; border-radius: 14px; background: var(--navy); color: var(--gold-bright); box-shadow: var(--shadow); font-weight: 900; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 0.18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.cell-suggest { position: fixed; z-index: 300; display: none; min-width: 240px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff; box-shadow: 0 18px 42px rgba(21, 40, 60, 0.18); }
.cell-suggest.show { display: grid; gap: 4px; }
.cell-suggest button { padding: 8px 10px; border-radius: 9px; text-align: left; background: #fbfcff; color: var(--ink); font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-suggest button:hover { background: #eef3ff; }
.sheet-cell.number { font-variant-numeric: tabular-nums; }
.timeline-shell { margin-bottom: 18px; background: linear-gradient(135deg, #fbfcff, #fff8e8); border-color: #ead39c; }
.timeline-shell.collapsed { padding-bottom: 14px; }
.timeline-shell.collapsed .timeline-chart { display: none; }
.timeline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dashboard-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dashboard-filters { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.dashboard-filters select[multiple] { min-height: 122px; }
.compare-dropdown { position: relative; grid-column: 1 / -1; gap: 10px; padding: 12px; border-radius: 16px; background: #fbfcff; border: 1px solid var(--line); }
.selected-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 10px; border-radius: 999px; background: #fff4d8; color: #8b6115; font-weight: 900; }
.compare-picker { display: none; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; max-height: 240px; overflow: auto; padding: 12px; border-radius: 16px; background: #ffffff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.compare-dropdown.open .compare-picker { display: grid; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px; border-radius: 12px; background: #ffffff; border: 1px solid var(--line); color: var(--ink); }
.check-row input { width: auto; accent-color: var(--blue); }
.dual-range-wrap { margin: -4px 0 18px; padding: 14px 16px 10px; border-radius: 16px; background: #fbfcff; border: 1px solid var(--line); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-weight: 900; margin-bottom: 18px; }
.dual-range { position: relative; height: 46px; }
.range-track, .range-fill { position: absolute; left: 0; right: 0; top: 18px; height: 8px; border-radius: 999px; }
.range-track { background: #e6ebf3; }
.range-fill { right: auto; background: linear-gradient(90deg, var(--gold), var(--blue)); }
.dual-range input[type="range"] { position: absolute; left: 0; top: 10px; width: 100%; margin: 0; pointer-events: none; appearance: none; background: transparent; }
.dual-range input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; border: 4px solid #ffffff; border-radius: 50%; background: var(--navy); box-shadow: 0 6px 18px rgba(6, 27, 42, 0.28); pointer-events: auto; appearance: none; cursor: grab; }
.dual-range input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 4px solid #ffffff; border-radius: 50%; background: var(--navy); box-shadow: 0 6px 18px rgba(6, 27, 42, 0.28); pointer-events: auto; cursor: grab; }
.range-tip { position: absolute; top: -12px; padding: 4px 8px; border-radius: 8px; background: var(--navy); color: var(--gold-bright); font-size: 11px; font-weight: 900; transform: translateX(-50%); white-space: nowrap; }
.chart-card { padding: 18px; border-radius: 18px; background: linear-gradient(135deg, #fbfcff, #ffffff); border: 1px solid var(--line); }
.chart-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.chart-head div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-head strong { font-size: 18px; }
.chart-head span { color: var(--muted); font-weight: 900; }
.timeseries-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(var(--chart-col-width), 1fr); gap: 18px; min-height: calc(var(--chart-height) + 90px); overflow-x: auto; padding: 18px 8px 8px; border-radius: 16px; background: repeating-linear-gradient(to top, #eef2f7 0, #eef2f7 1px, transparent 1px, transparent 20px), #fbfcff; border: 1px solid var(--line); }
.timeseries-chart.compact-chart { min-height: 250px; grid-auto-columns: minmax(70px, 1fr); border: 0; padding: 10px 0 0; background: transparent; }
.compare-grid { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 16px; overflow-x: auto; padding: 16px 8px; border-radius: 16px; background: repeating-linear-gradient(to top, #eef2f7 0, #eef2f7 1px, transparent 1px, transparent 20px), #fbfcff; border: 1px solid var(--line); }
.period-column { position: relative; display: grid; grid-template-rows: var(--chart-height) auto auto; gap: 8px; align-items: end; justify-items: center; min-width: var(--chart-col-width); }
.hundred-bar { display: flex; flex-direction: column-reverse; align-self: end; width: 56px; height: 100%; overflow: hidden; border-radius: 16px; background: #edf1f7; box-shadow: inset 0 0 0 1px rgba(21, 40, 60, 0.06); }
.absolute-bar { border: 2px solid rgba(217, 164, 65, 0.32); }
.hundred-bar span { display: block; width: 100%; min-height: 2px; transition: filter 0.18s ease; }
.hundred-bar:hover span { filter: saturate(1.18); }
.period-column > strong { color: var(--ink); font-size: 12px; }
.bar-total { color: var(--muted); font-size: 11px; font-weight: 900; }
.period-tooltip { display: none; position: absolute; left: 50%; bottom: 36px; z-index: 5; min-width: 240px; max-width: 360px; padding: 12px; border-radius: 14px; background: #061b2a; color: #fff8e6; box-shadow: 0 20px 45px rgba(6, 27, 42, 0.24); transform: translateX(-50%); }
.period-column:hover .period-tooltip { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.period-tooltip em { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-style: normal; font-weight: 800; }
.period-tooltip i { width: 8px; height: 8px; border-radius: 50%; }
.compare-month-card { display: grid; grid-template-rows: auto 1fr; gap: 12px; padding: 16px; border-radius: 16px; background: #ffffff; border: 1px solid var(--line); box-shadow: var(--shadow); min-width: max(180px, calc(var(--chart-col-width) * 1.6)); }
.compare-month-card > strong { font-size: 15px; text-align: center; }
.compare-month-bars { display: flex; align-items: end; justify-content: center; gap: 8px; min-height: calc(var(--chart-height) * 0.78); }
.compare-employee-bar { position: relative; display: grid; grid-template-rows: 1fr auto; gap: 8px; justify-items: center; min-width: 34px; }
.compare-stacked-bar { display: flex; flex-direction: column-reverse; align-self: end; width: 30px; height: calc(var(--chart-height) * 0.72); overflow: hidden; border-radius: 10px; background: #edf1f7; box-shadow: inset 0 0 0 1px rgba(21, 40, 60, 0.06); }
.compare-stacked-bar span { width: 100%; min-height: 2px; }
.compare-employee-bar small { color: var(--muted); font-size: 10px; font-weight: 900; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 70px; }
.compare-employee-bar:hover .period-tooltip { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.compare-product-row { display: grid; grid-template-columns: 180px 1fr 90px; gap: 12px; align-items: center; }
.compare-product-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.compare-product-bar { display: flex; height: 22px; overflow: hidden; border-radius: 999px; background: #edf1f7; }
.compare-product-bar span { min-width: 3px; }
.compare-product-row small { color: var(--muted); font-weight: 900; }
.mini { padding: 8px 11px; border-radius: 10px; font-size: 12px; }
.ghost.mini.active { background: #fff4d8; border-color: #ead39c; color: #8b6115; }
.timeline-chart { display: grid; gap: 14px; }
.timeline-row { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: #ffffff; border: 1px solid var(--line); }
.timeline-row strong { font-size: 13px; color: var(--ink); }
.stacked-bar { display: flex; height: 28px; overflow: hidden; border-radius: 999px; background: #edf1f7; }
.stacked-bar span { min-width: 3px; }
.timeline-legend { display: flex; gap: 8px 14px; flex-wrap: wrap; }
.timeline-legend em { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 800; }
.timeline-legend i { width: 9px; height: 9px; border-radius: 50%; }
.mini-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(54px, 1fr); gap: 10px; align-items: end; height: 170px; padding: 14px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--line); overflow-x: auto; }
.chart-col { display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 8px; min-width: 54px; height: 100%; }
.chart-col span { display: block; width: 100%; min-height: 3px; border-radius: 10px 10px 4px 4px; box-shadow: 0 8px 18px rgba(21, 40, 60, 0.12); }
.chart-col small { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; max-height: 58px; }
.normalized-chip { display: inline-flex; justify-content: center; padding: 10px 12px; border-radius: 12px; background: #fff4d8; color: #8b6115; font-weight: 900; }
.effective-chip { display: inline-flex; justify-content: center; padding: 10px 12px; border-radius: 12px; background: #eef2ff; color: var(--blue); font-weight: 900; }
.remove { background: #ffe9e5; color: var(--red); border-radius: 12px; height: 42px; font-weight: 900; }
.upload-card { display: flex; gap: 16px; align-items: center; padding: 18px; border: 1px dashed #aeb9ca; border-radius: 16px; background: #fbfcff; margin-bottom: 18px; }
.import-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.step { display: flex; align-items: center; gap: 12px; padding: 15px; border-radius: 16px; background: #ffffff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); font-weight: 900; }
.step b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: #eef2ff; color: var(--blue); }
.step.active { color: var(--ink); border-color: #ead39c; background: linear-gradient(135deg, #ffffff, #fff7e3); }
.step.active b { background: var(--navy); color: var(--gold-bright); }
.rule-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.rule-board div { padding: 16px; border-radius: 16px; background: #fbfcff; border: 1px solid var(--line); }
.rule-board strong { display: block; margin-bottom: 8px; }
.rule-board span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.mass-summary, .cards, .audit-list, .dept-summary { display: grid; gap: 12px; margin-bottom: 18px; }
.dept-summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dept-summary .summary-chip { text-align: left; cursor: pointer; font: inherit; }
.dept-summary .summary-chip.active { border-color: #d9a441; box-shadow: 0 10px 24px rgba(217, 164, 65, 0.18); }
.summary-chip, .card, .audit-item { padding: 14px; border-radius: 14px; background: #fbfcff; border: 1px solid var(--line); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ok { color: var(--green); font-weight: 900; } .error { color: var(--red); font-weight: 900; } .warning { color: var(--amber); font-weight: 900; }
.admin-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.9fr) minmax(150px, 0.7fr) minmax(140px, 0.7fr) auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.admin-grid label { gap: 5px; margin: 0; font-size: 11px; }
.admin-grid input, .admin-grid select { min-height: 38px; padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.admin-settings { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 0 0 16px; padding: 12px; border-radius: 14px; background: #fbfcff; border: 1px solid var(--line); }
.admin-settings label { width: 180px; gap: 5px; margin: 0; font-size: 11px; }
.admin-settings input { min-height: 38px; padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.admin-settings small { color: var(--muted); font-weight: 800; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .role-card { position: static; margin-top: 24px; }
  .hero-grid, .hero-card, .stats-grid, .panel-grid, .editor-layout, .workflow-grid, .import-steps, .rule-board, .dashboard-filters, .admin-grid { grid-template-columns: 1fr; }
  .allocation-control-head, .allocation-control-grid { grid-template-columns: 1fr; }
  .allocation-control-actions { justify-content: stretch; }
  .allocation-control-actions .primary, .allocation-control-actions .ghost { flex: 1 1 140px; }
  .allocation-meter .status-line { text-align: left; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; flex-wrap: wrap; }
}
