:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --ink: #111827;
  --ink-soft: #4b5563;
  --line: #e5e2da;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --good: #15803d;
  --good-soft: #e3f5ec;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(17 24 39 / 5%), 0 10px 28px rgb(17 24 39 / 7%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f17;
    --surface: #161c2c;
    --surface-2: #1c2335;
    --ink: #eef1f7;
    --ink-soft: #a7b0c2;
    --line: #262e42;
    --brand: #8b8cff;
    --brand-2: #b18cff;
    --brand-ink: #0c0f17;
    --brand-soft: #1d2242;
    --good: #4ade80;
    --good-soft: #13291f;
    --warn: #f0b44c;
    --warn-soft: #2c2413;
    --bad: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 28px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .6rem; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .8rem; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.loading { padding: 4rem 0; text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------ header & footer */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.logo { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.1rem; }
.logo .muted { font-weight: 500; margin-left: .25rem; }
.logo svg { width: 30px; height: 30px; }
.logo-bg { fill: var(--brand); }
.logo-p { fill: none; stroke: var(--brand-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.logo-dot { fill: var(--brand-ink); }
.foot { padding: 2.5rem 0 3rem; color: var(--ink-soft); font-size: .88rem; }
.foot a { color: var(--ink-soft); }

/* ------------------------------------------------------------ layout */
.hello { padding: 2.25rem 0 1.25rem; }
.section { margin-bottom: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.2rem; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink);
  font: inherit; font-weight: 650; text-decoration: none;
}
.button:disabled { opacity: .6; cursor: progress; }
.button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.button.small { padding: .4rem .85rem; font-size: .9rem; }

.pill { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--surface-2); color: var(--ink-soft); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------------------ project progress */
.stages { list-style: none; padding: 0; margin: 1rem 0 .5rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .35rem; }
.stages li { text-align: center; font-size: .78rem; color: var(--ink-soft); }
.stages li::before { content: ""; display: block; height: 6px; border-radius: 999px; background: var(--line); margin-bottom: .45rem; }
.stages li.done::before { background: var(--brand); opacity: .55; }
.stages li.current { color: var(--ink); font-weight: 700; }
.stages li.current::before { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.project-summary { margin: 0 0 .25rem; overflow-wrap: anywhere; }
.stage-due { display: block; font-weight: 400; color: var(--ink-soft); font-size: .72rem; }
.project-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .2rem .75rem; margin: .6rem 0; }
.project-fields dd { margin: 0; overflow-wrap: anywhere; }
.project-update { margin: .75rem 0; padding: .6rem .9rem; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 10px 10px 0; overflow-wrap: anywhere; }
.project-scope { margin: 0 0 .75rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ quotes */
.quote-lines { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .95rem; }
.quote-lines th, .quote-lines td { text-align: left; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
.quote-lines th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.total { font-size: 1.15rem; font-weight: 750; text-align: right; }
.accept { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.accept label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .75rem; }
.accept input[type=text] { display: block; width: 100%; max-width: 22rem; margin-top: .35rem; }
.check { display: flex !important; gap: .6rem; align-items: flex-start; font-weight: 500 !important; }
.check input { margin-top: .3rem; }
input, textarea {
  padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
textarea { width: 100%; resize: vertical; }

/* ------------------------------------------------------------ messages */
.thread { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .6rem; max-height: 28rem; overflow-y: auto; }
.msg { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--brand-soft); }
.msg.update { align-self: center; max-width: 95%; background: transparent; border: 1px dashed var(--line); font-size: .92rem; color: var(--ink-soft); text-align: center; }
.msg .meta { display: block; font-size: .75rem; color: var(--ink-soft); margin-top: .25rem; }
.compose { display: flex; flex-direction: column; gap: .6rem; align-items: flex-end; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--bg); padding: .65rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100% - 2rem);
}
.toast.error { background: var(--bad); color: #fff; }

@media (max-width: 640px) {
  .stages { grid-auto-flow: row; grid-template-columns: 1fr; }
  .stage-due { display: inline; margin-left: .4rem; }
  .stages li { display: flex; align-items: center; gap: .6rem; text-align: left; }
  .stages li::before { width: 1.2rem; height: 1.2rem; margin: 0; flex: none; }
  .msg { max-width: 100%; }
  .logo .muted { display: none; }
}

/* ------------------------------------------------------------ printable quote */
.print-only { display: none; }
/* Service agreements */
.agreement + .agreement { margin-top: 1rem; }
.agreement.ended { opacity: .75; }
.agreement-read summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.agreement-text { max-height: 32rem; overflow: auto; padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: 10px; line-height: 1.6; }
.agreement-text h3 { font-size: 1.02rem; margin: 1.1rem 0 .4rem; }
.agreement-text h4 { font-size: .95rem; margin: .9rem 0 .3rem; }
.agreement-text h3:first-child, .agreement-text h4:first-child { margin-top: 0; }
.agreement-text p, .agreement-text ul { margin: 0 0 .65rem; }
#print-area .agreement-text { max-height: none; overflow: visible; border: 0; padding: 0; }

@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; font: 11pt/1.5 var(--font); }
  #print-area table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
  #print-area th, #print-area td { text-align: left; padding: .35rem .25rem; border-bottom: 1px solid #ccc; }
  #print-area .num { text-align: right; }
}

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }

.signin-form { display: grid; gap: .9rem; max-width: 22rem; margin-top: .5rem; }
.signin-form[hidden] { display: none; }
.signin-form label { display: grid; gap: .3rem; font-weight: 600; }
.signin-form input { width: 100%; }
.signin-form .small { font-weight: 400; }

/* ---------------------------------------------------------------- website preview */
.preview { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.preview h3 { margin: 0; font-size: 1.05rem; }
.preview-frame { display: block; width: 100%; height: min(75vh, 860px); margin: .75rem auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.preview-frame[data-size="phone"] { max-width: 390px; height: min(75vh, 780px); }
.preview .button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.preview code { overflow-wrap: anywhere; }
@media (max-width: 640px) { .preview-sizes { display: none; } }

/* ---------------------------------------------------------------- files for their website */
.files { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.files h3 { margin: 0; font-size: 1.05rem; }
.file-grid { list-style: none; padding: 0; margin: .75rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .6rem; }
.file-grid li { border: 1px solid var(--line); border-radius: 10px; padding: .4rem; min-width: 0; overflow-wrap: anywhere; }
.file-grid img, .file-doc { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); margin-bottom: .3rem; }
.file-doc { display: grid; place-items: center; font-weight: 700; color: var(--ink-soft); text-decoration: none; }
.files .btn-row input[type="text"] { flex: 1; min-width: 12rem; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line); font: inherit; }
.files .btn-row input[type="file"] { max-width: 100%; }

/* Payments and cloud running costs on a quote (quote_costs.py) */
.payments, .running-costs { margin: 1rem 0; padding-top: .75rem; border-top: 1px solid var(--line, var(--surface-2)); }
.payments h3, .running-costs h3 { margin: 0 0 .4rem; font-size: 1rem; }
ul.plain { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .3rem; }

/* To-do list and what they have (tasks and systems) */
.todos { list-style: none; margin: 0 0 .75rem; padding: 0; }
.todos li { padding: .55rem 0; border-top: 1px solid var(--line, var(--surface-2)); }
.todos li:first-child { border-top: 0; }
.todo label { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; font-weight: 550; }
.todo input[type=checkbox] { width: 1.2rem; height: 1.2rem; margin-top: .1rem; flex: none; }
.todo label + .small { margin-left: 1.8rem; }
.todo.done label span { color: var(--ink-soft); text-decoration: line-through; }
.card h3 { margin: 1rem 0 .3rem; font-size: 1rem; }
.systems { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem 1rem; margin: 0; }
.systems dt { color: var(--ink-soft); font-weight: 600; padding-top: .1rem; }
.systems dd { margin: 0; }
.systems ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
@media (max-width: 640px) { .systems { grid-template-columns: 1fr; } .systems dd { margin-bottom: .5rem; } }
.card + .section { margin-top: 1rem; }
