:root {
  --navy: #12304f;
  --navy-2: #1e456a;
  --orange: #ef8600;
  --orange-dark: #c96500;
  --ice: #edf4f7;
  --surface: #ffffff;
  --line: #d7e2e8;
  --muted: #60788a;
  --ink: #10273c;
  --green: #17815c;
  --red: #b63b3b;
  --blue-soft: #e7f4fa;
  --orange-soft: #fff2df;
  --shadow: 0 12px 35px rgba(20, 48, 72, .11);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ice);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ice); }
body { margin: 0; min-height: 100vh; background: var(--ice); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }
.eyebrow { display: block; color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 4.5rem); line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: .25rem; font-size: clamp(1.45rem, 2.4vw, 2rem); letter-spacing: -.025em; }
h3 { margin-bottom: .35rem; font-size: 1.08rem; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); background: var(--navy); }
.login-brand { padding: clamp(3rem, 8vw, 8rem); align-content: center; color: white; background: radial-gradient(circle at 20% 10%, #285b83, transparent 34%), linear-gradient(145deg, #12304f, #0a2239); }
.login-brand .eyebrow { color: #9fd6ef; }
.login-brand h1 { max-width: 770px; margin: 1.2rem 0 1.5rem; }
.login-brand p { max-width: 570px; color: #c2d6e5; font-size: 1.15rem; line-height: 1.65; }
.login-card { width: min(440px, calc(100% - 3rem)); margin: auto; padding: clamp(2rem, 4vw, 3rem); display: grid; gap: 1.25rem; border-radius: 24px; background: white; box-shadow: var(--shadow); }
.brand-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: var(--orange); color: white; font-size: 1.25rem; font-weight: 900; box-shadow: 0 8px 24px rgba(239, 134, 0, .28); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 12px; font-size: .9rem; }
label { display: grid; gap: .45rem; color: #2c465d; font-size: .85rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 48px; padding: .75rem .85rem; border: 1.5px solid #bfd0da; border-radius: 11px; outline: 0; color: var(--ink); background: white; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4385b4; box-shadow: 0 0 0 3px rgba(67, 133, 180, .15); }
input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--orange); }
.form-error { min-height: 1.1rem; margin: 0; color: var(--red); font-size: .85rem; font-weight: 700; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: 72px 1fr; }
.topbar { position: sticky; top: 0; z-index: 20; grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: var(--navy); color: white; box-shadow: 0 2px 12px rgba(5, 27, 45, .2); }
.brand, .topbar-actions, .user-chip { display: flex; align-items: center; gap: .75rem; }
.brand div, .user-chip div { display: grid; }
.brand small, .user-chip small { color: #acc3d4; font-size: .72rem; }
.user-chip { padding-left: .5rem; }
.user-chip > span { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #4a6984; border-radius: 50%; background: #244968; font-weight: 850; }
.user-chip strong { font-size: .82rem; }
.sidebar { position: sticky; top: 72px; height: calc(100vh - 72px); padding: 1.25rem .9rem; display: flex; flex-direction: column; justify-content: space-between; background: #173957; color: white; }
.sidebar nav, .sidebar-foot { display: grid; gap: .35rem; }
.sidebar button { width: 100%; padding: .82rem .9rem; display: flex; gap: .8rem; align-items: center; border: 0; border-radius: 11px; color: #c7d7e3; background: transparent; text-align: left; font-weight: 720; }
.sidebar button span { width: 22px; font-size: 1.25rem; text-align: center; }
.sidebar button:hover, .sidebar button.active { color: white; background: #28516f; }
.sidebar button.active { box-shadow: inset 3px 0 var(--orange); }
.sidebar-foot small { padding: .4rem .9rem; color: #86a7bd; }
.main-content { min-width: 0; padding: clamp(1.15rem, 2.6vw, 2.5rem); }
.page { width: min(1320px, 100%); margin: 0 auto; }
.page-header { margin-bottom: 1.35rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.page-header p { margin: .25rem 0 0; color: var(--muted); }
.page-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.bottom-nav { display: none; }

.button { min-height: 44px; padding: .7rem 1rem; border: 1.5px solid transparent; border-radius: 11px; color: var(--ink); background: white; font-weight: 820; transition: transform .12s, background .12s; }
.button:active { transform: translateY(1px); }
.button.primary { color: #142b3e; border-color: #d27300; background: var(--orange); box-shadow: 0 6px 16px rgba(239, 134, 0, .2); }
.button.primary:hover { background: #ff9818; }
.button.secondary { border-color: var(--line); background: #f8fbfc; }
.button.ghost { color: white; border-color: #52718a; background: transparent; }
.button.danger { color: white; background: var(--red); }
.button.wide { width: 100%; }
.button.compact { min-height: 36px; padding: .45rem .75rem; font-size: .8rem; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.icon-button { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font-size: 1.35rem; }
.status-pill { display: inline-flex; gap: .45rem; align-items: center; padding: .42rem .7rem; border-radius: 999px; color: #d8e7f0; background: #244968; font-size: .74rem; font-weight: 750; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: #3bd18b; box-shadow: 0 0 0 3px rgba(59, 209, 139, .14); }
.status-pill.offline i { background: #ffba5c; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card { min-height: 132px; padding: 1.2rem; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 6px 22px rgba(25, 55, 77, .06); }
.metric-card strong { font-size: 2.25rem; letter-spacing: -.04em; }
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card.accent { color: white; border-color: var(--navy-2); background: linear-gradient(145deg, var(--navy-2), var(--navy)); }
.metric-card.accent span { color: #c0d6e5; }
.system-metrics .metric-card { min-height: 112px; }
.system-metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.system-value { font-size: 1.35rem !important; }
.system-value.ready { color: var(--green); }
.system-value.pending { color: var(--orange-dark); }
.migration-result { min-height: 58px; padding: .8rem 1rem; display: grid; gap: .2rem; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfc; color: var(--muted); }
.migration-result strong { color: var(--ink); }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.action-card { min-height: 172px; padding: 1.3rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); text-align: left; box-shadow: 0 6px 20px rgba(25, 55, 77, .05); }
.action-card:hover { border-color: #9fc1d3; transform: translateY(-1px); }
.action-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--navy-2); font-size: 1.4rem; font-weight: 900; }
.action-card.orange .action-icon { color: var(--orange-dark); background: var(--orange-soft); }
.action-card p { margin: .2rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }

.panel { margin-bottom: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 7px 25px rgba(25, 55, 77, .055); overflow: hidden; }
.panel-header { padding: 1rem 1.15rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.panel-header h3, .panel-header p { margin: 0; }
.panel-header p { margin-top: .15rem; color: var(--muted); font-size: .82rem; }
.panel-body { padding: 1.15rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.span-2 { grid-column: 1 / -1; }
.inline-check { min-height: 48px; padding: .7rem .85rem; display: flex; align-items: center; gap: .65rem; border: 1.5px solid var(--line); border-radius: 11px; background: #f8fbfc; }
.inline-check input { flex: 0 0 auto; }
.form-actions { margin-top: 1.15rem; display: flex; justify-content: flex-end; gap: .7rem; }
.section-title { margin: 1.5rem 0 .8rem; display: flex; justify-content: space-between; align-items: center; }
.section-title h3 { margin: 0; }
.section-title small { color: var(--muted); }
.quantity-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.quantity-field { padding: .75rem; border: 1.5px solid var(--line); border-radius: 13px; background: #f8fbfc; }
.quantity-field:focus-within { border-color: #6c9fbd; background: white; }
.quantity-field strong { display: block; color: var(--navy-2); }
.quantity-field small { min-height: 2.2em; display: block; color: var(--muted); font-weight: 550; }
.quantity-field input { min-height: 42px; margin-top: .4rem; padding: .45rem .6rem; text-align: center; font-size: 1.2rem; font-weight: 850; }
.more-quantities { margin-top: 1rem; border: 1px solid var(--line); border-radius: 13px; background: #f8fbfc; }
.more-quantities summary { padding: .9rem 1rem; color: var(--navy-2); font-weight: 820; cursor: pointer; }
.more-quantities[open] summary { border-bottom: 1px solid var(--line); }
.more-quantities .quantity-grid { padding: 1rem; }
.upload-box { padding: 1.2rem; display: grid; place-items: center; gap: .7rem; border: 2px dashed #92b6ca; border-radius: 14px; background: var(--blue-soft); text-align: center; }
.upload-box input { max-width: 520px; min-height: 0; border: 0; background: transparent; }
.upload-box input[type="file"] { min-height: 46px; padding: .24rem; overflow: hidden; border: 1px solid #bfd1db; border-radius: 10px; color: transparent; background: white; }
.upload-box input[type="file"]::file-selector-button { height: 36px; margin-right: .4rem; padding: 0 .8rem; border: 0; border-radius: 7px; color: #244d68; background: #e7f2f7; font-weight: 800; cursor: pointer; }
.upload-box p { margin: 0; color: var(--muted); font-size: .82rem; }

.cards-list { display: grid; gap: .75rem; }
.operation-card { padding: 1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .8rem; align-items: center; border: 1px solid var(--line); border-left: 5px solid var(--orange); border-radius: 14px; background: white; }
.operation-card h3 { margin: 0 0 .25rem; }
.operation-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.operation-meta { margin-top: .55rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { padding: .28rem .52rem; border-radius: 999px; color: #38596d; background: var(--ice); font-size: .7rem; font-weight: 800; }
.empty-state { padding: 3rem 1.25rem; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 1.1rem; }

.count-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.counter { padding: 1rem; border: 1.5px solid var(--line); border-radius: 15px; background: #f8fbfc; }
.counter-head { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.counter-head strong { color: var(--navy-2); font-size: 1.05rem; }
.counter-head span { color: var(--muted); font-size: .75rem; }
.counter-total { margin: .45rem 0; font-size: 2.4rem; font-weight: 900; line-height: 1; }
.counter-diff { font-size: .75rem; font-weight: 800; }
.counter-diff.ok { color: var(--green); }
.counter-diff.warn { color: var(--orange-dark); }
.counter-buttons { margin-top: .8rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.counter-buttons button { min-height: 48px; border: 1px solid #b8d1de; border-radius: 10px; color: var(--navy-2); background: white; font-weight: 900; }
.counter-buttons button.add { color: white; border-color: var(--navy-2); background: var(--navy-2); }
.sync-banner { margin-bottom: .8rem; padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: 12px; color: #754500; background: #fff0d5; font-size: .82rem; font-weight: 750; }

.toolbar { padding: .85rem; display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(140px, .35fr)) auto; gap: .65rem; border-bottom: 1px solid var(--line); background: #f8fbfc; }
.toolbar input, .toolbar select { min-height: 42px; }
.table-wrap { max-width: 100%; overflow: auto; }
.data-table { width: 100%; min-width: 1160px; border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.users-table { min-width: 760px; }
.users-table input, .users-table select { min-height: 38px; padding: .4rem .55rem; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: .72rem .65rem; border-bottom: 1px solid #abc2d0; color: white; background: var(--navy-2); text-align: left; white-space: nowrap; }
.data-table td { padding: .68rem .65rem; border-bottom: 1px solid #e3ebef; background: white; white-space: nowrap; }
.data-table tbody tr:hover td { background: #f2f8fb; }
.data-table tbody tr.selected td { background: #fff5e6; }
.data-table .cell-button { padding: .25rem .45rem; border: 0; color: #176592; background: transparent; font-weight: 800; text-decoration: underline; }
.pagination { padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.pagination small { color: var(--muted); }
.pagination div { display: flex; gap: .45rem; }

.dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(5, 25, 42, .3); overflow: auto; }
.dialog::backdrop { background: rgba(7, 27, 43, .58); backdrop-filter: blur(3px); }
.dialog form > header, .dialog form > footer { position: sticky; z-index: 2; padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: white; }
.dialog form > header { top: 0; border-bottom: 1px solid var(--line); }
.dialog form > footer { bottom: 0; justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog .form-grid { padding: 1.2rem; }
.dialog h2 { margin: 0; }
.detail-dialog { width: min(980px, calc(100% - 2rem)); }
.detail-dialog > div > header, .detail-dialog > div > footer { position: sticky; z-index: 3; padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: white; }
.detail-dialog > div > header { top: 0; border-bottom: 1px solid var(--line); }
.detail-dialog > div > footer { bottom: 0; justify-content: flex-end; border-top: 1px solid var(--line); }
.detail-content { padding: 1.2rem; display: grid; gap: 1rem; background: #f5f9fb; }
.detail-section { padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: white; }
.detail-section > h3 { margin: 0 0 .8rem; color: var(--navy-2); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.detail-value { min-width: 0; padding: .7rem .8rem; display: grid; gap: .22rem; border-radius: 10px; background: #f4f8fa; }
.detail-value span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.detail-value strong { overflow-wrap: anywhere; }
.detail-table { min-width: 560px; }
.detail-note, .muted-line { margin: 0; color: var(--muted); white-space: pre-wrap; }
.inline-button { display: inline-flex; align-items: center; text-decoration: none; }
.timeline { display: grid; gap: .55rem; }
.timeline article { padding: .65rem .8rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; border-left: 3px solid #7eb2ce; border-radius: 0 9px 9px 0; background: #f5f9fb; }
.timeline article span { color: var(--muted); font-size: .72rem; }
.timeline article p { grid-column: 1 / -1; margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.audit-list article { border-left-color: var(--orange); }
.edit-quantities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toast-region { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; width: min(380px, calc(100% - 2rem)); display: grid; gap: .6rem; }
.toast { padding: .9rem 1rem; border-left: 4px solid #5fa8cf; border-radius: 11px; color: white; background: #17344c; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { border-color: #ff7777; }
.toast.success { border-color: #40d18d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Operational visual language */
body {
  background:
    linear-gradient(rgba(223, 233, 238, .44) 1px, transparent 1px),
    linear-gradient(90deg, rgba(223, 233, 238, .44) 1px, transparent 1px),
    var(--ice);
  background-size: 34px 34px;
}
.main-content { background: linear-gradient(180deg, rgba(245, 249, 251, .96), rgba(237, 244, 247, .94)); }
.topbar { border-bottom: 1px solid rgba(151, 190, 213, .18); }
.shift-context { padding: .42rem .72rem; border: 1px solid #496983; border-radius: 8px; color: #c5d6e2; font-size: .72rem; font-weight: 750; letter-spacing: .02em; }
.login-brand { position: relative; overflow: hidden; }
.login-brand::before { content: ""; position: absolute; inset: 8% -12% auto auto; width: 42vw; height: 42vw; border: 1px solid rgba(133, 188, 219, .2); border-radius: 50%; box-shadow: 0 0 0 70px rgba(91, 158, 194, .05), 0 0 0 140px rgba(91, 158, 194, .035); }
.login-brand > * { position: relative; z-index: 1; }
.login-flow { width: min(620px, 100%); margin-top: 2.2rem; display: flex; align-items: center; gap: .8rem; }
.login-flow span { display: grid; gap: .18rem; color: #d7e5ef; font-size: .78rem; font-weight: 800; }
.login-flow b { color: #ffab40; font-size: .66rem; letter-spacing: .12em; }
.login-flow i { flex: 1; height: 1px; background: #4f7591; }
.day-chip, .draft-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border: 1px solid #c8d9e2; border-radius: 999px; color: #38566d; background: rgba(255,255,255,.75); font-size: .76rem; font-weight: 800; }
.day-chip i { width: 8px; height: 8px; border-radius: 50%; background: #24a978; box-shadow: 0 0 0 4px rgba(36,169,120,.12); }
.draft-chip::before { content: "✓"; color: var(--green); }

.operations-hero { margin-bottom: 1.25rem; display: grid; grid-template-columns: minmax(310px, .9fr) minmax(440px, 1.25fr); overflow: hidden; border-radius: 22px; color: white; background: #102e4a; box-shadow: 0 18px 45px rgba(15, 47, 74, .2); }
.hero-status { position: relative; min-height: 242px; padding: 1.7rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; overflow: hidden; background: linear-gradient(145deg, #173e60, #0f2f4b); }
.hero-status::after { content: ""; position: absolute; right: -75px; bottom: -125px; width: 260px; height: 260px; border: 46px solid rgba(239,134,0,.16); border-radius: 50%; }
.hero-status .eyebrow { color: #8fc5df; }
.hero-status > strong { margin: .5rem 0 .3rem; font-size: clamp(2rem, 3vw, 3.25rem); line-height: .98; letter-spacing: -.045em; }
.hero-status p { max-width: 430px; margin-bottom: 1.15rem; color: #bed1df; }
.button.light { position: relative; z-index: 1; border-color: white; background: white; }
.hero-metrics { padding: 1.1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; align-items: stretch; background: #f8fbfc; }
.hero-metric { min-width: 0; padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; gap: 1.2rem; border: 1px solid #d9e5eb; border-radius: 15px; color: var(--ink); background: white; }
.hero-metric-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #246a94; background: #e7f4fa; font-weight: 900; }
.hero-metric.teal .hero-metric-icon { color: #14715f; background: #e3f5ef; }
.hero-metric.orange .hero-metric-icon { color: #9a5800; background: #fff0d8; }
.hero-metric.green .hero-metric-icon { color: #14715f; background: #e3f5ef; }
.hero-metric strong { display: block; font-size: 2.35rem; line-height: 1; letter-spacing: -.045em; }
.hero-metric small { color: var(--muted); font-weight: 750; }
.workflow-heading { margin: 1.7rem 0 .75rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.workflow-heading h3 { margin: .2rem 0 0; font-size: 1.35rem; }
.workflow-heading > span { color: var(--muted); font-size: .75rem; font-weight: 700; }
.operational-actions .action-card { position: relative; min-height: 190px; overflow: hidden; }
.operational-actions .action-card > div > small { color: var(--muted); font-size: .64rem; font-weight: 900; letter-spacing: .13em; }
.operational-actions .action-card > b { position: absolute; right: 1.2rem; top: 1.25rem; color: #66869a; font-size: 1.3rem; }
.operational-actions .action-card::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 4px; background: #4a99c6; }
.operational-actions .action-card.count::after { background: var(--orange); }
.operational-actions .action-card.outbound::after { background: #24a078; }
.operational-actions .action-icon { width: 48px; height: 48px; color: #246a94; background: #e6f3f9; font-size: .85rem; letter-spacing: .08em; }
.operational-actions .count .action-icon { color: #9b5900; background: #fff0d9; }
.operational-actions .outbound .action-icon { color: #176d59; background: #e2f4ee; }
.operation-card { grid-template-columns: 48px minmax(0, 1fr) auto; border-left-width: 1px; box-shadow: 0 5px 18px rgba(24, 57, 79, .055); }
.operation-direction { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #9c5b00; background: var(--orange-soft); font-size: 1.35rem; font-weight: 900; }
.operation-card .eyebrow { margin-bottom: .25rem; }
.status-open { color: #8a4f00; background: #fff0d7; }

.workflow-rail { margin: -.25rem 0 1.15rem; padding: .75rem 1rem; display: flex; align-items: center; gap: .6rem; border: 1px solid #d1e0e7; border-radius: 14px; background: rgba(255,255,255,.8); }
.workflow-rail > div { display: flex; align-items: center; gap: .55rem; color: #7890a0; font-size: .75rem; }
.workflow-rail > div > span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #c8d8e0; border-radius: 50%; color: #668092; background: white; font-size: .65rem; font-weight: 900; }
.workflow-rail > div.active { color: var(--ink); }
.workflow-rail > div.active > span { color: white; border-color: var(--navy-2); background: var(--navy-2); box-shadow: 0 0 0 4px rgba(30,69,106,.1); }
.workflow-rail > div.done > span { color: white; border-color: var(--green); background: var(--green); }
.workflow-rail > i { flex: 1; height: 1px; background: #cddce4; }
.task-panel { border-color: #cfdde5; }
.task-panel > .panel-header { background: linear-gradient(90deg, #fbfdfe, white); }
.panel-header.numbered { justify-content: flex-start; }
.panel-header.numbered > span:first-child { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--navy-2); font-size: .82rem; font-weight: 900; }
.panel-header.numbered > div { flex: 1; }
.optional-mark, .quantity-hint { padding: .36rem .55rem; border-radius: 7px; color: #61798a; background: #edf4f7; font-size: .68rem; font-weight: 800; }
.upload-box { grid-template-columns: auto minmax(220px, 1fr) minmax(260px, .7fr) auto; justify-items: stretch; text-align: left; }
.upload-box .camera-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; color: #286b92; background: white; font-size: 1.35rem; box-shadow: 0 5px 16px rgba(22, 68, 95, .08); }
.upload-box > div:nth-child(2) { align-self: center; }
.upload-box > div p { margin: .2rem 0 0; }
.upload-box .form-feedback { grid-column: 2 / -1; color: var(--muted); font-size: .78rem; font-weight: 700; }
.arrival-meta { max-width: 720px; margin-bottom: 1rem; }
.no-guide-check { margin-bottom: 1rem; align-items: center; justify-content: flex-start; }
.no-guide-check > span { display: grid; gap: .15rem; }
.no-guide-check small { color: var(--muted); font-weight: 550; }
.comparison-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) 36px minmax(260px, .65fr); align-items: stretch; }
.source-card { padding: 1rem; border: 1px solid #cadde7; border-radius: 14px; background: #eef7fb; transition: opacity .18s, filter .18s; }
.arrival-source { border-color: #f1d4ac; background: #fff5e8; }
.source-title { margin-bottom: .9rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.source-title span { color: #367398; font-size: .65rem; font-weight: 900; letter-spacing: .13em; }
.arrival-source .source-title span { color: #a75f00; }
.source-title b { font-size: .8rem; }
.source-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; }
.wide-field { grid-column: 1 / -1; }
.comparison-arrow { display: grid; place-items: center; color: #6b8292; font-size: 1.2rem; font-weight: 900; }
.arrival-fields { grid-template-columns: 1fr; }
.arrival-note { padding: .8rem; border: 1px dashed #e2b97f; border-radius: 10px; color: #775020; background: rgba(255,255,255,.6); }
.arrival-note p { margin: .2rem 0 0; font-size: .76rem; }
.disabled-source { opacity: .48; filter: grayscale(.65); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.document-capture { display: grid; gap: 1rem; }
.capture-intro { padding: 1rem; display: flex; align-items: center; gap: .9rem; border: 1px solid #c9dce6; border-radius: 14px; background: linear-gradient(135deg, #edf7fb, #f8fcfd); }
.capture-intro .camera-mark { width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; color: #286b92; background: white; font-size: 1.35rem; box-shadow: 0 5px 16px rgba(22, 68, 95, .08); }
.capture-intro > div { display: grid; gap: .14rem; }
.capture-intro > div > strong { font-size: 1.03rem; }
.capture-intro p { margin: 0; color: var(--muted); font-size: .78rem; }
.capture-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.capture-choice { min-width: 0; min-height: 94px; padding: .9rem 1rem; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: .8rem; border: 1.5px solid #bfd4df; border-radius: 14px; color: var(--ink); background: white; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.capture-choice:hover { border-color: #5d9abb; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(22, 66, 92, .09); }
.capture-choice.camera-choice { color: white; border-color: #1d5277; background: linear-gradient(135deg, #214f70, #123956); }
.capture-choice > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: #23698f; background: #e6f3f9; font-size: 1.25rem; font-weight: 900; }
.capture-choice.camera-choice > span { color: white; background: rgba(255,255,255,.13); }
.capture-choice > div { min-width: 0; display: grid; gap: .18rem; }
.capture-choice strong { font-size: .9rem; }
.capture-choice small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.capture-choice.camera-choice small { color: #bdd3e1; }
.capture-choice > b { color: #6b899a; font-size: 1.15rem; }
.capture-choice.camera-choice > b { color: #bdd3e1; }
.selected-guide { min-height: 70px; }
.document-empty, .document-ready { min-height: 70px; padding: .7rem .8rem; display: flex; align-items: center; gap: .8rem; border: 1px dashed #c4d5de; border-radius: 12px; color: #61798a; background: #f8fbfc; }
.document-empty > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; background: #e8f1f5; font-size: 1.1rem; }
.document-empty > div, .document-ready > div { min-width: 0; flex: 1; display: grid; gap: .12rem; }
.document-empty strong, .document-ready strong { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-empty small, .document-ready small { font-size: .7rem; }
.document-ready { border-style: solid; border-color: #a9d7c6; color: #476b5e; background: #eef9f5; }
.document-ready img { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 8px; object-fit: cover; background: white; }
.pdf-mark { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: #9e3f3f; background: #fff0f0; font-size: .72rem; font-weight: 900; }
.ocr-action-row { padding-top: .85rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid #e0e9ed; }
.ocr-action-row .form-feedback { color: var(--muted); font-size: .76rem; font-weight: 700; }

.camera-dialog { width: min(840px, calc(100% - 1rem)); max-height: calc(100vh - 1rem); padding: 0; overflow: hidden; border: 0; border-radius: 22px; color: white; background: #0a1d2d; box-shadow: 0 35px 100px rgba(0, 13, 24, .55); }
.camera-dialog::backdrop { background: rgba(2, 14, 24, .82); backdrop-filter: blur(5px); }
.camera-shell > header, .camera-shell > footer { padding: 1rem 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #102d45; }
.camera-shell > header { border-bottom: 1px solid #27475f; }
.camera-shell > footer { justify-content: flex-end; border-top: 1px solid #27475f; }
.camera-shell h2 { margin: .1rem 0 0; color: white; font-size: 1.25rem; }
.camera-shell .eyebrow { color: #8ec2dc; }
.camera-shell .icon-button { color: white; border-color: #46657b; background: #173b56; }
.camera-viewport { position: relative; min-height: 420px; display: grid; place-items: center; overflow: hidden; background: #050d14; }
.camera-viewport video { width: 100%; max-height: calc(100vh - 190px); display: block; object-fit: contain; background: #050d14; }
.camera-viewport > p { position: absolute; z-index: 3; inset: auto 1rem .8rem; margin: 0; padding: .48rem .7rem; border-radius: 8px; color: #d8e6ee; background: rgba(4, 18, 28, .75); text-align: center; font-size: .72rem; }
.camera-frame { position: absolute; z-index: 2; inset: 8% 12% 15%; pointer-events: none; }
.camera-frame span { position: absolute; width: 50px; height: 50px; border-color: #ff9b1c; border-style: solid; }
.camera-frame span:nth-child(1) { inset: 0 auto auto 0; border-width: 4px 0 0 4px; }
.camera-frame span:nth-child(2) { inset: 0 0 auto auto; border-width: 4px 4px 0 0; }
.camera-frame span:nth-child(3) { inset: auto auto 0 0; border-width: 0 0 4px 4px; }
.camera-frame span:nth-child(4) { inset: auto 0 0 auto; border-width: 0 4px 4px 0; }
.quantity-field { position: relative; padding-top: .85rem; background: #fbfdfe; }
.quantity-field strong { font-size: .78rem; letter-spacing: .08em; }
.quantity-field input { border-color: #d4e0e6; background: white; }
.more-quantities summary { display: flex; justify-content: space-between; }
.more-quantities summary b { color: var(--muted); font-size: .72rem; }
.sticky-actions { padding-top: 1rem; border-top: 1px solid #e2eaee; }

.count-command { margin-bottom: 1rem; padding: 1.2rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; border-radius: 18px; color: white; background: linear-gradient(135deg, #133653, #1d4a6c); box-shadow: 0 12px 30px rgba(16, 47, 74, .18); }
.count-command .eyebrow { color: #93c5de; }
.count-command h3 { margin: .25rem 0; font-size: 1.45rem; }
.count-command p { margin: 0; color: #c7d8e3; }
.count-overview { display: flex; align-items: center; gap: .55rem; }
.count-overview > span { min-width: 104px; padding: .65rem .8rem; display: grid; gap: .1rem; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(255,255,255,.08); }
.count-overview small { color: #a9c3d4; font-size: .57rem; font-weight: 900; letter-spacing: .1em; }
.count-overview b { font-size: 1.35rem; }
.count-overview .has-difference { border-color: rgba(255,181,79,.4); background: rgba(239,134,0,.18); }
.count-overview .all-matched { border-color: rgba(83,214,162,.38); background: rgba(29,143,101,.22); }
.count-panel > .panel-header { background: #fbfdfe; }
.counter { position: relative; overflow: hidden; background: white; }
.counter::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--orange); }
.counter.matched::before { background: var(--green); }
.counter.over::before { background: #b96028; }
.counter-head > div { display: grid; gap: .12rem; }
.asset-code { color: #607b8d; font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.declared-value { padding: .3rem .48rem; border-radius: 7px; color: #587183 !important; background: #edf4f7; }
.declared-value b { color: var(--ink); }
.counter-readout { margin: .75rem 0; display: grid; grid-template-columns: auto 1fr; align-items: end; gap: .1rem .5rem; }
.counter-readout small { color: #6b8495; font-size: .6rem; font-weight: 900; letter-spacing: .12em; }
.counter-readout > strong { grid-row: 2; font-size: 3rem; line-height: .9; letter-spacing: -.055em; }
.counter-readout .counter-diff { grid-row: 2; align-self: center; justify-self: end; padding: .32rem .48rem; border-radius: 7px; background: #fff1dd; }
.counter-readout .counter-diff.ok { background: #e4f5ee; }
.counter-buttons button { min-height: 54px; font-size: 1rem; }
.counter-buttons button:disabled { opacity: .35; }
.add-asset-row { margin-top: 1.2rem; padding: 1rem; display: grid; grid-template-columns: minmax(220px,1fr) minmax(260px,.8fr) auto; gap: 1rem; align-items: end; border: 1px dashed #bfd1db; border-radius: 14px; background: #f7fafb; }
.add-asset-row h3, .add-asset-row p { margin: .15rem 0 0; }
.add-asset-row p { color: var(--muted); font-size: .75rem; }
.close-title { padding-top: 1.3rem; border-top: 1px solid #e0e9ed; }
.close-gate { margin-bottom: 1rem; padding: .9rem 1rem; display: flex; align-items: center; gap: .8rem; border-radius: 12px; }
.close-gate > span { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-weight: 900; }
.close-gate p { margin: .15rem 0 0; font-size: .76rem; }
.close-gate.ready { color: #175e48; border: 1px solid #a9d8c7; background: #e8f6f1; }
.close-gate.ready > span { color: white; background: var(--green); }
.close-gate.warning { grid-template-columns: auto auto 1fr; color: #754b11; border: 1px solid #e7c58e; background: #fff4e2; cursor: pointer; }
.close-gate.warning input { width: 22px; min-height: 22px; }
.close-gate.warning > span { color: white; background: var(--orange-dark); }

.dispatch-selector .panel-body { padding: 1rem; }
.dispatch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.dispatch-option { min-width: 0; padding: .75rem; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: .65rem; align-items: center; border: 1.5px solid #d4e1e7; border-radius: 12px; color: var(--ink); background: white; text-align: left; }
.dispatch-option:hover { border-color: #8ab3c9; background: #f7fbfd; }
.dispatch-option.active { border-color: var(--navy-2); background: #edf6fa; box-shadow: 0 0 0 3px rgba(30,69,106,.08); }
.dispatch-option > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: #286789; background: #e4f2f8; font-size: .7rem; font-weight: 900; }
.dispatch-option > div { min-width: 0; display: grid; gap: .12rem; }
.dispatch-option strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.dispatch-option small { color: var(--muted); font-size: .66rem; }
.dispatch-option > b { color: #7290a3; }
.dispatch-mobile-select { display: none; }
.dispatch-form { animation: form-enter .18s ease-out; }
@keyframes form-enter { from { opacity: .5; transform: translateY(5px); } }

.data-table th { letter-spacing: .025em; }
.data-table tbody tr:nth-child(even) td { background: #fbfdfe; }
.cell-button { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid rgba(239,134,0,.38); outline-offset: 2px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .quantity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .operations-hero { grid-template-columns: 1fr; }
  .hero-status { min-height: 205px; }
  .comparison-grid { grid-template-columns: 1fr; gap: .7rem; }
  .comparison-arrow { height: 28px; transform: rotate(90deg); }
  .dispatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .count-command { grid-template-columns: 1fr; }
  .count-overview { justify-content: stretch; }
  .count-overview > span { flex: 1; }
}

@media (max-width: 1200px) and (min-width: 821px) {
  .upload-box { grid-template-columns: auto minmax(180px, 1fr) minmax(250px, .8fr); }
  .upload-box .camera-mark { grid-column: 1; grid-row: 1 / 3; }
  .upload-box > div:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }
  .upload-box > input { grid-column: 3; grid-row: 1; }
  .upload-box > button { grid-column: 3; grid-row: 2; }
  .upload-box .form-feedback { grid-column: 2 / -1; grid-row: 3; }
}

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .app-shell { display: block; padding-bottom: 72px; }
  .topbar { height: 64px; padding: 0 .75rem; }
  .brand small, .user-chip div, .topbar .status-pill { display: none; }
  .mobile-only { display: inline-grid; place-items: center; }
  .sidebar { position: fixed; z-index: 40; top: 64px; left: 0; width: min(280px, 82vw); height: calc(100vh - 64px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 1rem .8rem; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .page-actions { width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
  .page-header .page-actions > * { flex: 0 0 auto; }
  .shift-context { display: none; }
  .bottom-nav { position: fixed; z-index: 30; inset: auto 0 0; height: 68px; padding: .35rem max(.35rem, env(safe-area-inset-right)) max(.35rem, env(safe-area-inset-bottom)) max(.35rem, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid #2e516e; background: var(--navy); }
  .bottom-nav button { border: 0; border-radius: 9px; color: #9fb7c9; background: transparent; font-size: .64rem; font-weight: 750; }
  .bottom-nav button span { display: block; margin-bottom: .1rem; font-size: 1.25rem; }
  .bottom-nav button.active { color: white; background: #254c6b; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid .metric-card:last-child { grid-column: 1 / -1; }
  .action-grid { grid-template-columns: 1fr; }
  .action-card { min-height: 132px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .quantity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operation-card { grid-template-columns: 1fr; }
  .operation-direction { display: none; }
  .operation-card .button { width: 100%; }
  .toolbar { grid-template-columns: 1fr; }
  .page-actions .button span { display: inline; }
  .detail-dialog { width: calc(100% - 1rem); max-height: calc(100vh - 1rem); }
  .detail-content { padding: .7rem; }
  .detail-section { padding: .8rem; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline article { grid-template-columns: 1fr; }
  .timeline article p { grid-column: auto; }
  .edit-quantities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-rail { padding: .65rem; }
  .workflow-rail > div { flex: 1; justify-content: center; }
  .workflow-rail > div b { display: none; }
  .workflow-rail > i { flex: .35; }
  .operations-hero { border-radius: 17px; }
  .hero-status { min-height: 220px; padding: 1.25rem; }
  .hero-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); padding: .65rem; gap: .45rem; }
  .hero-metric { padding: .7rem; gap: .65rem; }
  .hero-metric strong { font-size: 1.8rem; }
  .hero-metric small { font-size: .62rem; }
  .workflow-heading > span { display: none; }
  .upload-box { grid-template-columns: 1fr; text-align: center; }
  .upload-box > * { grid-column: auto !important; grid-row: auto !important; }
  .upload-box .camera-mark { margin: auto; }
  .upload-box .form-feedback { grid-column: auto; }
  .capture-actions { grid-template-columns: 1fr; }
  .capture-choice { min-height: 84px; }
  .ocr-action-row { align-items: stretch; flex-direction: column; }
  .ocr-action-row .button { width: 100%; }
  .document-ready { align-items: flex-start; flex-wrap: wrap; }
  .document-ready .button { margin-left: auto; }
  .camera-dialog { width: 100%; max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
  .camera-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
  .camera-viewport { min-height: 0; }
  .camera-viewport video { height: 100%; max-height: none; object-fit: cover; }
  .source-fields { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .panel-header.numbered { align-items: flex-start; }
  .optional-mark, .quantity-hint { display: none; }
  .add-asset-row { grid-template-columns: 1fr; align-items: stretch; }
  .count-overview { gap: .3rem; }
  .count-overview > span { min-width: 0; padding: .55rem; }
  .count-overview > i { display: none; }
  .dispatch-grid { display: none; }
  .dispatch-mobile-select { display: grid; }
  .sticky-actions { position: sticky; z-index: 8; bottom: 68px; margin: 1rem -.2rem -.2rem; padding: .75rem; border: 1px solid #d8e3e8; border-radius: 12px; background: rgba(255,255,255,.95); box-shadow: 0 -8px 22px rgba(20,48,72,.08); }
}

@media (max-width: 410px) {
  .quantity-grid, .metric-grid { grid-template-columns: 1fr; }
  .metric-grid .metric-card:last-child { grid-column: auto; }
  .detail-grid, .edit-quantities { grid-template-columns: 1fr; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
}
