:root {
  --navy-950: #071426;
  --navy-900: #0b1f38;
  --navy-800: #102f52;
  --navy-700: #17446e;
  --blue-500: #2e7fc1;
  --blue-100: #dbeeff;
  --red-600: #b92f35;
  --red-500: #d8494f;
  --gold-500: #d5a840;
  --green-600: #18805c;
  --green-100: #dcf7eb;
  --amber-100: #fff1d6;
  --ink: #152235;
  --muted: #637083;
  --line: #dce3eb;
  --surface: #ffffff;
  --canvas: #f2f5f8;
  --shadow: 0 16px 45px rgba(7, 20, 38, .10);
  --radius: 18px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --blue-500: #69ace0;
  --blue-100: #15334d;
  --green-600: #45bd91;
  --green-100: #15392f;
  --amber-100: #493a1a;
  --ink: #e7edf5;
  --muted: #9aaabd;
  --line: #2b3e54;
  --surface: #111e2d;
  --canvas: #08121e;
  --shadow: 0 16px 45px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; padding: .8rem 1rem; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.site-header, .kiosk-header { min-height: 82px; padding: 0 clamp(1rem, 4vw, 4.5rem); display: flex; align-items: center; justify-content: space-between; gap: 2rem; color: white; background: linear-gradient(120deg, var(--navy-950), var(--navy-800)); border-bottom: 3px solid var(--red-500); }
.brand { display: inline-flex; align-items: center; gap: .85rem; color: inherit; text-decoration: none; }
.brand-mark { width: 58px; height: 58px; flex: 0 0 auto; display: block; overflow: hidden; background: #02050a; border: 2px solid rgba(255,255,255,.78); border-radius: 50%; filter: drop-shadow(0 5px 8px rgba(0,0,0,.3)); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.brand-mark-large { width: 118px; height: 118px; margin: 0 auto 1rem; border-color: #d9b455; box-shadow: 0 0 0 5px rgba(16,35,63,.06); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { text-transform: uppercase; letter-spacing: .055em; font-size: .92rem; }
.brand-copy small { margin-top: .3rem; color: #b9cee2; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; }
.top-nav { display: flex; align-items: center; gap: .35rem; }
.theme-picker { display: inline-flex; align-items: center; color: inherit; }
.theme-picker select { width: auto; min-width: 118px; min-height: 39px; padding: .42rem 1.8rem .42rem .7rem; color: #e6eef7; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; cursor: pointer; font-size: .76rem; font-weight: 750; }
.theme-picker select:hover, .theme-picker select:focus { border-color: rgba(255,255,255,.55); box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.theme-picker option { color: var(--ink); background: var(--surface); }
.top-nav > a, .nav-button { color: #d9e5f1; text-decoration: none; border: 0; background: transparent; padding: .75rem .9rem; border-radius: 9px; cursor: pointer; font-weight: 650; }
.top-nav > a:hover, .nav-button:hover { color: #fff; background: rgba(255,255,255,.1); }
.inline-form { display: inline; margin: 0; }
.site-footer { padding: 1.5rem clamp(1rem, 5vw, 5rem); display: flex; justify-content: space-between; gap: 1rem; color: #788598; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

.flash-stack, .kiosk-flashes { position: fixed; right: 1.5rem; top: 6.5rem; z-index: 100; display: grid; gap: .6rem; width: min(430px, calc(100vw - 3rem)); }
.flash { padding: 1rem 1.2rem; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); border-left: 5px solid var(--blue-500); font-weight: 700; }
.flash-success { border-color: var(--green-600); }
.flash-error { border-color: var(--red-500); }

.hero { position: relative; overflow: hidden; min-height: 355px; display: flex; align-items: center; justify-content: space-between; gap: 3rem; padding: 4rem clamp(1.25rem, 7vw, 7.5rem); color: #fff; background: radial-gradient(circle at 75% 10%, rgba(50, 121, 177, .45), transparent 32%), linear-gradient(125deg, #071629 0%, #0c2a4a 58%, #123d63 100%); }
.hero::after { content: "CPD"; position: absolute; right: -1rem; bottom: -8rem; color: rgba(255,255,255,.025); font-size: min(25vw, 22rem); font-weight: 950; letter-spacing: -.08em; line-height: 1; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; max-width: 760px; }
.eyebrow { margin: 0 0 .65rem; color: var(--blue-500); font-size: .73rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.hero .eyebrow { color: #87bde6; }
.hero h1 { margin: 0; max-width: 800px; font-size: clamp(2.5rem, 5vw, 4.9rem); line-height: .98; letter-spacing: -.055em; }
.hero h1 span { color: #7eb9e4; }
.hero-intro { max-width: 650px; margin: 1.5rem 0 0; color: #c4d5e5; font-size: clamp(1rem, 1.5vw, 1.22rem); }
.status-card { position: relative; z-index: 1; min-width: 285px; display: flex; align-items: center; gap: 1rem; padding: 1.35rem; color: #fff; text-decoration: none; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18); border-radius: 18px; backdrop-filter: blur(8px); transition: transform .2s, background .2s; }
.status-card:hover { transform: translateY(-3px); background: rgba(255,255,255,.14); }
.status-icon { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 15px; background: var(--red-500); font-weight: 900; }
.status-card > span:last-child { display: flex; flex-direction: column; }
.status-card small { color: #b9cee2; }
.status-card strong { font-size: 1.18rem; }
.status-card em { margin-top: .3rem; color: #90c6ee; font-size: .8rem; font-style: normal; font-weight: 700; }

.link-section { width: min(1460px, calc(100% - 2.5rem)); margin: 0 auto; padding: 3.2rem 0 4.5rem; }
.section-heading, .admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.section-heading h2, .admin-heading h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.035em; }
.section-heading > p { color: var(--muted); font-size: .9rem; }
.portal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
.portal-card { min-height: 175px; position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 1.35rem; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(7,20,38,.045); transition: transform .18s, border-color .18s, box-shadow .18s; }
.portal-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: var(--radius) 0 0 var(--radius); background: var(--blue-500); opacity: 0; transition: opacity .18s; }
.portal-card:hover { transform: translateY(-4px); border-color: #b7c9db; box-shadow: var(--shadow); }
.portal-card:hover::before { opacity: 1; }
.portal-icon, .mini-icon { width: 45px; height: 45px; display: inline-grid; place-items: center; color: var(--navy-800); background: var(--blue-100); border-radius: 12px; font-size: .76rem; font-weight: 900; letter-spacing: .04em; }
.portal-card-copy { margin-top: auto; display: flex; flex-direction: column; }
.portal-card-copy strong { font-size: 1.02rem; }
.portal-card-copy small { margin-top: .2rem; color: var(--muted); line-height: 1.35; }
.portal-arrow { position: absolute; right: 1.25rem; top: 1.35rem; color: #93a2b4; font-size: 1.25rem; }
.empty-state { grid-column: 1 / -1; padding: 3rem; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

.auth-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 3rem 1rem; background: radial-gradient(circle at 20% 20%, #dceefe, transparent 32%); }
.auth-card { width: min(440px, 100%); padding: 2.5rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0; font-size: 2.5rem; }
.auth-card > p:not(.eyebrow) { margin: .5rem 0 1.7rem; color: var(--muted); }
.auth-card .auth-footnote { margin: 1.3rem 0 0 !important; font-size: .8rem; }
.form-stack { display: grid; gap: 1rem; text-align: left; }
label { display: grid; gap: .4rem; color: #344256; font-size: .82rem; font-weight: 750; }
label small { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; min-height: 45px; padding: .7rem .8rem; color: var(--ink); background: var(--surface); border: 1px solid #bec9d5; border-radius: 9px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(46,127,193,.15); }
textarea { resize: vertical; }
.check-row { display: flex; align-items: center; gap: .55rem; }
.check-row input { width: 18px; min-height: 18px; accent-color: var(--blue-500); }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 9px; text-decoration: none; cursor: pointer; font-weight: 800; }
.button-primary { color: #fff; background: var(--navy-800); }
.button-primary:hover { background: var(--navy-700); }
.button-secondary { color: var(--navy-800); background: var(--surface); border-color: #bfcbd7; }
.button-quiet { color: var(--muted); background: transparent; }
.button-full { width: 100%; }
.button-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Kiosk */
.kiosk-page { zoom: var(--kiosk-display-scale, 1); background: #e9eef3; }
.kiosk-header { min-height: 90px; }
.kiosk-header-actions { display: flex; align-items: center; gap: 1rem; }
.kiosk-clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.kiosk-clock strong { font-size: 1.65rem; }
.kiosk-clock small { margin-top: .35rem; color: #b9cee2; }
.kiosk-main { width: min(1650px, calc(100% - 3rem)); margin: 0 auto; padding: 2.2rem 0 3rem; }
.kiosk-title-row { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.35rem; }
.kiosk-title-row h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.04em; }
.live-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .85rem; color: var(--green-600); background: var(--green-100); border-radius: 99px; font-weight: 800; }
.live-pill i { width: 9px; height: 9px; background: var(--green-600); border-radius: 50%; box-shadow: 0 0 0 4px rgba(24,128,92,.13); }
.status-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.status-panel { min-height: 300px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 24px rgba(7,20,38,.05); }
.status-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; color: var(--navy-800); background: #e7f3fc; border-bottom: 1px solid #cfdfec; font-size: 1rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.checked-panel > header { color: #8c3b2b; background: #fff0e9; border-color: #f1d2c5; }
.checked-panel > header > span { display: flex; align-items: center; gap: .6rem; }
.checked-panel > header em { padding: .2rem .45rem; color: #fff; background: var(--red-600); border-radius: 99px; font-size: .66rem; font-style: normal; letter-spacing: .04em; }
.status-panel > header strong { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: var(--navy-800); border-radius: 50%; }
.checked-panel > header strong { background: var(--red-600); }
.status-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; padding: .45rem 1.25rem 1rem; }
.status-row { min-width: 0; display: flex; align-items: center; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid #e5e9ef; }
.status-row > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.status-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.status-row small { color: var(--muted); }
.status-row-overdue { margin: 0 -.65rem; padding-right: .65rem; padding-left: .65rem; background: #fff1ed; border-bottom-color: #efc9bf; border-radius: 10px; }
.status-row-overdue .status-avatar { background: var(--red-600); box-shadow: 0 0 0 4px rgba(185,47,53,.14); }
.checkout-meta { display: flex !important; flex-wrap: wrap; align-items: center; gap: .25rem; }
.overdue-badge { display: inline-flex; margin-left: .3rem; padding: .13rem .42rem; color: #fff; background: var(--red-600); border-radius: 99px; font-size: .65rem; font-weight: 900; letter-spacing: .05em; line-height: 1.4; text-transform: uppercase; }
.status-dot { width: 12px; height: 12px; flex: 0 0 auto; background: #35a878; border-radius: 50%; }
.status-avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: var(--red-500); border-radius: 11px; font-size: .75rem; font-weight: 900; }
.empty-kiosk { grid-column: 1 / -1; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.kiosk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1.2rem; }
.kiosk-action { min-height: 130px; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 1rem; padding: 1.25rem 1.5rem; text-align: left; color: white; border: 0; border-radius: 20px; box-shadow: 0 12px 24px rgba(7,20,38,.16); cursor: pointer; }
.kiosk-action > span { grid-row: 1 / 3; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: rgba(255,255,255,.14); font-size: 2rem; }
.kiosk-action strong { align-self: end; font-size: clamp(1.25rem, 2vw, 1.8rem); }
.kiosk-action small { align-self: start; color: rgba(255,255,255,.75); font-size: .92rem; }
.checkout-action { background: linear-gradient(120deg, #0b3155, #175d91); }
.checkin-action { background: linear-gradient(120deg, #8f252b, #c23f45); }
.kiosk-action:active { transform: scale(.99); }
.kiosk-flow { min-height: calc(100vh - 140px); }
.flow-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; color: var(--muted); font-weight: 800; }
.back-button { min-height: 54px; padding: 0 1.1rem; color: var(--navy-800); background: var(--surface); border: 1px solid #bdc9d5; border-radius: 12px; cursor: pointer; font-weight: 850; }
.kiosk-form { display: grid; gap: 1.4rem; }
.flow-step { padding: clamp(1.4rem, 3vw, 2.4rem); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 8px 24px rgba(7,20,38,.05); }
.flow-step h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.6rem); letter-spacing: -.035em; }
.flow-step > p:not(.step-number) { margin: .25rem 0 1.3rem; color: var(--muted); font-size: 1.05rem; }
.step-number { margin: 0 0 .4rem; color: var(--blue-500); font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.employee-grid, .item-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.employee-button, .item-button { min-height: 88px; display: flex; align-items: center; gap: .85rem; padding: .9rem; color: var(--ink); background: #f8fafc; border: 2px solid #d8e0e8; border-radius: 15px; cursor: pointer; }
.employee-button input, .item-button input { position: absolute; opacity: 0; pointer-events: none; }
.employee-button:has(input:checked), .item-button:has(input:checked) { border-color: var(--blue-500); background: #e9f4fc; box-shadow: 0 0 0 3px rgba(46,127,193,.12); }
.item-button-overdue { border-color: #e3a79c; background: #fff1ed; }
.employee-button > span:last-child, .item-button > span:last-child { display: flex; flex-direction: column; }
.employee-button strong, .item-button strong { font-size: 1.02rem; }
.employee-button small, .item-button small { color: var(--muted); font-size: .78rem; }
.employee-initials { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: var(--navy-800); border-radius: 13px; font-size: .84rem; font-weight: 900; }
.item-check { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: transparent; background: var(--surface); border: 2px solid #aebaca; border-radius: 50%; }
.item-button:has(input:checked) .item-check { color: #fff; background: var(--blue-500); border-color: var(--blue-500); }
.pin-entry { display: grid; grid-template-columns: minmax(220px, 400px) minmax(240px, 360px); gap: 1rem; }
.pin-entry input { min-height: 70px; text-align: center; font-size: 2rem; letter-spacing: .4em; }
.confirm-button { min-height: 70px; font-size: 1.15rem; text-transform: capitalize; }
.no-owned-items { padding: 1.25rem; color: #8c3b2b !important; background: #fff0e9; border-radius: 12px; font-weight: 750; }

/* Admin */
.admin-layout { width: min(1560px, calc(100% - 2.5rem)); min-height: calc(100vh - 150px); margin: 1.6rem auto; display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 1.5rem; }
.admin-sidebar { height: max-content; position: sticky; top: 1.5rem; overflow: hidden; background: var(--navy-900); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-sidebar > div { padding: 1.4rem; color: white; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-sidebar .eyebrow { color: #81b8e1; }
.admin-sidebar > div strong, .admin-sidebar > div small { display: block; }
.admin-sidebar > div small { margin-top: .2rem; color: #9db3c8; }
.admin-sidebar nav { display: grid; padding: .7rem; }
.admin-sidebar nav a { padding: .72rem .8rem; color: #bac9d8; text-decoration: none; border-radius: 8px; font-weight: 700; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.admin-sidebar nav a.active { box-shadow: inset 3px 0 var(--red-500); }
.admin-content { min-width: 0; }
.admin-heading { min-height: 80px; }
.admin-heading p:not(.eyebrow) { margin: .25rem 0 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-grid article { min-height: 150px; display: flex; flex-direction: column; padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-grid small { color: var(--muted); font-weight: 750; }
.metric-grid strong { margin: auto 0 0; font-size: 2.5rem; letter-spacing: -.04em; }
.metric-grid span { color: var(--green-600); font-size: .8rem; font-weight: 750; }
.metric-grid .warn-text { color: var(--red-600); }
.admin-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 20px rgba(7,20,38,.04); }
.admin-card > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem; border-bottom: 1px solid var(--line); }
.admin-card h2 { margin: 0; font-size: 1.25rem; }
.admin-card header a { color: var(--blue-500); font-weight: 750; }
.count-pill { min-width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--navy-800); border-radius: 50%; font-weight: 800; }
.compact-list { padding: .25rem 1.2rem .8rem; }
.compact-list > div { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: .8rem; border-bottom: 1px solid #e7ebf0; }
.compact-list > div:last-child { border-bottom: 0; }
.compact-list > .compact-row-overdue { margin: .25rem -.55rem; padding: 0 .55rem; background: #fff1ed; border: 1px solid #efc9bf; border-radius: 10px; }
.compact-list > div > span:first-child { display: flex; flex-direction: column; }
.compact-list small, table td small { display: block; color: var(--muted); }
.text-button { padding: .35rem 0; color: var(--blue-500); background: transparent; border: 0; cursor: pointer; font-weight: 800; white-space: nowrap; }
.empty-admin { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.state-badge { display: inline-flex; padding: .3rem .55rem; color: #596679; background: #edf0f3; border-radius: 99px; font-size: .72rem; font-weight: 850; white-space: nowrap; }
.state-open { color: #963a2d; background: #ffe8df; }
.state-overdue { color: #fff; background: var(--red-600); }
.state-available { color: #146e50; background: #dff6ec; }
.state-returned { color: #335d80; background: #e3eef7; }
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .85rem 1rem; color: #697588; background: #f7f9fb; border-bottom: 1px solid var(--line); font-size: .71rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .95rem 1rem; border-bottom: 1px solid #e6ebf0; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }
.history-row-overdue { background: #fff7f4; }
.mini-icon { width: 34px; height: 34px; margin-right: .55rem; vertical-align: middle; font-size: .66rem; }
.truncate-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.filter-bar { display: grid; grid-template-columns: 1.5fr repeat(5, 1fr) auto auto; align-items: end; gap: .7rem; margin-bottom: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar label { min-width: 0; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1.5rem; padding: 1.5rem; color: var(--muted); }
.pagination a { color: var(--blue-500); font-weight: 800; }
.editor-dialog { width: min(650px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; color: var(--ink); background: var(--surface); border: 0; border-radius: 20px; box-shadow: 0 24px 90px rgba(7,20,38,.35); }
.editor-dialog::backdrop { background: rgba(7,20,38,.7); backdrop-filter: blur(3px); }
.editor-form > header, .editor-form > footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--line); }
.editor-form > footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.editor-form h2 { margin: 0; font-size: 1.5rem; }
.dialog-close { width: 40px; height: 40px; color: var(--muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.7rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.4rem; }
.span-2 { grid-column: 1 / -1; }
.editor-check { align-self: end; min-height: 45px; padding: .7rem; background: #f6f8fa; border-radius: 9px; }
.form-note { margin: 0; padding: .8rem; color: var(--muted); background: #f4f7f9; border-radius: 9px; font-size: .82rem; }

/* Guided imports */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.import-card > header > div .eyebrow { margin-bottom: .15rem; }
.import-icon { width: 46px; height: 46px; display: grid; place-items: center; color: #fff; background: var(--navy-800); border-radius: 12px; font-size: .7rem; font-weight: 900; }
.import-body { padding: 1.3rem; }
.import-body > p { color: var(--muted); }
.import-body ol { min-height: 90px; padding-left: 1.4rem; color: #344257; }
.import-body li { padding: .2rem 0; }
.security-note, .import-warning { padding: .9rem 1rem; background: #f1f6fa; border-left: 4px solid var(--blue-500); border-radius: 8px; font-size: .85rem; }
.import-form { display: grid; gap: 1rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.import-form input[type="file"] { padding: .65rem; background: #f7f9fb; }
.import-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.import-summary > div { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.import-summary strong { font-size: 1.6rem; }
.import-create { color: #146e50; background: #dff6ec; }
.import-update { color: #285f8d; background: #e0effa; }
.import-skip { color: #566579; background: #edf0f3; }
.import-error { color: #9b2c31; background: #ffe3e4; }
.import-warning { margin-bottom: 1rem; color: #7c2d27; background: #fff2ed; border-left-color: var(--red-500); }
.import-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1rem; }
.button:disabled { cursor: not-allowed; opacity: .45; }

/* IT help desk */
.support-page { background: #edf2f6; }
.support-hero { min-height: 280px; display: flex; align-items: center; justify-content: space-between; gap: 3rem; padding: 3.4rem clamp(1.25rem, 7vw, 7.5rem); color: #fff; background: radial-gradient(circle at 85% 10%, rgba(46,127,193,.4), transparent 35%), linear-gradient(125deg, var(--navy-950), var(--navy-800)); }
.support-hero > div:first-child { max-width: 760px; }
.support-hero h1 { margin: 0; font-size: clamp(2.5rem, 5vw, 4.5rem); letter-spacing: -.055em; }
.support-hero > div:first-child > p:last-child { max-width: 680px; margin: 1rem 0 0; color: #c4d5e5; font-size: 1.1rem; }
.support-promise { width: min(390px, 100%); display: flex; align-items: center; gap: 1rem; padding: 1.25rem; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.17); border-radius: 18px; }
.support-promise > span, .support-security > span { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: var(--red-500); border-radius: 14px; font-weight: 900; }
.support-promise p, .support-security p { margin: 0; display: flex; flex-direction: column; }
.support-promise small { margin-top: .25rem; color: #bed0df; line-height: 1.35; }
.support-layout { width: min(1250px, calc(100% - 2.5rem)); margin: 2rem auto 4rem; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1.25rem; align-items: start; }
.support-form, .support-sidebar article, .ticket-confirmation { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 9px 28px rgba(7,20,38,.06); }
.support-form { padding: clamp(1.4rem, 3vw, 2.2rem); }
.support-section-heading { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.3rem; }
.support-section-heading > span { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: var(--navy-800); border-radius: 12px; font-weight: 900; }
.support-section-heading h2 { margin: 0; font-size: 1.45rem; }
.support-section-heading p { margin: .1rem 0 0; color: var(--muted); }
.support-grid { padding: 0; }
.support-divider { height: 1px; margin: 2rem 0; background: var(--line); }
.support-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.support-submit-row p { margin: 0; color: var(--muted); font-size: .86rem; }
.support-submit-row .button { min-width: 190px; }
.support-sidebar { display: grid; gap: 1rem; }
.support-sidebar article { padding: 1.35rem; }
.support-sidebar h2 { margin: 0; font-size: 1.25rem; }
.support-sidebar ol { margin: 1rem 0 0; padding-left: 1.3rem; color: var(--muted); }
.support-sidebar li { padding: .35rem 0 .35rem .2rem; }
.support-security { display: flex; align-items: center; gap: .85rem; }
.support-security > span { width: 45px; height: 45px; background: var(--green-600); font-size: .72rem; }
.support-security small { margin-top: .2rem; color: var(--muted); line-height: 1.35; }
.ticket-confirmation { width: min(760px, calc(100% - 2rem)); margin: 3.5rem auto; padding: clamp(1.8rem, 5vw, 3.5rem); text-align: center; }
.confirmation-mark { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 1.2rem; color: #fff; background: var(--green-600); border-radius: 50%; font-size: 2rem; box-shadow: 0 0 0 9px var(--green-100); }
.ticket-confirmation h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.045em; }
.ticket-confirmation > p:not(.eyebrow):not(.confirmation-number) { max-width: 580px; margin: .8rem auto 1.5rem; color: var(--muted); }
.confirmation-number { display: inline-block; margin: 1.2rem 0 0; padding: .75rem 1.15rem; color: var(--navy-800); background: var(--blue-100); border-radius: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.35rem; font-weight: 900; letter-spacing: .06em; }
.confirmation-details { display: grid; grid-template-columns: 1fr 1fr; margin: 1.8rem 0; text-align: left; border: 1px solid var(--line); border-radius: 14px; }
.confirmation-details div { padding: 1rem; border-bottom: 1px solid var(--line); }
.confirmation-details div:nth-last-child(-n+2) { border-bottom: 0; }
.confirmation-details div:nth-child(odd) { border-right: 1px solid var(--line); }
.confirmation-details dt { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.confirmation-details dd { margin: .25rem 0 0; font-weight: 750; }
.ticket-confirmation .button-row { justify-content: center; }

.ticket-metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.ticket-metric-grid a { min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; padding: 1rem 1.1rem; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ticket-metric-grid a:hover { border-color: #aebfce; box-shadow: 0 8px 20px rgba(7,20,38,.06); }
.ticket-metric-grid small { color: var(--muted); font-weight: 800; }
.ticket-metric-grid strong { font-size: 2rem; line-height: 1; }
.ticket-filters { grid-template-columns: 1.4fr repeat(4, 1fr) auto auto; }
.ticket-table a { color: var(--blue-500); text-decoration: none; }
.ticket-table a:hover { text-decoration: underline; }
.priority-badge { display: inline-flex; padding: .3rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 850; white-space: nowrap; }
.priority-low { color: #566579; background: #edf0f3; }
.priority-normal { color: #335d80; background: #e3eef7; }
.priority-high { color: #8a5b0d; background: var(--amber-100); }
.priority-urgent { color: #9b2c31; background: #ffe3e4; }
.ticket-status-open { color: #963a2d; background: #ffe8df; }
.ticket-status-in_progress { color: #285f8d; background: #e0effa; }
.ticket-status-waiting { color: #7b5a16; background: #fff1d6; }
.ticket-status-resolved, .ticket-status-closed { color: #146e50; background: #dff6ec; }
.ticket-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .25rem 0 1.2rem; }
.ticket-detail-heading > a { color: var(--blue-500); font-weight: 800; }
.ticket-detail-heading > div { display: flex; gap: .5rem; }
.ticket-title { min-height: 0; }
.ticket-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1rem; align-items: start; }
.ticket-main-column, .ticket-detail-grid > aside { display: grid; gap: 1rem; }
.ticket-description > div { padding: 1.3rem; }
.ticket-description > div > p { margin: 0; white-space: pre-wrap; }
.ticket-description dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 1.4rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.ticket-description dl div { padding-right: 1rem; }
.ticket-description dt { color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.ticket-description dd { margin: .3rem 0 0; font-weight: 750; }
.activity-timeline { padding: 1.2rem; }
.activity-timeline > div { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: .8rem; padding-bottom: 1.2rem; }
.activity-timeline > div:not(:last-child)::before { content: ""; position: absolute; left: 7px; top: 13px; bottom: 0; width: 2px; background: #dce4eb; }
.activity-timeline > div:last-child { padding-bottom: 0; }
.activity-dot { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: .15rem; background: var(--blue-500); border: 4px solid #dcedfa; border-radius: 50%; }
.activity-timeline p { margin: 0; display: flex; flex-direction: column; }
.activity-timeline small { color: var(--muted); }
.activity-timeline em { margin-top: .35rem; color: #334155; font-style: normal; white-space: pre-wrap; }
.ticket-controls .form-stack { padding: 1.2rem; }
.read-only-note { margin: 0; padding: .8rem; color: var(--muted); background: #f3f6f8; border-radius: 9px; }
.ticket-requester > div { display: flex; align-items: center; gap: .8rem; padding: 1.2rem; }
.ticket-requester p { margin: 0; display: flex; flex-direction: column; }
.ticket-requester small { color: var(--muted); }

/* Selectable dark theme */
html[data-theme="dark"] .auth-wrap { background: radial-gradient(circle at 20% 20%, #112b43, transparent 35%); }
html[data-theme="dark"] .kiosk-page,
html[data-theme="dark"] .support-page { background: var(--canvas); }
html[data-theme="dark"] label { color: #c5d1de; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #0b1725; border-color: #3a4d62; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #718397; }
html[data-theme="dark"] .theme-picker select { color: #e6eef7; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25); }
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .back-button { color: #d8e6f2; border-color: #40546a; }
html[data-theme="dark"] .portal-card:hover,
html[data-theme="dark"] .ticket-metric-grid a:hover { border-color: #55718d; }
html[data-theme="dark"] .portal-icon,
html[data-theme="dark"] .mini-icon,
html[data-theme="dark"] .confirmation-number { color: #9bcbef; }
html[data-theme="dark"] .status-panel > header { color: #9bcbef; background: #142d43; border-color: #28445c; }
html[data-theme="dark"] .checked-panel > header { color: #ffaaa0; background: #3c2425; border-color: #5b3233; }
html[data-theme="dark"] .status-row,
html[data-theme="dark"] .compact-list > div,
html[data-theme="dark"] td { border-color: var(--line); }
html[data-theme="dark"] .status-row-overdue,
html[data-theme="dark"] .compact-list > .compact-row-overdue,
html[data-theme="dark"] .item-button-overdue,
html[data-theme="dark"] .history-row-overdue { background: #3b2325; border-color: #63383a; }
html[data-theme="dark"] .employee-button,
html[data-theme="dark"] .item-button { background: #0c1927; border-color: #31465a; }
html[data-theme="dark"] .employee-button:has(input:checked),
html[data-theme="dark"] .item-button:has(input:checked) { background: #15324a; }
html[data-theme="dark"] th { color: #a7b7c9; background: #0c1826; }
html[data-theme="dark"] tbody tr:hover { background: #142336; }
html[data-theme="dark"] .editor-check,
html[data-theme="dark"] .form-note,
html[data-theme="dark"] .read-only-note,
html[data-theme="dark"] .security-note,
html[data-theme="dark"] .import-form input[type="file"] { background: #152333; }
html[data-theme="dark"] .import-body ol,
html[data-theme="dark"] .activity-timeline em { color: #c6d2df; }
html[data-theme="dark"] .activity-timeline > div:not(:last-child)::before { background: #304458; }
html[data-theme="dark"] .activity-dot { border-color: #183a55; }
html[data-theme="dark"] .state-badge,
html[data-theme="dark"] .priority-low,
html[data-theme="dark"] .import-skip { color: #bdc9d6; background: #273442; }
html[data-theme="dark"] .state-open,
html[data-theme="dark"] .ticket-status-open { color: #ffb2a6; background: #472824; }
html[data-theme="dark"] .state-overdue { color: #fff; background: var(--red-600); }
html[data-theme="dark"] .state-available,
html[data-theme="dark"] .ticket-status-resolved,
html[data-theme="dark"] .ticket-status-closed,
html[data-theme="dark"] .import-create { color: #82dfbd; background: #173a31; }
html[data-theme="dark"] .state-returned,
html[data-theme="dark"] .priority-normal,
html[data-theme="dark"] .ticket-status-in_progress,
html[data-theme="dark"] .import-update { color: #9bcaee; background: #19364d; }
html[data-theme="dark"] .priority-high,
html[data-theme="dark"] .ticket-status-waiting { color: #f0cc79; background: #493a1a; }
html[data-theme="dark"] .priority-urgent,
html[data-theme="dark"] .import-error { color: #ffafb3; background: #472326; }
html[data-theme="dark"] .import-warning,
html[data-theme="dark"] .no-owned-items { color: #ffb0a6 !important; background: #402426; }

@media (max-width: 1200px) {
  .portal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .employee-grid, .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: repeat(4, 1fr); }
  .ticket-detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 850px) {
  .site-header { align-items: flex-start; padding-top: 1rem; padding-bottom: 1rem; }
  .top-nav { flex-wrap: wrap; justify-content: flex-end; }
  .brand-copy strong { font-size: .78rem; }
  .hero { min-height: 0; flex-direction: column; align-items: stretch; padding-top: 3rem; padding-bottom: 3rem; }
  .status-card { min-width: 0; max-width: 380px; }
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-columns, .kiosk-actions { grid-template-columns: 1fr; }
  .employee-grid, .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-sidebar nav { display: flex; overflow-x: auto; }
  .admin-sidebar nav a { white-space: nowrap; }
  .admin-two-column { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: repeat(2, 1fr); }
  .support-hero { flex-direction: column; align-items: flex-start; }
  .support-layout, .ticket-detail-grid { grid-template-columns: 1fr; }
  .ticket-metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .site-header { display: block; }
  .top-nav { margin-top: .8rem; justify-content: flex-start; }
  .top-nav > a, .nav-button { padding: .55rem .6rem; font-size: .8rem; }
  .hero h1 { font-size: 2.5rem; }
  .link-section { width: min(100% - 1.5rem, 1460px); }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card { min-height: 145px; }
  .section-heading, .admin-heading { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .kiosk-header { padding: .8rem; }
  .kiosk-header-actions { gap: .55rem; }
  .kiosk-header .theme-picker select { min-width: 108px; }
  .kiosk-clock small { display: none; }
  .kiosk-main { width: calc(100% - 1rem); padding-top: 1rem; }
  .status-list { grid-template-columns: 1fr; }
  .kiosk-action { min-height: 115px; }
  .employee-grid, .item-grid, .pin-entry { grid-template-columns: 1fr; }
  .admin-layout { width: calc(100% - 1rem); margin-top: .5rem; }
  .metric-grid, .filter-bar, .form-grid, .import-summary { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .button-row { width: 100%; }
  .button-row .button { flex: 1; }
  .site-footer { flex-direction: column; }
  .support-layout { width: calc(100% - 1rem); }
  .support-submit-row { align-items: stretch; flex-direction: column; }
  .support-submit-row .button { width: 100%; }
  .confirmation-details, .ticket-metric-grid { grid-template-columns: 1fr; }
  .confirmation-details div, .confirmation-details div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); border-right: 0; }
  .confirmation-details div:last-child { border-bottom: 0; }
  .ticket-description dl { grid-template-columns: 1fr; gap: 1rem; }
}

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

@media print {
  html[data-theme="dark"] { color-scheme: light; --ink: #152235; --muted: #637083; --line: #dce3eb; --surface: #ffffff; --canvas: #ffffff; }
  .site-header, .site-footer, .admin-sidebar, .admin-heading .button-row, .filter-bar { display: none !important; }
  body { background: #fff; }
  .admin-layout { display: block; width: 100%; margin: 0; }
  .admin-card { border: 0; box-shadow: none; }
}
