:root {
  color-scheme: light;
  --bg: #edf7ff;
  --surface: #ffffff;
  --surface-soft: #f5faff;
  --text: #13263d;
  --muted: #66809e;
  --line: #dbeaf7;
  --blue: #2388ea;
  --blue-dark: #176fc5;
  --blue-soft: #dff0ff;
  --cyan: #43b9e8;
  --green: #1d9d72;
  --green-soft: #dcf7ed;
  --orange: #dc7d17;
  --orange-soft: #fff1d9;
  --red: #d94a5b;
  --red-soft: #ffe5e8;
  --shadow: 0 10px 34px rgba(33, 105, 166, .12);
  --radius: 22px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); }
body { min-height: 100vh; min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px; background: rgba(237,247,255,.88);
  backdrop-filter: blur(18px); border-bottom: 1px solid rgba(219,234,247,.8);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; color: white; font-weight: 800;
  background: linear-gradient(145deg, var(--blue), var(--cyan)); box-shadow: 0 7px 18px rgba(35,136,234,.25);
}
.brand-title { font-weight: 800; letter-spacing: -.02em; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 12px; }
.avatar { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-weight: 800; }

.content { width: min(100%, 760px); margin: 0 auto; padding: 18px 16px 28px; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.home-head h1 { margin: 0; }
.eyebrow { margin: 0 0 6px; color: var(--blue-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 7vw, 38px); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin-bottom: 14px; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 6px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.hero {
  position: relative; overflow: hidden; padding: 24px; border-radius: 28px; color: white;
  background: linear-gradient(145deg, #1779d3 0%, #2496ec 58%, #45bce5 100%); box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; width: 190px; height: 190px; right: -70px; top: -90px; border-radius: 50%; background: rgba(255,255,255,.13); }
.hero .eyebrow { color: rgba(255,255,255,.74); }
.hero p { max-width: 430px; margin-bottom: 20px; color: rgba(255,255,255,.84); line-height: 1.45; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.button { min-width: 0; min-height: 46px; padding: 8px 18px; border: 0; border-radius: 15px; cursor: pointer; font-weight: 750; line-height: 1.2; white-space: normal; transition: transform .15s ease, opacity .15s ease; }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .5; cursor: default; }
.button-primary { color: white; background: var(--blue); box-shadow: 0 7px 18px rgba(35,136,234,.22); }
.button-white { color: var(--blue-dark); background: white; }
.button-soft { color: var(--blue-dark); background: var(--blue-soft); }
.button-danger { color: var(--red); background: var(--red-soft); }
.button-success { color: white; background: var(--green); }
.button-block { width: 100%; }
.icon-button { width: 42px; height: 42px; padding: 0; border: 0; border-radius: 14px; background: var(--surface-soft); color: var(--text); font-size: 20px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 24px; }
.stat { padding: 15px 12px; border-radius: 19px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 5px 18px rgba(33,105,166,.06); }
.stat-value { display: block; margin-bottom: 3px; font-size: 24px; font-weight: 850; letter-spacing: -.04em; }
.stat-label { color: var(--muted); font-size: 11px; line-height: 1.2; }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.link-button { padding: 5px; border: 0; background: transparent; color: var(--blue-dark); font-weight: 700; cursor: pointer; }

.notice-card { display: flex; gap: 13px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 7px 24px rgba(33,105,166,.07); }
.notice-card.unread { border-color: #9fd1fb; background: linear-gradient(145deg, #fff, #f1f9ff); }
.notice-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; background: var(--blue-soft); }
.notice-card p { margin: 0; line-height: 1.4; font-size: 14px; }
.notice-title { display: block; margin-bottom: 3px; font-size: 14px; }
.notice-meta { margin-top: 7px; color: var(--muted); font-size: 12px; }

.card-list { display: grid; gap: 10px; }
.request-card { position: relative; width: 100%; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 22px rgba(33,105,166,.06); overflow: hidden; }
.request-card-main { display: block; width: 100%; padding: 16px; text-align: left; border: 0; background: transparent; color: inherit; cursor: pointer; }
.request-card.selectable .request-card-main { padding-left: 52px; }
.request-select { position: absolute; z-index: 2; left: 14px; top: 16px; width: 25px; height: 25px; }
.request-select input { position: absolute; opacity: 0; }
.request-select span { display: block; width: 25px; height: 25px; border: 2px solid #b8d4e9; border-radius: 8px; background: white; }
.request-select input:checked + span { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 5px white; }
.request-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.request-number { font-size: 13px; font-weight: 800; color: var(--blue-dark); }
.request-amount { margin: 5px 0 8px; font-size: 21px; font-weight: 850; letter-spacing: -.03em; }
.request-meta { display: flex; flex-wrap: wrap; gap: 7px 12px; color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 27px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; background: var(--blue-soft); color: var(--blue-dark); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gray { background: #edf1f5; color: #627184; }
.urgent { color: #fff; background: var(--red); }

.tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 5px; border-radius: 17px; background: rgba(255,255,255,.7); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 1 90px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.active { background: var(--surface); color: var(--blue-dark); box-shadow: 0 4px 14px rgba(33,105,166,.1); }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(20px); }
.bottom-nav-inner { width: min(100%, 760px); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.nav-item { min-height: 54px; padding: 5px 3px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.nav-icon { display: block; margin-bottom: 3px; font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--blue-dark); background: var(--blue-soft); }
.nav-badge { position: absolute; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: white; font-size: 10px; line-height: 17px; transform: translate(7px,-5px); }

.empty { padding: 34px 20px; text-align: center; border: 1px dashed #bcd8ee; border-radius: var(--radius); color: var(--muted); background: rgba(255,255,255,.48); }
.empty-icon { margin-bottom: 8px; font-size: 34px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(14,37,61,.36); backdrop-filter: blur(5px); }
.modal { width: 100%; max-width: min(760px, 100vw); max-height: calc(100dvh - 8px); overflow-x: hidden; overflow-y: auto; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; background: var(--bg); box-shadow: 0 -20px 60px rgba(14,37,61,.2); animation: rise .2s ease-out; }
.modal-handle { width: 42px; height: 5px; margin: 3px auto 14px; border-radius: 3px; background: #bfd2e3; }
.modal-head { position: sticky; top: -8px; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 10px 0 12px; background: linear-gradient(var(--bg) 75%, transparent); }
.modal-head h2 { margin: 0; }
.modal-actions { position: sticky; z-index: 6; bottom: calc(-22px - env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 22px -18px -22px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(18px); }
@keyframes rise { from { transform: translateY(30px); opacity: .5; } }

.form-grid { display: grid; gap: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 7px; }
.field label, .field-label { color: #36536f; font-size: 12px; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 12px 13px; border: 1px solid #cfe1f0; border-radius: 15px; outline: none; color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.field input[type="date"] { display: block; min-width: 0; appearance: auto; color-scheme: light; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,136,234,.12); }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.4; }
.required::after { content: " *"; color: var(--red); }
.smart-field { position: relative; }
.combobox { position: relative; }
.field .combobox-input { padding-right: 40px; }
.combobox-icon { position: absolute; top: 50%; right: 14px; color: var(--blue-dark); pointer-events: none; transform: translateY(-50%); }
.combobox-results { max-height: 230px; overflow-y: auto; overscroll-behavior: contain; margin-top: -1px; border: 1px solid #cfe1f0; border-radius: 14px; background: white; box-shadow: 0 12px 28px rgba(33,105,166,.14); }
.combobox-option { display: grid; gap: 3px; width: 100%; min-height: 46px; padding: 10px 13px; text-align: left; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: white; }
.combobox-option:last-child { border-bottom: 0; }
.combobox-option:active { background: var(--blue-soft); }
.combobox-option small { color: var(--muted); font-size: 11px; }
.combobox-empty { padding: 20px 13px; text-align: center; color: var(--muted); font-size: 12px; }
.file-drop { padding: 18px; text-align: center; border: 1.5px dashed #a9cce8; border-radius: 17px; background: rgba(255,255,255,.55); }
.file-drop input { width: 100%; min-height: auto; padding: 0; border: 0; background: transparent; }

.detail-hero { padding: 18px; margin-bottom: 14px; border-radius: 22px; color: white; background: linear-gradient(145deg, #207ed2, #36a9ea); }
.detail-hero .request-number { color: rgba(255,255,255,.8); }
.detail-amount { margin: 6px 0 8px; font-size: 29px; font-weight: 850; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.detail-item.wide { grid-column: 1 / -1; }
.detail-label { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.detail-value { font-size: 14px; font-weight: 700; word-break: break-word; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; min-height: 58px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline-dot { z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border: 3px solid var(--bg); border-radius: 50%; background: #b4c8da; }
.timeline-dot.active { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.timeline-dot.done { background: var(--green); }
.timeline-content { padding-bottom: 15px; }
.timeline-person, .waiting-people { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 12px; }
.person-link { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 4px 8px; border: 0; border-radius: 10px; color: var(--blue-dark); background: var(--blue-soft); font-size: 12px; font-weight: 750; }
.person-link span { font-size: 11px; }
.decision-line { margin-top: 7px; padding: 9px 11px; border-radius: 12px; background: rgba(255,255,255,.65); font-size: 12px; }
.decision-line p { margin: 4px 0; }
.decision-line span { color: var(--muted); font-size: 11px; }
.comment-list { display: grid; gap: 8px; }
.comment { padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-size: 13px; }
.comment p { margin: 4px 0; line-height: 1.4; }
.comment span { color: var(--muted); font-size: 11px; }
.file-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; margin-top: 7px; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.file-preview { position: absolute; z-index: 15; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; width: 100%; max-width: 760px; height: 100%; margin: auto; padding: calc(12px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); }
.file-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.file-preview-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-image { width: 100%; height: 100%; object-fit: contain; border-radius: 16px; background: white; }
.file-preview-frame { width: 100%; height: 100%; border: 0; border-radius: 16px; background: white; }
.file-preview-empty { display: grid; place-content: center; padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }

.settings-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-card + .settings-card { margin-top: 10px; }
.settings-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.role-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); font-size: 13px; }
.check-item input { width: 18px; height: 18px; accent-color: var(--blue); }
.stage-card { padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-soft); }
.stage-card + .stage-card { margin-top: 10px; }
.stage-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dry-run { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 7px 10px; border-radius: 12px; color: #80530d; background: #fff2cf; font-size: 11px; font-weight: 700; }

.bulk-bar { position: sticky; z-index: 10; top: 70px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid #b9daf4; border-radius: 17px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); }
.bulk-bar > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.bulk-bar .button { min-height: 38px; padding: 6px 12px; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 120; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; color: white; background: #17324f; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast.error { background: var(--red); }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.splash .brand-mark { width: 58px; height: 58px; border-radius: 19px; font-size: 22px; }
.spinner { width: 26px; height: 26px; border: 3px solid #cce3f6; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; padding: 30px; text-align: center; }
.error-screen .empty-icon { font-size: 46px; }

@media (max-width: 600px) {
  .content { padding-inline: 12px; }
  .hero { padding: 21px; }
  .stats { gap: 7px; }
  .stat { padding-inline: 9px; }
  .form-row, .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }
  .modal-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-bar { align-items: flex-start; }
  .bulk-bar > div { max-width: 72%; }
}

@media (min-width: 720px) {
  .modal { margin-bottom: 18px; border-radius: 30px; }
  .modal-backdrop { align-items: center; }
}
