:root {
  --navy: #171717;
  --navy-2: #222222;
  --navy-3: #333333;
  --gold: #f3a80f;
  --gold-soft: #fff3d1;
  --sky: #f4eee4;
  --green: #e9f5e4;
  --green-strong: #2f7348;
  --red: #b23a3a;
  --red-soft: #fce9e4;
  --orange: #a96613;
  --orange-soft: #fff0da;
  --ink: #222222;
  --muted: #686868;
  --line: #dfdcd5;
  --surface: #ffffff;
  --canvas: #f4f2ed;
  --shadow: 0 18px 45px rgba(0, 0, 0, .10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 .45rem; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, .85fr); background: var(--surface); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(3rem, 8vw, 8rem); color: white; background: radial-gradient(circle at 78% 18%, rgba(243,168,15,.22), transparent 26%), radial-gradient(circle at 8% 92%, rgba(255,255,255,.07), transparent 28%), linear-gradient(145deg, #111, #222 58%, #171717); }
.login-brand::before, .login-brand::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; }
.login-brand::before { width: 520px; height: 520px; right: -260px; bottom: -160px; }
.login-brand::after { width: 340px; height: 340px; right: -160px; bottom: -70px; }
.brand-mark { width: 220px; height: 124px; display: grid; place-items: center; margin-bottom: 2.2rem; padding: 0; overflow: hidden; border: 1px solid rgba(47,219,255,.28); border-radius: 14px; background: #02030c; box-shadow: 0 18px 44px rgba(0,0,0,.34), 0 0 26px rgba(0,198,255,.10); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.login-brand h1 { max-width: 760px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 6vw, 6.4rem); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
.login-brand h1 em { color: #f3a80f; font-weight: 400; }
.brand-copy { max-width: 590px; margin: 2rem 0; color: #dedede; font-size: 1.08rem; line-height: 1.75; }
.brand-metrics { display: flex; gap: 2.5rem; margin-top: 1rem; color: #c5c5c5; }
.brand-metrics span { display: flex; flex-direction: column; gap: .15rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.brand-metrics b { color: white; font-size: 1.5rem; letter-spacing: 0; }
.login-panel { display: grid; place-items: center; padding: 2.5rem; background: linear-gradient(180deg, #fff, #f8fafc); }
.login-card { width: min(440px, 100%); }
.login-card h2 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 2.5rem; font-weight: 500; }
.login-card > .muted { margin: .6rem 0 2rem; }
.mobile-brand { display: none; }
label { display: grid; gap: .5rem; margin-bottom: 1rem; color: #334155; font-size: .82rem; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: .72rem .85rem; color: var(--ink); border: 1px solid #cfd9e2; border-radius: 10px; background: white; outline: none; transition: border .18s, box-shadow .18s; }
input:focus, select:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(36,79,130,.12); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 3rem; }
.password-field button { position: absolute; right: .35rem; top: .3rem; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .7rem; padding: .65rem 1rem; border: 1px solid transparent; border-radius: 10px; font-weight: 800; transition: transform .16s, box-shadow .16s, background .16s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: linear-gradient(135deg, var(--navy-2), var(--navy)); box-shadow: 0 8px 20px rgba(16,43,79,.17); }
.button.ghost { color: var(--navy); border-color: #cbd8e3; background: white; }
.button.danger { color: var(--red); border-color: #efc8c1; background: #fff; }
.button.wide { width: 100%; justify-content: space-between; padding-inline: 1.2rem; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; color: var(--navy); border: 0; border-radius: 9px; background: transparent; }
.icon-button:hover { background: #edf2f7; }
.form-error { min-height: 1.25rem; color: var(--red); font-size: .82rem; }
.security-note { margin-top: 1.2rem; color: var(--muted); font-size: .75rem; text-align: center; }
.login-links { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: 1rem; }
.login-links span { width: 1px; height: 16px; background: var(--line); }
.login-links button { padding: .25rem; color: #333; border: 0; background: transparent; font-size: .78rem; font-weight: 750; }
.login-links button:hover { color: #9a6500; text-decoration: underline; text-underline-offset: 3px; }
.field-hint { margin: -.2rem 0 .8rem; color: var(--muted); font-size: .75rem; }
.requests-card { border-left: 4px solid var(--gold); }
.request-list { display: grid; gap: .65rem; }
.request-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 11px; background: #faf9f6; }
.request-row p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.4rem 1rem; color: white; background: linear-gradient(180deg, #171717, #050505); z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: .8rem; padding: 0 .5rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark.small { width: 88px; height: 50px; flex: 0 0 auto; margin: 0; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.24), 0 0 14px rgba(0,198,255,.08); }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-family: Georgia, serif; font-size: 1rem; }
.sidebar-brand small { margin-top: .16rem; color: #aaa; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
#main-nav { display: grid; gap: .28rem; margin-top: 1.5rem; overflow-y: auto; }
#main-nav button { display: flex; align-items: center; gap: .85rem; padding: .75rem .9rem; color: #cbd8e4; border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: .88rem; font-weight: 650; }
#main-nav button span { width: 20px; color: #88a5be; text-align: center; }
#main-nav button:hover, #main-nav button.active { color: white; background: rgba(255,255,255,.1); }
#main-nav button.active::after { content: ""; width: 3px; height: 22px; margin-left: auto; border-radius: 4px; background: var(--gold); }
.nav-label { margin: 1.4rem .9rem .35rem; color: #728aa1; font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; padding: .8rem; color: #9fb2c4; font-size: .72rem; }
.live-dot { width: 7px; height: 7px; display: inline-block; margin-right: .4rem; border-radius: 50%; background: #73c58c; box-shadow: 0 0 0 4px rgba(115,197,140,.12); }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; height: 82px; display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2.2rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.topbar h2 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.3rem; }
.topbar .eyebrow { margin-bottom: .1rem; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: .8rem; margin-left: auto; }
.supervisor-pill { display: grid; padding-right: 1rem; border-right: 1px solid var(--line); text-align: right; }
.supervisor-pill span { color: var(--gold); font-size: .62rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.supervisor-pill strong { color: var(--navy); font-size: .8rem; }
.account-button { display: flex; align-items: center; gap: .6rem; padding: .35rem .55rem; border: 0; border-radius: 12px; background: white; }
.account-button > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; color: white; border-radius: 10px; background: linear-gradient(135deg, var(--navy-3), var(--navy)); font-weight: 900; }
.account-button b, .account-button small { display: block; text-align: left; }
.account-button b { max-width: 150px; overflow: hidden; color: var(--ink); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.account-button small { color: var(--muted); font-size: .67rem; }
.account-menu { position: absolute; top: 54px; right: 0; width: 210px; padding: .4rem; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.account-menu button { width: 100%; padding: .7rem; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.account-menu button:hover { background: var(--canvas); }
.menu-toggle { display: none; }
main { padding: clamp(1.2rem, 3vw, 2.2rem); }
.view { display: none; animation: reveal .22s ease-out; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.welcome-band { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; min-height: 190px; padding: clamp(1.8rem, 4vw, 3.2rem); color: white; border-radius: 24px; background: radial-gradient(circle at 82% 22%, rgba(243,168,15,.28), transparent 23%), linear-gradient(130deg, #292929, #111); box-shadow: var(--shadow); }
.welcome-band::after { content: ""; position: absolute; width: 280px; height: 280px; right: -90px; bottom: -180px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.welcome-band h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.3rem); font-weight: 500; }
.welcome-band p:last-child { margin: .7rem 0 0; color: #d3dfeb; }
.year-badge { z-index: 1; width: 130px; height: 105px; display: grid; place-content: center; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; background: rgba(255,255,255,.08); text-align: center; backdrop-filter: blur(5px); }
.year-badge span { color: #f2ce78; font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.year-badge strong { font-family: Georgia, serif; font-size: 2.5rem; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.metric-card { min-height: 122px; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(16,43,79,.045); }
.metric-card .metric-icon { width: 32px; height: 32px; display: grid; place-items: center; margin-bottom: .8rem; color: var(--navy); border-radius: 9px; background: var(--sky); }
.metric-card b { display: block; color: var(--navy); font-family: Georgia, serif; font-size: 1.75rem; }
.metric-card span { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.content-card { margin-top: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(16,43,79,.04); }
.content-card.flush { padding: 0; overflow: hidden; }
.card-header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-header { margin-bottom: 1rem; }
.card-header h3, .security-card h3 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.25rem; }
.section-heading { margin-bottom: 1rem; }
.section-heading h1 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 500; }
.section-heading p:last-child { margin: .45rem 0 0; color: var(--muted); }
.toolbar { display: flex; gap: .6rem; }
.toolbar select { min-width: 190px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th { padding: .78rem .9rem; color: #5b6878; border-bottom: 1px solid var(--line); background: #f8fafc; text-align: left; font-size: .67rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td { padding: .75rem .9rem; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
tbody tr:hover { background: #fbfdff; }
.map-table-wrap { max-height: calc(100vh - 230px); }
.map-table { min-width: 2200px; }
.map-table thead { position: sticky; top: 0; z-index: 3; }
.map-table th { color: white; background: var(--navy); }
.map-table td { padding: .45rem .5rem; }
.map-table td.identity { background: #eff7fb; }
.map-table td.calculated { background: #f1f8ed; }
.map-table td.input-cell { background: #eaf3fb; }
.map-table input { min-width: 112px; min-height: 34px; padding: .4rem .45rem; border-radius: 7px; font-size: .75rem; }
.map-table input[type="number"] { min-width: 70px; width: 70px; }
.map-table .action-cell { min-width: 290px; max-width: 340px; white-space: normal; }
.notice-strip { margin-bottom: 1rem; padding: .75rem 1rem; color: #775416; border: 1px solid #efd99a; border-radius: 11px; background: var(--gold-soft); font-size: .78rem; }
.status { display: inline-flex; align-items: center; padding: .3rem .55rem; border-radius: 999px; font-size: .66rem; font-weight: 900; white-space: nowrap; }
.status.ok { color: var(--green-strong); background: var(--green); }
.status.pending { color: var(--orange); background: var(--orange-soft); }
.status.error { color: var(--red); background: var(--red-soft); }
.status.neutral { color: #4e6072; background: #edf2f6; }
.empty-state { padding: 2rem; color: var(--muted); text-align: center; }
.table-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.table-actions button { padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: .7rem; font-weight: 700; }
.table-actions button:hover { color: var(--navy); border-color: #9fb5c9; }
.roles-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.role-card { padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.role-card header { display: flex; align-items: start; justify-content: space-between; }
.role-card h3 { margin: 0; color: var(--navy); }
.role-card p { color: var(--muted); font-size: .8rem; }
.permission-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.permission-chips span { padding: .3rem .5rem; color: #516477; border-radius: 7px; background: #eef3f7; font-size: .65rem; }
.settings-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 1rem; }
.form-card { margin-top: 0; }
.security-card { margin-top: 0; background: linear-gradient(145deg, #fff, #f5f9fc); }
.shield { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 1rem; color: var(--green-strong); border-radius: 14px; background: var(--green); font-size: 1.4rem; }
.security-card p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.manual-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.manual-card { position: relative; min-height: 220px; margin-top: 0; padding: 1.35rem; overflow: hidden; }
.manual-card::after { content: ""; position: absolute; width: 120px; height: 120px; right: -70px; bottom: -70px; border: 1px solid #e4e9ee; border-radius: 50%; }
.manual-step { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 1rem; color: white; border-radius: 11px; background: linear-gradient(135deg, var(--navy-3), var(--navy)); font-family: Georgia, serif; font-size: 1.15rem; font-weight: 700; }
.manual-card h3, .manual-flow h3, .manual-pdf-card h3 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.2rem; }
.manual-card p, .manual-flow li, .manual-pdf-card p { color: var(--muted); font-size: .83rem; line-height: 1.65; }
.manual-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.manual-flow > div + div { padding-left: 2rem; border-left: 1px solid var(--line); }
.manual-flow ol { margin: .8rem 0 0; padding-left: 1.2rem; }
.manual-flow li { margin-bottom: .45rem; }
.manual-pdf-card { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; border-left: 4px solid var(--gold); }
.manual-pdf-card p { margin-bottom: 0; }
#view-import-review table { min-width: 1450px; }
#view-import-review th:last-child, #view-import-review td:last-child { position: sticky; right: 0; min-width: 145px; box-shadow: -8px 0 18px rgba(16,43,79,.06); }
#view-import-review th:last-child { z-index: 2; background: #f8fafc; }
#view-import-review td:last-child { background: white; }
dialog { width: min(660px, calc(100% - 2rem)); max-height: 88vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(10,31,55,.25); }
dialog::backdrop { background: rgba(8,26,47,.58); backdrop-filter: blur(4px); }
.wide-dialog { width: min(820px, calc(100% - 2rem)); }
.dialog-form { padding: 1.3rem; }
.dialog-form header, .dialog-form footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-form header { margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.dialog-form header h3 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.45rem; }
.dialog-form footer { justify-content: flex-end; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.span-2 { grid-column: span 2; }
.toggle-label { display: flex; align-items: center; gap: .6rem; }
.toggle-label input { width: 18px; min-height: 18px; }
fieldset { margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 .4rem; color: var(--navy); font-size: .82rem; font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.permission-grid label { display: flex; align-items: center; gap: .55rem; margin: 0; padding: .55rem; border-radius: 8px; background: #f7f9fb; font-weight: 600; }
.permission-grid input { width: 17px; min-height: 17px; }
.override-list { display: grid; gap: .45rem; max-height: 48vh; overflow: auto; }
.override-row { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 1rem; padding: .55rem .7rem; border: 1px solid #edf1f4; border-radius: 9px; }
.override-row span { font-size: .8rem; }
.override-row select { min-height: 36px; padding: .35rem; }
.toast { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 100; max-width: 380px; padding: .85rem 1rem; color: white; border-radius: 11px; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8f2f2f; }
.loading-block { min-height: 100px; border-radius: var(--radius); background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 45%, #eef2f6 65%); background-size: 300% 100%; animation: loading 1.5s infinite; }
@keyframes loading { to { background-position: -150% 0; } }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .supervisor-pill { display: none; }
}
@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .mobile-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; color: var(--navy); font-family: Georgia, serif; font-weight: 700; }
  .mobile-brand .brand-mark { width: 96px; height: 54px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -270px; width: 250px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 25px 0 60px rgba(7,25,45,.25); }
  .menu-toggle { display: grid; }
  .account-button span:last-child { display: none; }
  main { padding: 1rem; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading, .card-header { align-items: stretch; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar select { min-width: 0; flex: 1; }
  .settings-grid, .roles-grid { grid-template-columns: 1fr; }
  .manual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-pdf-card { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .topbar { height: 70px; }
  .topbar .eyebrow { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .welcome-band { align-items: start; }
  .year-badge { display: none; }
  .form-grid, .permission-grid { grid-template-columns: 1fr; }
  .manual-grid, .manual-flow { grid-template-columns: 1fr; }
  .manual-flow > div + div { padding: 1rem 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .span-2 { grid-column: span 1; }
}
