/* Profast design system — reproduced from the approved claude.ai mockups.
   Tokens + components; templates use these classes so the look stays consistent.
   Warm light theme (the design is committed to it). Fonts loaded in base.html. */

:root {
  --bg: #f6efe4;
  --surface: #fffdf9;
  --sunken: #fbf7f0;
  --line: #ece0cf;
  --ink: #1f3350;
  --muted: #7c7466;
  --accent: #c86a3d;
  --accent-2: #b1552b;
  --good: #3d7a52;  --good-bg: #e9f0ea;
  --warn: #9c6714;  --warn-bg: #f4ecdb;
  --info: #35608f;  --info-bg: #e6edf4;
  --bad:  #9b2c2c;  --bad-bg:  #f6e6e2;
  --radius: 10px;
  --font-head: "Source Sans 3", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans SC", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

.container { max-width: 920px; margin: 0 auto; padding: clamp(16px,4vw,26px) clamp(14px,4vw,28px) 64px; }

/* ---------- top bar + tabs ---------- */
.appbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.appbar-inner {
  max-width: 920px; margin: 0 auto; padding: 12px clamp(14px,4vw,28px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand-logo { height: 30px; width: auto; display: block; }
.signed-in { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.signed-in strong { color: var(--ink); font-weight: 600; }
.signed-in .sep { opacity: .5; }

.tabbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.tabbar-inner { max-width: 920px; margin: 0 auto; padding: 0 clamp(14px,4vw,28px); display: flex; gap: 6px; }
.tab {
  font-family: var(--font-head); font-weight: 500; font-size: 17px; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 11px 14px; cursor: pointer;
}
.tab.active { font-weight: 600; color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 520px) {
  .tabbar-inner { gap: 2px; }
  .tab { font-size: 15px; line-height: 1.25; padding: 10px 8px; flex: 1 1 0; }
}

/* ---------- sections + fields ---------- */
.section {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: clamp(16px,3vw,22px); margin-bottom: 18px;
}
.section-head { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.section-head::before {
  content: ""; width: 7px; height: 18px; border-radius: 2px; background: var(--accent); flex-shrink: 0;
}
.section-head h2 {
  font-family: var(--font-head); font-weight: 700; font-size: 21px; margin: 0; color: var(--ink);
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { min-width: 0; }
.span-all { grid-column: 1 / -1; }

label { display: block; font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
label .req { color: var(--accent); }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }

input[type=text], input[type=password], input[type=file], input[type=number], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--sunken); border: 0.8px solid var(--line); border-radius: 10px;
  padding: 11px 12px;
}
select { padding-right: 32px; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%237c7466' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { resize: vertical; }
select.locked { pointer-events: none; opacity: .6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; margin-bottom: 0; }
.check input { width: auto; }

/* ---------- buttons ---------- */
.btn-primary, .btn-generate, .btn-download {
  font-family: var(--font-head); font-weight: 700; color: #fff; background: var(--accent);
  border: 1px solid var(--accent); border-radius: 14px; cursor: pointer;
  box-shadow: rgba(200,106,61,.55) 0 8px 18px -8px; transition: background .16s, box-shadow .16s, transform .06s;
}
.btn-primary:hover, .btn-generate:hover, .btn-download:hover { background: var(--accent-2); }
.btn-generate { display: block; width: 100%; font-size: 22px; letter-spacing: .01em; padding: 16px 20px; }
.btn-download { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; border-radius: 12px; padding: 14px 24px; text-decoration: none; margin-bottom: 22px; }
.btn-add {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-family: var(--font-head); font-weight: 600; font-size: 14px; color: var(--accent);
  background: none; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--radius); padding: 10px 16px; cursor: pointer;
}
.link { background: none; border: none; color: var(--muted); cursor: pointer; font-family: var(--font-body); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- load an earlier draft (under the reference code) ---------- */
.restore-hint { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.restore-hint .info { margin: 0 0 8px; }
.restore-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.restore-row select { width: auto; max-width: 100%; flex: 1 1 260px; padding-top: 8px; padding-bottom: 8px; }
#restoreMsg:not(:empty) { margin-top: 8px; }
.autosave { margin: 6px 0 0; font-size: 12.5px; line-height: 1.35; }
.autosave.warn-text { color: var(--warn); }

/* ---------- privacy notice: sentence only, no box ---------- */
.banner { margin: 0 0 20px; }
.banner p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.banner strong { font-weight: 700; }

/* ---------- plan cards ---------- */
.plan { border: 1px solid var(--line); border-radius: 12px; background: var(--sunken); padding: 16px; margin-bottom: 12px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.plan-num { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--ink); }

/* ---------- live cash-flow ---------- */
.preview { margin-bottom: 14px; }
.cashflow-label { font-family: var(--font-body); font-size: 14px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; }
.metric .m-label { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.metric .m-num { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 27px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric.bad { border-color: var(--bad); background: var(--bad-bg); }
.metric.bad .m-label, .metric.bad .m-num { color: var(--bad); }
.metric.bad .m-num { font-weight: 700; }

/* ---------- status messages: no box, coloured dot in front, sentence only ---------- */
.ok, .warn, .error, .info {
  display: flex; gap: 10px; align-items: flex-start; margin: 8px 0;
  font-size: 15px; line-height: 1.5; background: none; border: none; padding: 0;
}
.ok { color: var(--good); }
.warn { color: var(--warn); }
.error { color: var(--bad); }
.info { color: var(--info); }
.ok::before, .warn::before, .error::before, .info::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  position: relative; top: 6px;
}
.ok::before { background: #2ca24a; }     /* green dot */
.warn::before { background: #f0b100; }    /* yellow dot (was the light bulb) */
.error::before { background: #d92c2c; }   /* red dot (was ⛔) */
.info::before { background: var(--info); }

/* ---------- result + document preview ---------- */
.result-box { margin-top: 22px; }
.result-banner { display: flex; gap: 13px; margin-bottom: 20px; }
.result-check { width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px; background: var(--good);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.result-banner .r-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--good); }
.result-banner p { margin: 3px 0 0; font-size: 15px; color: var(--ink); }
.preview-label { font-family: var(--font-body); font-size: 14px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin: 10px 0 9px; }
.doc-preview {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: rgba(31,51,80,.18) 0 20px 44px -22px; padding: 28px clamp(18px,4vw,34px);
  max-height: 640px; overflow: auto;
}
.doc-preview h1 { font-family: var(--font-head); font-weight: 700; font-size: 26px; text-align: center; letter-spacing: -.01em; margin: 0 0 6px; color: var(--ink); }
.doc-preview h2 { font-family: var(--font-head); font-weight: 700; font-size: 18px; margin: 22px 0 8px; color: var(--ink); }
.doc-preview h3 { font-family: var(--font-head); font-weight: 600; font-size: 15px; margin: 16px 0 6px; }
.doc-preview p, .doc-preview li { font-size: 15px; color: var(--ink); }
.doc-preview table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; min-width: 440px; }
.doc-preview th { text-align: left; border: 1px solid #d9d4cb; padding: 9px 12px; background: #f6f3ee; font-family: var(--font-head); font-weight: 700; }
.doc-preview td { border: 1px solid #d9d4cb; padding: 9px 12px; }
.doc-preview em { color: var(--muted); }

/* ---------- history ---------- */
.history-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.history-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; cursor: pointer; list-style: none; }
.history-item > summary::-webkit-details-marker { display: none; }
.history-item .h-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-size: 15px; color: var(--ink); }
.history-item .h-meta strong { font-family: var(--font-mono); font-weight: 700; }
.history-item .h-meta .sep { opacity: .4; }
.history-item .h-body { padding: 0 18px 18px; }
.h-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 12px 0 22px; }
.h-actions .btn-download { margin-bottom: 0; }

/* ---------- feedback ---------- */
.fb-box { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.history-item .h-meta .fb-title { font-family: var(--font-head); font-size: 17px; }
.fb-link { font-size: 14px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.fb-submit { font-size: 17px; padding: 12px 24px; margin-top: 16px; }
.fb-list { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 4px; }
.fb-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.fb-item:last-child { border-bottom: none; padding-bottom: 0; }
.fb-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13.5px; color: var(--muted); }
.fb-meta strong { color: var(--ink); }
.fb-meta .sep { opacity: .4; }
.fb-meta .fb-topic { font-weight: 600; color: var(--ink); }
.fb-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.fb-thumbs img { display: block; width: 112px; height: 112px; object-fit: cover; object-position: top;
  border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }

/* ---------- spinner ---------- */
.spinner { display: none; margin-top: 12px; color: var(--muted); font-size: 15px; }
.htmx-request .spinner, .spinner.htmx-request { display: block; }

/* ---------- login ---------- */
.login-page { position: relative; min-height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .8; }
.login-overlay { position: absolute; inset: 0; background: linear-gradient(rgba(246,239,228,.45), rgba(246,239,228,.68)); }
.login-inner { position: relative; width: 100%; max-width: 410px; }
.login-logo { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto 14px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(28px,6vw,40px); box-shadow: rgba(31,51,80,.18) 0 24px 48px -18px, rgba(200,106,61,.12) 0 6px 16px -8px; }
.login-card h1 { font-family: var(--font-head); font-weight: 700; font-size: 30px; letter-spacing: -.01em; color: var(--ink); margin: 0 0 6px; text-align: center; }
.login-card .sub { font-size: 17px; color: var(--muted); margin: 0 0 26px; text-align: center; }
.login-card .btn-primary { display: block; width: 100%; margin-top: 18px; font-size: 20px; padding: 15px 20px; border-radius: 14px; }
.login-how { margin-top: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; backdrop-filter: blur(4px); }
.login-how h2 { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--ink); margin: 0 0 4px; }
.how-intro { font-size: 14.5px; color: var(--muted); margin: 0 0 12px; }
.how-steps { margin: 0; padding-left: 20px; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.how-steps li { margin: 0 0 8px; padding-left: 2px; }
.how-steps li::marker { color: var(--accent); font-weight: 700; }
.how-foot { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.tagline { font-size: 15px; color: var(--muted); text-align: center; margin: 22px 0 0; }

/* ---------- your style tab ---------- */
.btn-secondary {
  font-family: var(--font-head); font-weight: 600; font-size: 16px; color: var(--accent);
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px;
  padding: 11px 20px; cursor: pointer;
}
.btn-secondary:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.btn-wide { width: 100%; font-size: 17px; padding: 12px 20px; border-radius: 12px; }
.btn-small { font-size: 14px; padding: 8px 16px; border-radius: 10px; }
.history-item .h-meta strong.plain { font-family: var(--font-head); font-size: 16px; }
.accept-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 4px; }
.note-list { margin: 6px 0 10px; padding-left: 20px; }
.note-list li { margin: 3px 0; }
.problems { margin: 4px 0 14px 19px; padding-left: 16px; color: var(--bad); font-size: 14px; }
.problems li { margin: 4px 0; overflow-wrap: anywhere; }
.checklist { margin: 4px 0 12px; padding-left: 20px; }
.checklist li { margin: 4px 0; }
.outline { margin: 6px 0 2px; padding-left: 22px; }
.outline li { font-size: 15px; margin: 3px 0; }
.style-doc { max-height: 420px; margin-top: 10px; padding: 18px clamp(14px,3vw,24px); }
.style-doc h1 { font-size: 20px; text-align: left; }
.version { padding: 10px 0; border-bottom: 1px solid var(--line); }
.version:last-child { border-bottom: none; }
.version-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; font-size: 14.5px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--good); background: var(--good-bg);
  border-radius: 999px; padding: 1px 9px; margin-left: 6px; }
.badge.current { color: var(--info); background: var(--info-bg); margin-left: 0; }
.link.restore { color: var(--accent); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.tune-result { background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.excerpt { margin: 4px 0 0; padding: 12px 16px; background: #fff; border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0; white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
.subtabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 26px 0 14px; }
.subtab {
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-family: var(--font-body); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.subtab:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.subtab.active { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.subtab-title { font-family: var(--font-head); font-weight: 700; font-size: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.subtab-title .badge { margin-left: 0; }
.subtab-desc { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.badge.encouraged { color: var(--accent-2); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.section-head .badge { margin-left: 2px; }
.sub-lead { margin: 0 0 14px; }
.sub-field { max-width: 320px; margin-top: 14px; }
.sub-submit { display: block; margin-top: 16px; }
.job { padding: 8px 0; border-bottom: 1px solid var(--line); }
.job:last-of-type { border-bottom: none; }
.job .ok, .job .info, .job .error { margin: 4px 0; }
.job-items { margin: 4px 0 4px 19px; padding-left: 16px; font-size: 14px; }
.job-detail { margin: 2px 0 4px 19px; color: var(--bad); }

/* ---------- admin ---------- */
.admin-actions { display: flex; gap: 10px; margin: 12px 0 14px; }
.admin-actions form { margin: 0; }
.raw-md { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12.5px; background: var(--sunken);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 360px; overflow: auto; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-family: var(--font-head); border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.data-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- connection / server error banner (base.html) ---------- */
.net-error {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50;
  width: min(640px, calc(100% - 32px)); display: flex; align-items: flex-start; gap: 12px;
  background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; box-shadow: rgba(31,51,80,.18) 0 8px 24px -8px;
}
.net-error #netErrorText { flex: 1; }
.net-error a { color: var(--bad); font-weight: 600; }
.net-error .link { color: var(--bad); font-size: 16px; }
button:disabled { opacity: .55; cursor: progress; }

/* ---------- draft in progress (partials/generating.html) ---------- */
.generating { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.generating-line { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.generating .small { margin: 8px 0 0; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pf-pulse 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes pf-pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
