/* DigiTax customer application - mobile first. Most customers use a phone, so every control is
   at least 48px high, text is 17px, and the main action sits within thumb reach at the bottom. */

:root {
  --brand: #d6202a;
  --primary: #1b4dd1;
  --primary-dark: #153ea8;
  --primary-soft: #e8eefc;
  --ink: #101828;
  --ink-soft: #475467;
  --line: #d5dae3;
  --line-soft: #e7eaf0;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --ok: #157f3c;
  --ok-soft: #e4f5ea;
  --warn: #a15c00;
  --warn-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 14px;
  --radius-small: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
  --tap: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); text-underline-offset: 3px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid rgba(27, 77, 209, .45); outline-offset: 2px; }

/* ------------------------------------------------------------------ top bar */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 880px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 8px; }
.brand { font-size: 22px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--brand); }

.topnav { display: none; gap: 4px; margin-right: 8px; }
.topnav-link { padding: 8px 12px; border-radius: 8px; color: var(--ink-soft); text-decoration: none; font-weight: 550; font-size: 15px; }
.topnav-link:hover { background: var(--bg); }
.topnav-link.active { color: var(--primary); background: var(--primary-soft); }

.menu { position: relative; }
.menu summary {
  list-style: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px;
  border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-soft);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--bg); }
.menu-list {
  position: absolute; right: 0; top: 46px; min-width: 170px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.menu-list a { display: block; padding: 11px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu-list a:hover { background: var(--bg); }
.menu-list a.active { color: var(--primary); font-weight: 650; }

.icon-button {
  width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-button:hover { background: var(--bg); }
.logout-form { display: none; margin: 0; }

/* ------------------------------------------------------------------ page */

.page { width: 100%; max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; flex: 1; }
.page-narrow { max-width: 480px; }
body.with-tabbar .page { padding-bottom: calc(88px + var(--safe-bottom)); }

.page-title { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 8px; }
.page-intro { color: var(--ink-soft); margin-bottom: 20px; }
.muted { color: var(--ink-soft); font-size: 15px; }
.center { text-align: center; }
.left { text-align: left; }
.break { word-break: break-all; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 19px; margin-bottom: 12px; }
.card > p + p, .card > p + .btn, .card > p + form { margin-top: 12px; }
.card > .btn + .btn, .card > form + .btn, .card > .btn + form { margin-top: 10px; }

.auth-card { padding: 28px 22px; margin-top: 8px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 8px; }
.lead { color: var(--ink-soft); margin-bottom: 22px; }
.auth-card.center .lead { margin-bottom: 18px; }
.auth-card .muted { margin-bottom: 18px; }
.auth-links { margin-top: 18px; text-align: center; }
.auth-switch { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); text-align: center; color: var(--ink-soft); }
.inline-form { margin-top: 10px; text-align: center; }

.big-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.big-icon svg { width: 32px; height: 32px; stroke-width: 2; }
.big-icon.ok { background: var(--ok-soft); color: var(--ok); }
.big-icon.warn { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; text-align: center;
  transition: background-color .12s, border-color .12s, transform .05s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-link { background: none; border: 0; min-height: 44px; padding: 0 8px; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn-small { min-height: 40px; padding: 0 12px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------ forms */

.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 16px; }
.field-row { display: grid; gap: 0 14px; }

.input-wrap { position: relative; display: flex; align-items: center; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], textarea, select {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 17px; appearance: none;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(27, 77, 209, .14); }
input[readonly] { background: var(--bg); }

.input-wrap input[type="password"], .input-wrap input[data-password-visible] { padding-right: 52px; }
.input-action { position: absolute; right: 6px; width: 40px; height: 40px; border: 0; background: none; color: var(--ink-soft); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.input-action[aria-pressed="true"] { color: var(--primary); }

/* Phone number: fixed country code with flag in its own read-only box, then the number. */
.phone-field { display: flex; gap: 8px; align-items: stretch; }
.phone-field .input-wrap { flex: 1; min-width: 0; }
.phone-code {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink-soft);
  font-weight: 600; font-size: 17px; white-space: nowrap; user-select: none; cursor: default;
}
.phone-code .flag { width: 22px; height: 22px; stroke: none; }

.input-wrap.with-prefix input { padding-left: 58px; }
.input-prefix { position: absolute; left: 14px; color: var(--ink-soft); font-weight: 600; pointer-events: none; }

.field-hint { color: var(--ink-soft); font-size: 14px; margin-top: 6px; }
.field-error { color: var(--danger); font-size: 15px; font-weight: 550; margin-top: 6px; }
.field-error:empty { display: none; }
.has-error input, .has-error textarea { border-color: var(--danger); }
.has-error .field-hint { display: none; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 400; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check-field { margin: 4px 0 20px; }

.alert { border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; font-size: 16px; }
.alert p + p { margin-top: 6px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--primary-soft); color: #1d3a8a; }

/* ------------------------------------------------------------------ home */

.notice-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--primary); color: #fff; text-decoration: none; font-weight: 650;
}
.notice-card span:nth-child(2) { flex: 1; }
.notice-card .dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; }

.app-card.featured { border: 1.5px solid var(--primary-soft); }
.app-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.app-card-head h2 { margin: 0; font-size: 21px; }
.app-card .progress { margin: 4px 0 8px; }
.app-card .muted { margin-bottom: 14px; }
.approve-form { margin-top: 14px; }
.year-list { display: grid; gap: 10px; }
.year-list form { margin: 0; }
.help-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.help-card .btn { padding-left: 0; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; white-space: nowrap; background: var(--bg); color: var(--ink-soft); }
.badge-QuestionsInProgress { background: var(--warn-soft); color: var(--warn); }
.badge-QuestionsCompleted, .badge-InReview { background: var(--primary-soft); color: var(--primary-dark); }
.badge-WaitingForCustomer, .badge-SentForApproval { background: var(--danger-soft); color: var(--danger); }
.badge-ApprovedByCustomer, .badge-Submitted, .badge-Closed { background: var(--ok-soft); color: var(--ok); }

.progress { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }

.facts { margin: 0; display: grid; gap: 12px; }
.facts dt { font-size: 14px; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 550; }
.logout-block { margin-top: 8px; }

/* ------------------------------------------------------------------ questionnaire */

.page-question { padding-top: 14px; padding-bottom: calc(170px + var(--safe-bottom)); }
.q-progress { margin-bottom: 22px; }
.q-progress-text { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; font-weight: 550; }

.q-section { font-size: 14px; font-weight: 650; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.q-title { font-size: 25px; line-height: 1.25; letter-spacing: -.02em; margin-bottom: 10px; }
.q-help { color: var(--ink-soft); margin-bottom: 14px; }
.q-multi-hint { color: var(--ink-soft); font-size: 15px; margin: 4px 0 12px; }

.q-info { margin: 0 0 18px; border-radius: 12px; background: var(--primary-soft); }
.q-info summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; color: var(--primary-dark); font-weight: 600; font-size: 16px; }
.q-info summary::-webkit-details-marker { display: none; }
.q-info p { padding: 0 14px 14px; color: #1d3a8a; font-size: 16px; }

.choices { display: grid; gap: 12px; margin: 18px 0; }
.choices-two { grid-template-columns: 1fr 1fr; }
.choice { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice-box {
  display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 14px 16px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); font-weight: 600;
  transition: border-color .12s, background-color .12s;
}
.choices-two .choice-box { justify-content: center; min-height: 68px; font-size: 19px; }
.choices-two .choice-mark { display: none; }
.choice-mark { width: 24px; height: 24px; border: 2px solid #98a2b3; border-radius: 50%; flex: none; position: relative; }
.choice input[type="checkbox"] + .choice-box .choice-mark { border-radius: 7px; }
.choice input:checked + .choice-box { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.choice input:checked + .choice-box .choice-mark { border-color: var(--primary); background: var(--primary); }
.choice input:checked + .choice-box .choice-mark::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.choice input:focus-visible + .choice-box { outline: 3px solid rgba(27, 77, 209, .45); outline-offset: 2px; }

.docs-panel { margin: 4px 0 18px; }
.docs-panel h2 { font-size: 17px; margin-bottom: 10px; }

.q-client-error { margin: 0 0 12px; font-size: 16px; }

.q-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line-soft); padding: 12px 16px calc(10px + var(--safe-bottom));
  backdrop-filter: blur(8px);
}
.q-nav-inner { max-width: 688px; margin: 0 auto; display: flex; gap: 12px; }
.q-nav .q-next { flex: 1; }
.q-nav [data-nav-back] { padding: 0 16px; }
.q-exit { display: block; margin: 4px auto 0; font-size: 15px; font-weight: 550; text-decoration: none; color: var(--ink-soft); }

/* ------------------------------------------------------------------ uploads */

.upload-slot { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--surface); }
.upload-slot.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-slot.complete { border-style: solid; border-color: #9fd4b0; }
.upload-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.upload-title { font-weight: 650; }
.tag { font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--ink-soft); white-space: nowrap; }
.tag-required { background: var(--warn-soft); color: var(--warn); }
.upload-slot.complete .tag-required { background: var(--ok-soft); color: var(--ok); }

.file-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.file-list:empty { display: none; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; background: var(--bg); border-radius: 10px; min-height: 48px; }
.file-list li > svg { color: var(--ink-soft); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; color: var(--ink); }
a.file-name { color: var(--primary); }
.file-size { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.file-remove { width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; color: var(--ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.file-remove:hover { background: var(--danger-soft); color: var(--danger); }
.file-remove svg { width: 18px; height: 18px; }

.upload-status { font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; }
.upload-status:empty { display: none; }
.upload-status.error { color: var(--danger); font-weight: 550; }
.upload-actions { display: grid; gap: 8px; }
.upload-button { width: 100%; }
.qr-button { display: none; }

.modal { border: 0; border-radius: 18px; padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(16, 24, 40, .3); text-align: center; }
.modal::backdrop { background: rgba(16, 24, 40, .55); }
.modal h2 { font-size: 21px; margin-bottom: 8px; }
.modal p { color: var(--ink-soft); margin-bottom: 14px; }
.qr-box { background: #fff; border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px; margin: 0 auto 12px; width: 240px; height: 240px; }
.qr-box img { width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------------ review */

.review-section h2 { font-size: 17px; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-list > li { display: flex; gap: 10px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.review-list > li:first-child { border-top: 0; padding-top: 0; }
.review-list > li:last-child { padding-bottom: 0; }
.review-main { flex: 1; min-width: 0; }
.review-question { font-size: 15px; color: var(--ink-soft); }
.review-answer { font-weight: 650; overflow-wrap: anywhere; }
.review-answer:empty { display: none; }
.review-files { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.review-files li { display: flex; align-items: center; gap: 6px; font-size: 15px; min-width: 0; }
.review-files a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-files svg { width: 18px; height: 18px; color: var(--ink-soft); }
.confirm-card { margin-top: 8px; }

/* ------------------------------------------------------------------ messages */

.page-messages { display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.chat-empty { color: var(--ink-soft); text-align: center; padding: 32px 12px; }
.bubble { max-width: 88%; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.bubble.mine { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble header { display: flex; gap: 10px; align-items: baseline; font-size: 13px; margin-bottom: 4px; opacity: .85; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.bubble-files li { display: flex; align-items: center; gap: 6px; font-size: 15px; min-width: 0; }
.bubble-files a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.bubble-files svg { width: 18px; height: 18px; }
.bubble .file-size { color: inherit; opacity: .8; }
.bubble-delete { margin: 4px 0 0; text-align: right; }
.bubble-delete .btn-link { color: inherit; min-height: 32px; font-size: 14px; opacity: .9; }

.composer { position: sticky; bottom: calc(76px + var(--safe-bottom)); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.composer textarea { min-height: 60px; border: 0; padding: 6px 4px; box-shadow: none; resize: none; }
.composer textarea:focus { box-shadow: none; }
.composer-actions { display: flex; align-items: center; gap: 8px; }
.composer-actions .btn { min-height: 46px; padding: 0 14px; }
.composer-actions .btn-ghost span { display: none; }
.composer-files { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-actions .btn-primary { margin-left: auto; }

/* ------------------------------------------------------------------ bottom tab bar (phones) */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line-soft); padding-bottom: var(--safe-bottom); backdrop-filter: blur(8px);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; font-size: 12px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.tabbar a.active { color: var(--primary); }
.tabbar svg { width: 24px; height: 24px; }

/* ------------------------------------------------------------------ larger screens */

@media (min-width: 560px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .upload-actions { grid-template-columns: 1fr 1fr; }
  .composer-actions .btn-ghost span { display: inline; }
}

@media (min-width: 768px) {
  .page { padding: 32px 24px 48px; }
  .page-title { font-size: 30px; }
  .q-title { font-size: 30px; }
  .auth-card { padding: 36px 32px; margin-top: 32px; }
  .topnav { display: flex; }
  .logout-form { display: block; }
  .tabbar { display: none; }
  body.with-tabbar .page { padding-bottom: 48px; }
  .composer { bottom: 16px; }
  .page-question { padding-bottom: 150px; }
  .logout-block { display: none; }
}

/* The QR option only makes sense on a device with a mouse: a phone can use its camera directly. */
@media (hover: hover) and (pointer: fine) {
  .qr-button { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- payment ---------- */
.price-box { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 16px 18px; margin: 18px 0; border: 1px solid var(--line, #d9dee8); border-radius: 12px; background: var(--primary-soft); }
.price-box span { color: var(--ink-soft); }
.price-box strong { font-size: 26px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted.center.small { text-align: center; font-size: 13px; margin: 10px 0 14px; }
.badge-PaymentDue { background: var(--warn-soft); color: var(--warn); }
