:root {
  color-scheme: light;
  --red: #b5121b;
  --red-dark: #8f0d14;
  --ink: #17191d;
  --muted: #69707a;
  --line: #e2e5e9;
  --surface: #ffffff;
  --background: #f4f5f7;
  --success: #137a45;
  --shadow: 0 8px 30px rgba(21, 26, 34, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); }
body.notification-required, body.camera-open { overflow: hidden; }
button, input { font: inherit; }
a { color: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.app-header img { display: block; width: 112px; height: auto; }
.header-user { display: grid; text-align: right; font-size: 0.82rem; text-decoration: none; }
.app-header span { color: var(--muted); }
.app-header strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { width: min(100%, 760px); margin: 0 auto; padding: 24px 16px calc(104px + env(safe-area-inset-bottom)); }
.page-heading { display: flex; align-items: end; justify-content: center; gap: 16px; margin-bottom: 20px; text-align: center; }
.page-heading h1, .detail-card h1 { margin: 3px 0 0; font-size: clamp(1.55rem, 7vw, 2rem); letter-spacing: -0.035em; }
.eyebrow { margin: 0; color: var(--red); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.count-badge { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 12px; color: var(--red); background: #fbeaec; border-radius: 999px; font-weight: 800; }

.withdrawal-list { display: grid; gap: 14px; }
.withdrawal-card, .detail-card, .profile-card, .settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.withdrawal-card { padding: 18px; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.request-kind { color: var(--muted); font-size: 0.78rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em; }
.status-pill { padding: 6px 10px; color: var(--success); background: #e6f5ed; border-radius: 999px; font-size: 0.74rem; font-weight: 800; white-space: nowrap; }
.status-pill.status-assigned { color: #8a5800; background: #fff2cf; }
.status-pill.status-delivered { color: #24538a; background: #e8f1fb; }
.status-pill.status-completed { color: var(--success); background: #e6f5ed; }
.withdrawal-card h2 { margin: 14px 0 12px; font-size: 1.18rem; }
.route-summary { display: grid; gap: 11px; margin: 0; }
.route-summary div { padding-left: 13px; border-left: 3px solid var(--line); }
.route-summary div:first-child { border-color: var(--red); }
.route-summary dt, .section-label { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.route-summary dd { margin: 3px 0 0; line-height: 1.4; }
.card-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 15px; padding-top: 13px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.78rem; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.card-actions.single-action { grid-template-columns: 1fr; }
.home-section + .home-section { margin-top: 34px; }
.section-heading { margin-bottom: 16px; }
.section-heading h1 { max-width: 100%; }

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { color: #fff; background: var(--red); }
.primary-button:hover { background: var(--red-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.55; }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line); }
.danger-text { color: var(--red); }

.notification-banner { display: grid; gap: 3px; margin-bottom: 16px; padding: 14px 16px; text-decoration: none; background: #fff8e4; border: 1px solid #f1dfa9; border-radius: 15px; }
.notification-banner span { color: #6e5d2c; font-size: 0.84rem; }
.notification-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); background: rgba(18, 20, 24, 0.72); backdrop-filter: blur(5px); }
.notification-modal > section { display: grid; justify-items: center; width: min(100%, 420px); padding: 28px 22px 22px; text-align: center; background: #fff; border-radius: 24px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28); }
.notification-modal-icon { display: grid; place-items: center; width: 56px; height: 56px; color: #fff; background: var(--red); border-radius: 18px; font-size: 1.45rem; font-weight: 900; }
.notification-modal h2 { margin: 18px 0 8px; font-size: 1.5rem; letter-spacing: -0.025em; }
.notification-modal p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.notification-modal .primary-button { width: 100%; }
.empty-state { display: grid; justify-items: center; padding: 48px 24px; text-align: center; background: #fff; border: 1px dashed #cfd3d8; border-radius: 20px; }
.empty-state > span { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 12px; color: var(--red); background: #fbeaec; border-radius: 50%; font-size: 1.5rem; font-weight: 900; }
.empty-state h1, .empty-state h2 { margin: 0 0 7px; font-size: 1.25rem; }
.empty-state p { max-width: 360px; margin: 0 0 18px; color: var(--muted); line-height: 1.5; }
.standalone-empty { margin-top: 15vh; }
.alert { padding: 13px 15px; border-radius: 13px; line-height: 1.45; }
.alert-error { color: #7f1118; background: #fdebed; border: 1px solid #f4c5c9; }
.alert-success { margin-bottom: 16px; color: #0e6338; background: #e6f5ed; border: 1px solid #b9e1ca; }

.back-link { display: inline-flex; margin-bottom: 15px; color: var(--muted); font-weight: 750; text-decoration: none; }
.detail-card { padding: 20px; }
.detail-card h1 { margin: 16px 0 22px; }
.detail-section { padding: 17px 0; border-top: 1px solid var(--line); }
.detail-section > strong { display: block; margin-top: 7px; }
.detail-section p { margin: 5px 0 0; color: #41464d; line-height: 1.55; }
.note-section { padding: 16px; background: #fff8e4; border: 0; border-radius: 13px; }
.items-heading { display: flex; justify-content: space-between; }
.item-list { display: grid; gap: 0; margin: 10px 0 0; padding: 0; list-style: none; }
.item-list li { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--line); }
.item-list li > div { display: grid; gap: 3px; }
.item-list li span { color: var(--muted); font-size: 0.86rem; }
.item-list li > span { color: var(--ink); font-weight: 800; white-space: nowrap; }
.sticky-action { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.sticky-action p { margin: 0 0 12px; color: var(--muted); font-size: 0.86rem; }
.sticky-action .primary-button { width: 100%; }
.assigned-confirmation { display: grid; gap: 3px; margin-top: 10px; padding: 15px; color: #6d4908; background: #fff2cf; border-radius: 13px; }
.assigned-confirmation span { font-size: 0.84rem; }
.assigned-confirmation.status-completed { color: #0e6338; background: #e6f5ed; }

.completion-form { display: grid; gap: 12px; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.completion-form > label:first-of-type { font-weight: 850; }
.completion-form > p { margin: -7px 0 2px; color: var(--muted); font-size: 0.84rem; }
.photo-picker { display: grid; width: 100%; min-width: 0; max-width: 100%; gap: 4px; overflow: hidden; padding: 22px 16px; color: var(--ink); text-align: center; background: #fafafa; border: 2px dashed #cbd0d6; border-radius: 15px; cursor: pointer; }
.photo-picker strong { display: block; min-width: 0; max-width: 100%; overflow: hidden; color: var(--red); text-overflow: ellipsis; white-space: nowrap; }
.photo-picker span { color: var(--muted); font-size: 0.78rem; }
.completion-button { width: 100%; margin-top: 2px; }
.camera-preview { display: grid; gap: 10px; padding: 10px; background: #f4f5f7; border: 1px solid var(--line); border-radius: 15px; }
.camera-preview img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; background: #111; border-radius: 11px; }
.camera-preview > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.camera-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); background: #050607; }
.camera-modal > section { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100%; color: #fff; background: #050607; }
.camera-modal header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; padding: 10px 18px; }
.camera-modal h2 { margin: 0; font-size: 1.1rem; }
.camera-modal header button { display: grid; width: 42px; height: 42px; place-items: center; color: #fff; background: #24272b; border: 0; border-radius: 50%; font-size: 1.8rem; }
.camera-stage { position: relative; display: grid; min-height: 0; place-items: center; overflow: hidden; background: #000; }
.camera-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.camera-stage p { position: absolute; inset: 50% auto auto 50%; margin: 0; padding: 10px 14px; transform: translate(-50%, -50%); color: #fff; background: rgba(0, 0, 0, 0.72); border-radius: 10px; text-align: center; }
.camera-actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: #101214; }
.camera-actions .secondary-button { color: #fff; background: #24272b; border-color: #3c4147; }
.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; }

.history-list { display: grid; gap: 14px; }
.history-card { display: block; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.history-content { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 16px; }
.history-content h2 { margin: 3px 0 0; font-size: 1.05rem; }
.history-content p, .history-content time { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.history-content .secondary-button { min-height: 40px; margin-top: 5px; padding: 8px 10px; }

.profile-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.profile-card > div:last-child { display: grid; gap: 3px; }
.profile-card span { color: var(--muted); }
.avatar { display: grid; place-items: center; width: 54px; height: 54px; color: #fff; background: var(--red); border-radius: 16px; font-size: 1.35rem; font-weight: 900; }
.settings-card { display: grid; gap: 18px; margin-top: 14px; padding: 18px; }
.settings-card > div { display: grid; gap: 6px; }
.settings-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.logout-form { margin-top: 14px; }
.logout-form button { width: 100%; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.bottom-nav a { display: flex; min-height: 44px; align-items: center; justify-content: center; padding: 8px; color: var(--muted); font-size: 0.92rem; font-weight: 800; text-align: center; text-decoration: none; }
.bottom-nav a[aria-current="page"] { color: var(--red); }
.completion-proof a { display: block; margin-top: 8px; overflow: hidden; border-radius: 14px; background: #e9ebee; }
.completion-proof img { display: block; width: 100%; max-height: 560px; object-fit: contain; }

.app-toast { position: fixed; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); left: 16px; z-index: 30; max-width: 520px; margin: auto; padding: 14px 16px; color: #fff; background: #8e161d; border-radius: 13px; box-shadow: var(--shadow); font-weight: 750; }
.app-toast[data-type="success"] { background: var(--success); }

.receipt-body { min-height: 100vh; }
.receipt-header { position: relative; }
.receipt-header > strong { max-width: 52%; color: var(--ink); font-size: 0.88rem; text-align: right; }
.receipt-main { padding-bottom: 36px; }
.receipt-card { max-width: 660px; margin: 0 auto; }
.receipt-kicker { margin: 0 0 5px; color: var(--red); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.receipt-help, .receipt-greeting { color: var(--muted); line-height: 1.55; }
.receipt-greeting { margin: -10px 0 20px; }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.receipt-grid > div { display: grid; gap: 7px; min-width: 0; }
.receipt-action { padding-top: 18px; border-top: 1px solid var(--line); }
.receipt-action p { margin: 0 0 13px; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.receipt-action .primary-button { width: 100%; }

.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px 16px; background: #f4f5f7; }
.login-shell { width: min(100%, 360px); }
.login-card { padding: 36px 32px; text-align: center; background: #fff; border: 1px solid #e2e2e2; border-top: 4px solid #e2231a; border-radius: 12px; }
.login-card > img { width: auto; height: 64px; margin-bottom: 20px; }
.login-card h1 { margin: 0 0 20px; color: #2a2a2a; font-size: 18px; letter-spacing: 0; }
.login-card .alert { margin-bottom: 14px; border-radius: 8px; text-align: left; font-size: 13px; }
.login-form { margin: 0; }
.login-form input { width: 100%; min-height: 41px; margin-bottom: 14px; padding: 10px 12px; color: #2a2a2a; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; outline: none; font-size: 14px; }
.login-form input:focus { border-color: #e2231a; box-shadow: 0 0 0 3px rgba(226, 35, 26, 0.1); }
.login-submit-button { width: 100%; min-height: 41px; padding: 11px 18px; border-radius: 8px; background: #e2231a; font-size: 14px; font-weight: 600; }
.login-submit-button:hover { background: #b81913; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #6b6b6b; font-size: 12px; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.login-divider span { white-space: nowrap; }
.microsoft-login-button { width: 100%; min-height: 45px; gap: 12px; padding: 10px 18px; color: #fff; background: #353535; border-color: #5b5b5b; border-radius: 8px; font-size: 14px; font-weight: 600; }
.microsoft-login-button:hover { background: #292929; }
.microsoft-mark { display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 2px; flex: 0 0 auto; }
.microsoft-mark span:nth-child(1) { background: #f25022; }
.microsoft-mark span:nth-child(2) { background: #7fba00; }
.microsoft-mark span:nth-child(3) { background: #00a4ef; }
.microsoft-mark span:nth-child(4) { background: #ffb900; }

@media (min-width: 700px) {
  .withdrawal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-card { padding: 28px; }
  .bottom-nav { right: 50%; left: auto; width: min(100%, 760px); transform: translateX(50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

@media (max-width: 480px) {
  .receipt-grid { grid-template-columns: 1fr; }
}

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