:root {
  --ink: #17233c;
  --muted: #65718a;
  --line: #dfe5ef;
  --soft: #f5f7fb;
  --white: #fff;
  --brand: #1f5eff;
  --brand-dark: #1646c5;
  --success: #16794a;
  --success-bg: #eaf8f1;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --warning: #9a6700;
  --shadow: 0 18px 48px rgba(27, 39, 74, .1);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--soft); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(31, 94, 255, .1), transparent 31rem),
    var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.shell { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.page { padding: 36px 0 64px; }
.page-narrow { width: min(820px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(223, 229, 239, .82);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
}

.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--brand), #7447ff); box-shadow: 0 8px 20px rgba(31, 94, 255, .24); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .92rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line); }
.avatar-placeholder { display: grid; place-items: center; color: var(--brand); font-weight: 800; background: #e7edff; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover { color: #fff; background: var(--brand-dark); text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(31, 94, 255, .2); }
.button-secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button-secondary:hover { color: var(--ink); background: var(--soft); box-shadow: none; }
.button-ghost { min-height: 38px; padding: 7px 11px; color: var(--muted); background: transparent; }
.button-ghost:hover { color: var(--ink); background: var(--soft); box-shadow: none; }
.button-danger { background: var(--danger); }
.button-large { min-height: 50px; padding-inline: 22px; }
.button-block { width: 100%; }
.inline-form { display: inline-flex; margin: 0; }

.hero { display: grid; min-height: calc(100vh - 71px); align-items: center; padding: 56px 0; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 64px; }
.login-copy h1 { max-width: 760px; }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; letter-spacing: -.025em; }
h1 { margin-bottom: 18px; font-size: clamp(2.25rem, 5vw, 4.5rem); line-height: 1.03; }
h2 { margin-bottom: 12px; font-size: clamp(1.55rem, 2.8vw, 2.15rem); }
h3 { margin-bottom: 8px; font-size: 1.05rem; }
.lead { max-width: 680px; margin: 0 0 28px; color: var(--muted); font-size: 1.08rem; }
.hero-card, .card { border: 1px solid rgba(223, 229, 239, .95); border-radius: var(--radius); background: rgba(255, 255, 255, .96); box-shadow: var(--shadow); }
.hero-card { padding: 28px; }
.hero-step { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.hero-step:last-child { border-bottom: 0; }
.step-number { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: var(--brand); background: #eaf0ff; font-weight: 800; }
.hero-step p { margin: 2px 0 0; color: var(--muted); font-size: .93rem; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin: 0 0 6px; font-size: clamp(2rem, 4vw, 3rem); }
.page-heading p { margin: 0; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { padding: 24px; }
.card-flat { box-shadow: none; }
.card-title-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-title-row h2, .card-title-row h3 { margin-bottom: 2px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.notice { margin-bottom: 20px; padding: 13px 16px; border: 1px solid; border-radius: 12px; }
.notice-success { color: var(--success); border-color: #a6dfc1; background: var(--success-bg); }
.notice-error { color: var(--danger); border-color: #f4b5ad; background: var(--danger-bg); }
.notice-warning { color: var(--warning); border-color: #efd28d; background: #fff9e7; }

.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.status::before { width: 7px; height: 7px; border-radius: 50%; content: ""; background: currentColor; }
.status-complete { color: var(--success); background: var(--success-bg); }
.status-incomplete { color: var(--warning); background: #fff6dc; }
.status-pending { color: var(--warning); background: #fff6dc; }
.status-rejected { color: var(--danger); background: var(--danger-bg); }

.stat { min-height: 138px; }
.stat-label { color: var(--muted); font-size: .9rem; font-weight: 700; }
.stat-value { margin-top: 12px; font-size: 2.2rem; font-weight: 850; line-height: 1; }
.stat-note { margin-top: 10px; color: var(--muted); font-size: .84rem; }

.form-section + .form-section { margin-top: 30px; padding-top: 28px; border-top: 1px solid var(--line); }
.profile-form-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.profile-form-fields:disabled { opacity: .78; }
.form-section-heading { margin-bottom: 18px; }
.form-section-heading p { margin: 4px 0 0; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 7px; font-size: .9rem; font-weight: 750; }
.required { color: var(--danger); }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cdd5e2;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 94, 255, .12); }
input[readonly] { color: var(--muted); background: #f1f3f7; }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.conditional-field[hidden] { display: none; }
.image-upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.image-review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.image-upload { padding: 15px; border: 1px dashed #b9c5d8; border-radius: 13px; background: #fafbfe; }
.image-upload-single { width: min(100%, 430px); margin-top: 4px; }
.image-upload input { min-height: auto; padding: 8px; background: #fff; }
.image-preview, .identity-image { width: 100%; aspect-ratio: 1.58 / 1; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; object-fit: contain; background: #eef1f6; }
.bank-qr-image { aspect-ratio: 1 / 1; }
.image-preview[hidden] { display: none; }
.qr-scan-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 15px; border: 1px solid #cbd7f5; border-radius: 13px; background: #f5f8ff; }
.qr-scan-panel strong { display: block; margin-bottom: 2px; }
.qr-scan-panel p { margin: 0; color: var(--muted); font-size: .84rem; }
.qr-scan-panel .button { flex: 0 0 auto; }
.qr-scan-status { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--soft); font-size: .88rem; }
.qr-scan-status[data-state="success"] { color: var(--success); border-color: #a6dfc1; background: var(--success-bg); }
.qr-scan-status[data-state="warning"] { color: var(--warning); border-color: #efd28d; background: #fff9e7; }
.qr-scan-status[data-state="error"] { color: var(--danger); border-color: #f4b5ad; background: var(--danger-bg); }

.image-viewer[hidden] { display: none; }
.image-viewer { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; }
.image-viewer-backdrop { position: absolute; inset: 0; background: rgba(7, 12, 24, .82); backdrop-filter: blur(4px); }
.image-viewer-panel { position: relative; z-index: 1; display: flex; width: min(960px, 94vw); max-height: 92vh; flex-direction: column; align-items: center; overflow: hidden; border: 1px solid rgba(255, 255, 255, .18); border-radius: 16px; background: #101728; box-shadow: 0 28px 90px rgba(0, 0, 0, .45); }
.image-viewer-panel img { display: block; max-width: 100%; max-height: calc(92vh - 58px); object-fit: contain; }
.image-viewer-panel p { width: 100%; margin: 0; padding: 12px 56px; color: #fff; text-align: center; }
.image-viewer-close { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; width: 40px; height: 40px; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, .32); border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .62); font-size: 1.7rem; line-height: 1; }
.image-viewer-close:hover, .image-viewer-close:focus-visible { background: rgba(180, 35, 24, .95); outline: none; }
.image-viewer-active { overflow: hidden; }

.details { display: grid; grid-template-columns: 190px 1fr; margin: 0; }
.details dt, .details dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.details dt { color: var(--muted); font-weight: 700; }
.details dd { font-weight: 600; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }

.table-card { padding: 0; overflow: hidden; }
.table-card > .card-title-row { padding: 24px 24px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #fafbfc; font-size: .78rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
.cell-main { font-weight: 750; }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: .84rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--muted); }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input { flex: 1; }
.search-bar .button { flex: 0 0 auto; }

.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 24px 18px; color: #dce5ff; background: #111a30; }
.admin-sidebar .brand { margin: 0 8px 28px; color: #fff; }
.admin-label { margin: 0 10px 9px; color: #8290b1; font-size: .72rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav a { padding: 10px 12px; border-radius: 10px; color: #c7d1e8; font-weight: 650; }
.admin-nav a:hover, .admin-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.admin-account { position: absolute; right: 18px; bottom: 22px; left: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12); }
.admin-account-email { margin-bottom: 10px; overflow: hidden; color: #aebbd7; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-account .button-ghost { width: 100%; color: #dce5ff; }
.admin-main { min-width: 0; padding: 34px clamp(20px, 4vw, 52px) 64px; }

.receipt-preview { width: 100%; height: 78vh; min-height: 640px; border: 1px solid var(--line); border-radius: 14px; background: #e9edf4; }
.review-box { margin-top: 20px; border-color: #d8dfec; }
.confirm-box { border: 2px solid #cad7ff; box-shadow: 0 18px 48px rgba(31, 94, 255, .1); }
.button:disabled, button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.snapshot-note { margin-top: 16px; padding: 12px 14px; border-radius: 10px; color: var(--muted); background: var(--soft); font-size: .86rem; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding: 3px 0; }
.tabs a { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-weight: 750; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { border-color: var(--brand); color: #fff; background: var(--brand); }
.tabs a span { display: grid; min-width: 22px; height: 22px; place-items: center; padding: 0 6px; border-radius: 999px; background: rgba(101, 113, 138, .13); font-size: .76rem; }
.tabs a[aria-current="page"] span { background: rgba(255, 255, 255, .2); }
.live-note { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--success); font-size: .84rem; font-weight: 700; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22, 121, 74, .12); }
.workflow-note { max-width: 320px; white-space: normal; }
.workflow-summary, .workflow-action-card { margin-bottom: 20px; }
.workflow-action-card { border: 2px solid #cad7ff; }
.workflow-reason { padding: 12px 14px; border-radius: 10px; color: var(--warning); background: #fff9e7; }
.bank-qr-review { display: block; width: min(100%, 360px); }
.payment-check-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); align-items: start; gap: 28px; }
.payment-check-qr { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.payment-check-qr p { margin: 0; }
.payment-check-qr .bank-qr-review { width: 100%; }
.payment-check-qr .identity-image { margin-top: 12px; background: #fff; }
.payment-check-qr .notice { margin: 12px 0 0; }

.error-page { display: grid; min-height: 100vh; place-items: center; padding: 30px; text-align: center; }
.error-code { margin-bottom: 8px; color: var(--brand); font-size: 4.5rem; font-weight: 900; line-height: 1; }
.error-card { max-width: 560px; }

@media (max-width: 900px) {
  .hero-grid, .grid-3 { grid-template-columns: 1fr; }
  .payment-check-layout { grid-template-columns: 1fr; }
  .payment-check-qr { width: min(100%, 360px); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: relative; height: auto; }
  .admin-account { position: static; margin-top: 20px; }
  .admin-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-main { padding-top: 26px; }
}

@media (max-width: 760px) {
  .user-page .shell, .user-page .page-narrow { width: min(100% - 24px, 1160px); }
  .user-page .site-header { position: relative; }
  .user-page .header-inner { min-height: auto; align-items: stretch; flex-direction: column; gap: 10px; padding: 10px 0; }
  .user-page .brand { align-self: flex-start; }
  .user-page .header-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .user-page .header-actions .button { min-height: 44px; padding-inline: 12px; }
  .user-page .header-actions .user-chip { margin-inline: auto; }
  .user-page .page { padding: 24px 0 40px; }
  .user-page .page-narrow { padding: 24px 0 max(40px, env(safe-area-inset-bottom)); }
  .user-page .page-heading { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 20px; }
  .user-page .page-heading h1 { font-size: clamp(1.85rem, 9vw, 2.45rem); line-height: 1.08; overflow-wrap: anywhere; }
  .user-page .heading-actions, .user-page .heading-actions .button { width: 100%; }
  .user-page .grid-2, .user-page .field-grid, .user-page .image-upload-grid { grid-template-columns: 1fr; }
  .user-page .card { padding: 18px; border-radius: 15px; box-shadow: 0 10px 30px rgba(27, 39, 74, .08); }
  .user-page .card-title-row { flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
  .user-page input, .user-page select, .user-page textarea { min-height: 48px; font-size: 16px; }
  .user-page textarea { min-height: 112px; }
  .user-page .form-actions { flex-direction: column; gap: 10px; margin-top: 22px; }
  .user-page .form-actions .button { width: 100%; min-height: 48px; }
  .profile-page .form-section + .form-section { margin-top: 24px; padding-top: 22px; }
  .profile-page .form-section-heading { margin-bottom: 15px; }
  .profile-page .field-grid, .profile-page .image-upload-grid { gap: 15px; }
  .profile-page .image-upload { padding: 12px; }
  .profile-page .image-upload-single { width: 100%; }
  .profile-page .image-preview { max-height: 72vw; }
  .profile-page .qr-scan-panel { align-items: stretch; flex-direction: column; gap: 12px; }
  .profile-page .qr-scan-panel .button { width: 100%; min-height: 48px; }
  .dashboard-page .details { grid-template-columns: minmax(94px, .75fr) minmax(0, 1.25fr); }
  .dashboard-page .details dt, .dashboard-page .details dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .dashboard-page .details dt { padding-right: 10px; }
  .login-page .hero { min-height: auto; padding: 34px 0 40px; }
  .login-page .hero-grid { gap: 26px; }
  .login-page .login-copy h1 { margin-bottom: 24px; font-size: clamp(2.15rem, 11.5vw, 3.2rem); line-height: 1.04; }
  .login-page .login-copy > .button { width: 100%; }
  .login-page .hero-card { padding: 18px; border-radius: 15px; }
  .login-page .hero-step { grid-template-columns: 34px 1fr; gap: 12px; padding: 13px 0; }
  .login-page .hero-step p { font-size: .88rem; }
  .user-page .image-viewer { padding: 10px; }
  .user-page .image-viewer-panel { width: 100%; max-height: 94vh; }
}

@media (max-width: 680px) {
  .shell, .page-narrow { width: min(100% - 22px, 1160px); }
  .header-inner, .page-heading { align-items: flex-start; flex-direction: column; }
  .header-inner { padding: 12px 0; }
  .user-chip span { display: none; }
  .grid-2, .field-grid, .image-upload-grid, .image-review-grid { grid-template-columns: 1fr; }
  .card { padding: 19px; }
  .field-full { grid-column: auto; }
  .details { grid-template-columns: 1fr; }
  .details dt { padding-bottom: 0; border-bottom: 0; }
  .details dd { padding-top: 3px; }
  .admin-nav { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; }
  .heading-actions .button { flex: 1; }
  .search-bar { flex-direction: column; }
  .receipt-preview { min-height: 520px; height: 70vh; }
}

@media (max-width: 420px) {
  .user-page .brand { gap: 9px; font-size: .92rem; }
  .user-page .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .user-page .header-actions .button { padding-inline: 10px; font-size: .88rem; }
  .user-page .user-chip { flex: 0 0 34px; }
  .user-page .notice { padding: 12px 13px; }
  .user-page .card { padding: 16px; }
  .dashboard-page .details { grid-template-columns: 92px minmax(0, 1fr); font-size: .92rem; }
}
