:root {
  --ink: #163049;
  --muted: #6b7d8f;
  --line: #dfe8ef;
  --surface: #ffffff;
  --canvas: #f5f8fb;
  --blue: #1d6eaa;
  --blue-dark: #15527e;
  --blue-soft: #e8f3fb;
  --mint: #e8f7f1;
  --mint-ink: #247257;
  --amber: #fff4d8;
  --amber-ink: #8a5b00;
  --danger: #fff0f0;
  --danger-ink: #a83c3c;
  --shadow: 0 16px 44px rgba(22, 48, 73, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, #1d6eaa, #2aa6a0); box-shadow: 0 8px 20px rgba(29, 110, 170, .22); flex: 0 0 auto; }
.brand-mark svg { width: 23px; height: 23px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 5vw; background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.security-label { display: flex; align-items: center; gap: 7px; color: var(--mint-ink); background: var(--mint); border: 1px solid #caecde; border-radius: 999px; padding: 8px 11px; font-size: 12px; font-weight: 700; }
.security-label svg { width: 15px; height: 15px; }
.container { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.main { padding: 36px 0 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(26px, 3vw, 37px); letter-spacing: -.04em; line-height: 1.08; }
.page-heading p { margin: 9px 0 0; color: var(--muted); font-size: 15px; }
.eyebrow { color: var(--blue); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; margin-bottom: 10px; }
.button { border: 1px solid transparent; min-height: 44px; padding: 0 16px; border-radius: 11px; font-size: 14px; font-weight: 750; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, .drop-zone:focus-within { outline: 3px solid rgba(29, 110, 170, .22); outline-offset: 2px; }
.button.primary { color: white; background: var(--blue); box-shadow: 0 8px 16px rgba(29, 110, 170, .2); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.ghost { color: var(--blue-dark); background: transparent; border-color: transparent; }
.button.danger { color: var(--danger-ink); background: var(--danger); border-color: #ffd5d5; }
.button.small { min-height: 36px; padding: 0 11px; font-size: 12px; border-radius: 9px; }
.button[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.icon-button { border: 1px solid var(--line); background: #fff; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.icon-button:hover { color: var(--ink); border-color: #bdcedc; }
.icon-button svg { width: 17px; height: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 17px 18px; box-shadow: 0 5px 20px rgba(22,48,73,.03); }
.stat-card .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card .value { margin-top: 8px; font-size: 28px; line-height: 1; letter-spacing: -.04em; }
.stat-card .accent { width: 29px; height: 4px; margin-top: 15px; border-radius: 99px; background: var(--blue); }
.stat-card:nth-child(2) .accent { background: #deaa3d; }
.stat-card:nth-child(3) .accent { background: #2c9c75; }
.stat-card:nth-child(4) .accent { background: #8977d5; }
.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 22px 23px 17px; border-bottom: 1px solid #edf1f4; }
.card-header h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.card-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.card-body { padding: 22px 23px; }
.field { display: block; margin-bottom: 16px; }
.field label { display: block; margin-bottom: 8px; color: #486176; font-size: 13px; font-weight: 750; }
.field input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #cfdae2; border-radius: 10px; background: #fcfdfe; color: var(--ink); font-size: 15px; }
.field input::placeholder { color: #a1afb9; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.create-form .button { width: 100%; margin-top: 2px; }
.info-list { display: grid; gap: 15px; }
.info-item { display: flex; gap: 12px; align-items: flex-start; }
.info-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: 0 0 auto; }
.info-icon svg { width: 16px; height: 16px; }
.info-item strong { display: block; font-size: 13px; }
.info-item span { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 3px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border-radius: 12px; background: var(--amber); color: var(--amber-ink); font-size: 12px; line-height: 1.45; margin-top: 18px; }
.notice svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.full-width { grid-column: 1 / -1; }
.orders-card { margin-top: 20px; }
.orders-tools { display: flex; align-items: center; gap: 10px; }
.search { height: 38px; width: 210px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfcfd; }
.orders-list { padding: 8px 23px 20px; }
.order-row { display: grid; grid-template-columns: 1.2fr 1fr .75fr .65fr auto; align-items: center; gap: 17px; padding: 17px 0; border-bottom: 1px solid #edf1f4; }
.order-row:last-child { border-bottom: 0; }
.order-row.unread { margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-left: 4px solid #e0aa3d; background: linear-gradient(90deg, #fff9e9, rgba(255,249,233,.25)); box-shadow: 0 0 0 3px rgba(224,170,61,.08); border-radius: 10px; }
.order-row.unread .order-main strong { font-weight: 850; }
.order-main strong { font-size: 14px; }
.order-main span, .order-meta span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.order-main .unread-label, .order-main .opened-label { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.order-main .unread-label { color: var(--amber-ink); background: var(--amber); }
.order-main .opened-label { color: var(--mint-ink); background: var(--mint); }
.order-meta { color: var(--ink); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #c4d0d9; }
.status.received { color: var(--mint-ink); }
.status.received::before { background: #38a879; }
.status.waiting { color: var(--muted); }
.status.revoked { color: var(--danger-ink); }
.status.revoked::before { background: #d95555; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.file-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 3px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; background: #f4f8fb; border: 1px solid #e2ebf0; border-radius: 8px; color: #496174; font-size: 11px; }
.file-chip a { color: var(--blue-dark); text-decoration: none; font-weight: 700; }
.empty { padding: 33px 15px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 15px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.empty-icon svg { width: 22px; height: 22px; }
.empty strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 5px; }
.empty span { display: block; font-size: 13px; }
.counter-card { min-width: 0; }
.counter-textarea { width: 100%; min-height: 143px; resize: vertical; padding: 12px; border: 1px solid #cfdae2; border-radius: 10px; color: var(--ink); background: #fcfdfe; font-size: 14px; line-height: 1.5; }
.counter-textarea::placeholder { color: #a1afb9; }
.counter-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.counter-metrics > div { padding: 10px 8px; text-align: center; border-radius: 10px; background: #f4f8fb; }
.counter-metrics strong { display: block; font-size: 20px; letter-spacing: -.04em; }
.counter-metrics span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 30px; }
.admin-section-title { margin-bottom: 15px; color: var(--blue-dark); font-size: 13px; font-weight: 800; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-stats-content { min-width: 0; }
.admin-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 11px; }
.admin-summary span { padding: 6px 8px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 8px; font-size: 11px; font-weight: 750; }
.staff-list { display: grid; gap: 7px; }
.staff-row { display: grid; grid-template-columns: minmax(130px, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf1f4; }
.staff-row:last-child { border-bottom: 0; }
.staff-row strong, .staff-row span { display: block; }
.staff-row strong { font-size: 13px; }
.staff-row > div:first-child span { margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.staff-status { font-size: 11px; font-weight: 800; white-space: nowrap; }
.staff-status.verified { color: var(--mint-ink); }
.staff-status.pending { color: var(--amber-ink); }
.staff-opened { text-align: right; white-space: nowrap; }
.staff-opened strong { font-size: 17px; }
.staff-opened span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.loading-line { color: var(--muted); font-size: 12px; }
.code-output { margin-top: 15px; padding: 12px; border: 1px solid #cbe5d9; border-radius: 11px; background: var(--mint); color: var(--mint-ink); font-size: 12px; line-height: 1.45; }
.code-output > span { display: block; }
.code-output > div { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
.code-output code { font-size: 21px; letter-spacing: .15em; font-weight: 850; }
.code-output small { display: block; margin-top: 8px; color: #4a7766; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 520px); }
.login-visual { padding: 8vh 8vw; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(145deg, #eaf6fc 0%, #f8fbfc 60%, #e8f7f1 100%); border-right: 1px solid var(--line); }
.login-visual .brand { align-self: flex-start; }
.login-copy { max-width: 535px; padding: 70px 0; }
.login-copy h1 { margin: 0; max-width: 500px; font-size: clamp(36px, 5vw, 64px); letter-spacing: -.065em; line-height: .98; }
.login-copy p { max-width: 420px; margin: 22px 0 0; color: #587084; font-size: 17px; line-height: 1.55; }
.login-steps { display: grid; gap: 12px; max-width: 410px; }
.login-step { display: flex; align-items: center; gap: 12px; color: #466274; font-size: 13px; }
.step-no { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--blue); font-size: 12px; font-weight: 800; border: 1px solid #d9e9f1; }
.login-panel { display: flex; align-items: center; padding: 40px clamp(30px, 6vw, 85px); background: #fff; }
.login-card { width: 100%; max-width: 390px; }
.login-card h2 { margin: 25px 0 9px; font-size: 28px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-card .button { width: 100%; margin-top: 8px; }
.form-error { padding: 11px 12px; border-radius: 10px; background: var(--danger); color: var(--danger-ink); font-size: 12px; line-height: 1.4; margin-bottom: 14px; }
.login-foot { margin-top: 22px; color: #9aa8b2; font-size: 11px; line-height: 1.5; }

.upload-page { min-height: 100vh; padding: 20px 0 50px; }
.upload-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.upload-content { width: min(680px, calc(100% - 40px)); margin: 0 auto; }
.upload-intro { margin-bottom: 22px; }
.upload-intro h1 { margin: 0; font-size: clamp(28px, 5vw, 43px); letter-spacing: -.055em; line-height: 1.04; }
.upload-intro p { margin: 11px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.order-pill { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 15px; padding: 8px 11px; border: 1px solid #cde3ef; color: var(--blue-dark); background: var(--blue-soft); border-radius: 999px; font-size: 12px; font-weight: 800; }
.upload-card { padding: 22px; }
.drop-zone { border: 1.5px dashed #b8cfdd; background: #f8fcfe; border-radius: 15px; padding: 27px 22px; text-align: center; transition: background .16s ease, border-color .16s ease; }
.drop-zone.dragging { background: var(--blue-soft); border-color: var(--blue); }
.drop-icon { width: 50px; height: 50px; margin: 0 auto 13px; display: grid; place-items: center; background: #e3f2f9; color: var(--blue); border-radius: 16px; }
.drop-icon svg { width: 23px; height: 23px; }
.drop-zone strong { display: block; font-size: 15px; }
.drop-zone p { margin: 7px 0 15px; color: var(--muted); font-size: 13px; }
.drop-zone .button { min-height: 40px; }
.drop-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.file-preview-list { display: grid; gap: 9px; margin-top: 17px; }
.selected-file { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.selected-file .file-symbol { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: var(--mint); color: var(--mint-ink); flex: 0 0 auto; }
.selected-file .file-symbol svg { width: 15px; height: 15px; }
.selected-file-info { min-width: 0; flex: 1; }
.selected-file-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.selected-file-info span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.remove-file { border: 0; background: transparent; color: #a4b0b9; padding: 5px; }
.upload-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 19px; }
.upload-footer .hint { max-width: 330px; }
.upload-success { padding: 31px 22px; text-align: center; }
.success-icon { width: 59px; height: 59px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--mint); color: var(--mint-ink); border-radius: 20px; }
.success-icon svg { width: 28px; height: 28px; }
.upload-success h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.upload-success p { margin: 10px auto 0; max-width: 450px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.upload-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 15px; padding: 13px 15px; color: #536b7e; background: #f1f6f8; border-radius: 12px; font-size: 12px; line-height: 1.45; }
.upload-note svg { color: var(--blue); width: 16px; height: 16px; flex: 0 0 auto; }
.camera-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: rgba(8, 16, 25, .74); backdrop-filter: blur(6px); }
.camera-dialog { width: min(700px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; overflow: hidden; background: #0b121b; color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.camera-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 18px; background: #121d28; }
.camera-toolbar strong, .camera-toolbar span { display: block; }
.camera-toolbar strong { font-size: 15px; }
.camera-toolbar span { margin-top: 4px; color: #a7b4bf; font-size: 12px; }
.camera-toolbar .icon-button { color: #e3edf4; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); font-size: 24px; line-height: 1; }
.camera-stage { position: relative; height: min(58vh, 520px); min-height: 100px; flex: 1 1 auto; display: grid; place-items: center; overflow: hidden; background: #05080c; }
.camera-stage video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; filter: brightness(.84) saturate(.9); }
.camera-frame { position: absolute; width: auto; height: min(80%, 500px); aspect-ratio: .707 / 1; border: 2px solid rgba(255,255,255,.94); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.54), 0 0 25px rgba(255,255,255,.18); pointer-events: none; }
.camera-frame::before, .camera-frame::after, .camera-frame span::before, .camera-frame span::after { content: ''; position: absolute; width: 22px; height: 22px; border-color: #fff; border-style: solid; }
.camera-frame::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 7px 0 0 0; }
.camera-frame::after { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 7px 0 0; }
.camera-frame span::before { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 7px; }
.camera-frame span::after { right: -2px; bottom: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 7px 0; }
.camera-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; padding: 17px 20px 19px; background: #121d28; }
.camera-controls p, .camera-controls > span { margin: 0; color: #a7b4bf; font-size: 12px; line-height: 1.4; }
.camera-controls > span { text-align: right; }
.capture-button { width: 65px; height: 65px; display: grid; place-items: center; border: 5px solid rgba(255,255,255,.72); border-radius: 50%; color: #10202e; background: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.12); transition: transform .15s ease, background .15s ease; }
.capture-button:hover { transform: scale(1.04); background: #e8f5fb; }
.capture-button svg { width: 26px; height: 26px; }
.capture-button[disabled] { opacity: .55; }
.capture-button[disabled]:hover { transform: none; cursor: wait; }
.camera-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #05080c; }
.camera-processing { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,8,12,.55); }
.camera-spinner { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: cameraSpin .8s linear infinite; }
.camera-status { flex: 0 0 auto; padding: 12px 18px; text-align: center; background: #121d28; color: #dbe6ed; font-size: 14px; line-height: 1.4; }
.camera-status-success { background: #12392d; color: #beefd8; font-weight: 600; }
.camera-review-controls { padding: 15px 18px 20px; background: #121d28; }
.camera-review-controls p { margin: 0 0 14px; color: #becbd6; font-size: 13px; line-height: 1.5; text-align: center; }
.camera-review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.camera-review-actions .button { min-height: 48px; white-space: normal; }
.camera-toolbar, .camera-controls, .camera-review-controls { flex-shrink: 0; }
@keyframes cameraSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .camera-spinner { animation: none; } }
@supports (height: 100dvh) { .camera-dialog { max-height: calc(100dvh - 36px); } }
@media (max-width: 380px) { .camera-review-actions { grid-template-columns: 1fr; gap: 8px; } }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(390px, calc(100% - 44px)); padding: 13px 15px; background: #163049; color: #fff; border-radius: 12px; box-shadow: 0 12px 30px rgba(22,48,73,.24); font-size: 13px; line-height: 1.4; animation: toastIn .2s ease; }
.toast.error { background: #a83c3c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-visual { min-height: 390px; padding: 32px 8vw; }
  .login-copy { padding: 45px 0 24px; }
  .login-copy h1 { font-size: clamp(36px, 10vw, 58px); }
  .login-panel { min-height: 470px; padding: 45px 8vw; }
  .grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 20px; }
  .topbar .security-label { display: none; }
  .container { width: min(100% - 28px, 590px); }
  .main { padding-top: 27px; }
  .page-heading { display: block; margin-bottom: 22px; }
  .page-heading .button { margin-top: 17px; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 25px; }
  .card-header, .card-body { padding-left: 17px; padding-right: 17px; }
  .orders-list { padding-left: 17px; padding-right: 17px; }
  .orders-tools { width: 100%; }
  .orders-tools .search { flex: 1; width: auto; }
  .order-row { display: block; padding: 16px 0; }
  .order-row > * { margin-bottom: 11px; }
  .order-row > *:last-child { margin-bottom: 0; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .file-list { margin-top: 2px; }
  .order-row.unread { margin-left: -4px; margin-right: -4px; padding-left: 8px; padding-right: 8px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .staff-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .staff-opened { text-align: left; }
  .staff-row .button { grid-column: 1 / -1; width: 100%; }
  .upload-page { padding-top: 15px; }
  .upload-header { margin-bottom: 33px; }
  .upload-header .brand span { display: none; }
  .upload-content { width: min(100% - 28px, 590px); }
  .upload-card { padding: 14px; }
  .upload-footer { display: block; }
  .upload-footer .button { width: 100%; margin-top: 14px; }
  .drop-actions { display: grid; grid-template-columns: 1fr; }
  .drop-actions .button { width: 100%; }
  .camera-modal { padding: 0; }
  .camera-dialog { width: 100%; max-height: 100vh; height: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
  .camera-stage { min-height: 0; flex: 1; }
  .camera-controls { grid-template-columns: 1fr auto 1fr; padding-bottom: max(19px, env(safe-area-inset-bottom)); }
  .camera-controls p { font-size: 11px; }
  .camera-controls > span { font-size: 11px; }
  .camera-review-controls { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* Formal document-desk direction: flatter surfaces, sharper hierarchy, less dashboard chrome. */
:root {
  --ink: #20292e;
  --muted: #6c7779;
  --line: #d8d9d4;
  --surface: #fffefa;
  --canvas: #f1f0eb;
  --blue: #1f6570;
  --blue-dark: #164852;
  --blue-soft: #e7f0f0;
  --mint: #e6f1eb;
  --mint-ink: #287052;
  --amber: #fff0ce;
  --amber-ink: #875b12;
  --danger: #f9e8e5;
  --danger-ink: #a14538;
  --accent: #cf5b4e;
  --shadow: none;
  --radius: 8px;
}

body { background: var(--canvas); color: var(--ink); }
.topbar { height: 70px; padding: 0 max(28px, 5vw); background: var(--surface); border-bottom: 1px solid var(--ink); backdrop-filter: none; }
.brand { gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 6px; background: var(--ink); box-shadow: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand strong { font-size: 12px; letter-spacing: .09em; }
.brand span { margin-top: 3px; font-size: 10px; letter-spacing: .12em; }
.security-label { border-radius: 4px; padding: 7px 9px; background: var(--mint); border-color: #c9dfd4; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.topbar-actions .hint { font-size: 12px; color: #485457; }
.icon-button { border-radius: 6px; border-color: var(--line); }
.main { padding: 34px 0 60px; }
.page-heading { margin-bottom: 25px; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: .15em; }
.page-heading h1, .login-copy h1, .upload-intro h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.045em; }
.page-heading h1 { font-size: clamp(29px, 3vw, 42px); }
.page-heading p { font-size: 14px; }
.button { min-height: 42px; border-radius: 5px; box-shadow: none; font-size: 11px; letter-spacing: .035em; text-transform: uppercase; }
.button:hover { transform: none; }
.button.primary { background: var(--accent); box-shadow: none; }
.button.primary:hover { background: #b84e43; }
.button.secondary { background: var(--surface); border-color: #bfc4c2; }
.button.secondary:hover { background: #f7f5ef; border-color: var(--ink); }
.button.ghost { color: var(--blue-dark); }
.button.danger { border-color: #e6bcb6; }
.button.small { min-height: 32px; border-radius: 4px; font-size: 10px; }
.card { border-radius: 8px; box-shadow: none; border-color: var(--line); background: var(--surface); }
.card-header { padding: 19px 21px 15px; border-bottom-color: var(--line); }
.card-header h2 { font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 500; }
.card-header p { font-size: 12px; }
.card-body { padding: 20px 21px; }
.field label { color: #536062; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.field input, .search, .counter-textarea { border-radius: 5px; border-color: #c9cecb; background: #fff; }
.field input { height: 44px; }
.field input:focus, .search:focus, .counter-textarea:focus { border-color: var(--blue); outline: 2px solid rgba(31, 101, 112, .12); }
.stats { gap: 11px; }
.stat-card { border-radius: 6px; box-shadow: none; padding: 15px 17px 13px; border-top: 3px solid var(--blue); }
.stat-card:nth-child(2) { border-top-color: #c6922f; }
.stat-card:nth-child(3) { border-top-color: #4d9672; }
.stat-card:nth-child(4) { border-top-color: #7b7298; }
.stat-card .label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.stat-card .value { margin-top: 10px; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; }
.stat-card .accent { display: none; }
.grid { gap: 15px; }
.info-icon { border-radius: 5px; }
.notice { border-radius: 5px; margin-top: 16px; }
.orders-card { margin-top: 15px; }
.orders-card .card-header { align-items: center; }
.orders-list { padding: 0 21px 15px; }
.orders-list:before { content: 'ZLECENIE                                      STATUS                         PLIKI                 WAŻNOŚĆ                 AKCJE'; display: block; padding: 12px 0 9px; border-bottom: 1px solid var(--ink); color: #899291; font-size: 9px; letter-spacing: .08em; white-space: pre; overflow: hidden; }
.order-row { grid-template-columns: 1.2fr 1fr .75fr .65fr auto; gap: 15px; padding: 15px 0; border-bottom-color: var(--line); }
.order-row.unread { margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-left-width: 3px; border-radius: 3px; background: #fff8e9; box-shadow: none; }
.order-main strong { font-weight: 600; letter-spacing: .01em; }
.order-row.unread .order-main strong { font-weight: 800; }
.order-main span, .order-meta span { font-size: 11px; }
.order-main .unread-label, .order-main .opened-label { border-radius: 3px; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.status { font-size: 11px; }
.file-chip { border-radius: 4px; background: #f5f5f1; border-color: #dedfdb; }
.search { height: 36px; font-size: 12px; }
.counter-metrics > div { border-radius: 5px; background: #f3f3ee; }
.counter-metrics strong { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.admin-card { border-top: 3px solid var(--ink); }
.admin-section-title { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.code-output { border-radius: 5px; }
.button svg { width: 15px; height: 15px; }
#create-order-form > .button { width: fit-content; min-height: 37px; padding: 0 13px; font-size: 11px; letter-spacing: .035em; }
.ocr-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 13px; }
.ocr-picker .button { min-height: 36px; font-size: 10px; }
.ocr-picker input:disabled + .hint, .ocr-picker .button[disabled] { opacity: .55; }
.ocr-error { color: var(--danger-ink); }
.file-ocr { border: 1px solid #c8d9d7; border-radius: 4px; padding: 3px 6px; color: var(--blue-dark); background: #f1f7f5; font-size: 9px; font-weight: 800; letter-spacing: .04em; cursor: pointer; }
.file-ocr:hover { border-color: var(--blue); background: var(--blue-soft); }
.page-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.day-picker { display: flex; align-items: center; gap: 7px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.day-picker-info { min-width: 174px; padding: 0 5px; }
.day-picker-info span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.day-picker-info strong { display: block; margin-top: 2px; font-size: 12px; font-weight: 650; text-transform: capitalize; }
.day-picker input { width: 35px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 4px; color: var(--blue-dark); background: var(--surface); cursor: pointer; }
.day-picker input::-webkit-datetime-edit { display: none; }
.day-picker input::-webkit-calendar-picker-indicator { margin: 0 auto; cursor: pointer; }
.day-nav { width: 30px; height: 30px; border-radius: 4px; color: var(--ink); font-size: 22px; line-height: 1; }
.day-nav:hover { border-color: var(--ink); background: #f7f5ef; }
.today-button { min-height: 30px !important; padding: 0 8px !important; font-size: 9px !important; }
.page-actions > .refresh-button { min-height: 40px; }

.login-layout { background: var(--surface); }
.login-visual { position: relative; overflow: hidden; padding: 7vh 8vw; color: #f5f4ee; background: var(--ink); border-right: 0; }
.login-visual::after { content: ''; position: absolute; top: 0; right: 34px; width: 1px; height: 100%; background: rgba(255,255,255,.12); }
.login-visual .brand span { color: #aeb8b5; }
.login-visual .brand-mark { color: var(--ink); background: var(--accent); }
.login-copy { position: relative; z-index: 1; max-width: 565px; }
.login-copy .eyebrow { color: #e48a7f; }
.login-copy h1 { max-width: 560px; font-size: clamp(38px, 5vw, 68px); line-height: 1.02; }
.login-copy p { max-width: 430px; color: #b7c0be; font-size: 16px; }
.login-steps { position: relative; z-index: 1; }
.login-step { color: #cbd1cf; }
.step-no { color: #f4b1a9; background: transparent; border-color: rgba(255,255,255,.2); border-radius: 5px; }
.login-panel { padding: 40px max(34px, 6vw); }
.login-card h2 { font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; }
.login-card .button { margin-top: 9px; }

.upload-page { background: var(--canvas); }
.upload-header { margin-bottom: 32px; }
.upload-intro h1 { font-size: clamp(30px, 5vw, 46px); }
.upload-card { border-top: 3px solid var(--ink); }
.drop-zone { border-radius: 6px; border-color: #aebbb8; background: #fbfbf7; }
.drop-icon { border-radius: 8px; background: var(--ink); color: #fff; }
.drop-zone strong { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 500; }
.camera-modal { background: rgba(20, 25, 28, .8); }

@media (max-width: 720px) {
  .topbar { padding: 0 16px; }
  .main { padding-top: 25px; }
  .orders-list { padding-left: 15px; padding-right: 15px; }
  .orders-list:before { display: none; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
  .login-visual { min-height: 420px; padding: 30px 8vw; }
  .login-visual::after { display: none; }
  .login-copy { padding-top: 45px; }
  .login-copy h1 { font-size: clamp(38px, 11vw, 56px); }
}

/* Final density pass: compact headings and place the newest work first. */
.page-heading h1 { font-size: clamp(26px, 2.6vw, 34px); }
.login-copy h1 { font-size: clamp(34px, 4vw, 49px); max-width: 500px; }
.upload-intro h1 { font-size: clamp(27px, 4vw, 38px); }
.card-header h2 { font-size: 17px; }
.orders-card { order: -1; margin-top: 0; }
.orders-list:before { font-size: 8px; letter-spacing: .04em; }
.order-row { min-height: 62px; }

@media (max-width: 720px) {
  .page-heading h1 { font-size: 28px; }
  .login-copy h1 { font-size: 39px; }
  .upload-intro h1 { font-size: 31px; }
  #create-order-form > .button { width: 100%; }
  .page-actions { display: grid; grid-template-columns: 1fr; justify-items: stretch; margin-top: 17px; }
  .day-picker { justify-content: space-between; }
  .day-picker-info { min-width: 0; flex: 1; }
  .page-actions > .refresh-button { width: 100%; }
}
