/* Applecado Reports â€” clean & modern, light-touch Applecado branding.
   Use the tokens below; don't hard-code colours elsewhere. Lora is for headings/brand only. */

:root {
  --green: #2EB872;
  --green-ink: #1f8f56;
  --leaf: #ADE58F;
  --leaf-soft: #e9f7df;
  --cream: #F8F5EB;
  --coral: #FF5D6E;
  --ink: #1E1E1E;
  --ink-2: #5b5b57;
  --ink-3: #8c8b85;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --line: #ebe8df;
  --line-strong: #dcd8cc;
  --shadow: 0 1px 2px rgba(30, 30, 30, .06), 0 8px 24px rgba(30, 30, 30, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Lora, Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green: #3ccb83;
    --green-ink: #6ee0a5;
    --leaf: #4f7a3a;
    --leaf-soft: #1f2a1c;
    --cream: #121412;
    --coral: #ff7584;
    --ink: #ecebe6;
    --ink-2: #b4b2aa;
    --ink-3: #7f7d76;
    --surface: #1a1c1a;
    --surface-2: #1e211e;
    --line: #2a2d2a;
    --line-strong: #383c38;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 14px var(--font); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-ink); border-color: var(--green-ink); }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0c1a12; } }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--leaf-soft); border-color: transparent; }
.btn-icon { width: 36px; padding: 0; font-size: 20px; line-height: 1; }
.btn-block { width: 100%; height: 44px; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--coral); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--coral) 10%, transparent); border-color: transparent; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=color], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; min-height: 38px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent);
}
textarea { resize: vertical; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); }
label > input, label > select, label > textarea, label > .dt { margin-top: 6px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink); cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--green); margin: 0; }
.stack > * + * { margin-top: 14px; }
.alert {
  background: color-mix(in srgb, var(--coral) 12%, var(--surface)); color: var(--ink);
  border-left: 4px solid var(--coral); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px;
}
.field-error { display: block; color: var(--coral); font-weight: 500; margin-top: 4px; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 500;
  animation: toast-out .4s ease 3.5s forwards;
}
.toast.is-gone { opacity: 0; pointer-events: none; }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); visibility: hidden; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 40px;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.logo { display: block; width: auto; }
.brand .logo { height: 30px; }
.brand .logo-small { display: none; }
.brand-sub {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green-ink); background: var(--leaf-soft); padding: 3px 7px; border-radius: 999px;
}
.topbar-centre { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: var(--leaf); color: #1E1E1E;
}
.menu-panel {
  position: absolute; right: 0; top: 46px; width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu-panel a, .menu-panel .linkish {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.menu-panel a:hover, .menu-panel .linkish:hover { background: var(--leaf-soft); }
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-who span { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }

/* ---------- forms / panels ---------- */
.panel { max-width: 860px; margin: 32px auto 64px; padding: 0 40px; }
.panel-wide { max-width: 1240px; }
.panel-head { margin-bottom: 18px; }
.panel-head h1 { font-size: 30px; margin-top: 6px; }
.panel-head p { margin: 6px 0 0; }
.back { font-size: 14px; text-decoration: none; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 19px; margin-bottom: 12px; }

.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field legend, .field .label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.field-title input {
  font-family: var(--serif); font-size: 24px; font-weight: 600; border: 0; border-bottom: 2px solid var(--line);
  border-radius: 0; padding: 4px 0 8px; background: transparent; box-shadow: none !important;
}
.field-title input:focus { border-bottom-color: var(--green); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--ink); }
.switch input { position: absolute; opacity: 0; }
.switch-track { width: 40px; height: 23px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--green); outline-offset: 2px; }

.form-actions { display: flex; gap: 8px; padding-top: 4px; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
.danger-zone .muted { margin-left: auto; }

/* tables (users, types) */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 0 12px 8px; }
.table td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table td.actions { text-align: right; white-space: nowrap; }
.table input[type=text], .table input[type=email] { min-height: 34px; padding: 6px 8px; }
.table input[type=color] { width: 44px; padding: 2px; min-height: 34px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--leaf-soft); color: var(--green-ink); }
.inline-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }

/* ---------- login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.blob { position: fixed; border-radius: 50%; z-index: 0; pointer-events: none; }
.blob-a { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: var(--leaf); opacity: .55; border-radius: 42% 58% 60% 40% / 45% 45% 55% 55%; }
.blob-b { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -25vmax; background: var(--leaf-soft); border-radius: 58% 42% 40% 60% / 55% 50% 50% 45%; }
@media (prefers-color-scheme: dark) { .blob-a { opacity: .25; } }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 380px;
  background: var(--surface); border-radius: 16px; padding: 32px; box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 22px; }
.auth-brand .logo { height: 44px; }
.auth-card h1 { font-size: 26px; }
.auth-card .muted { margin: 4px 0 20px; }


/* ---------- app ---------- */
input[type=search] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; min-height: 38px; width: 100%;
}
input[type=search]:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }

.topnav { display: flex; gap: 2px; margin-left: 12px; }
.topnav a {
  padding: 7px 12px; border-radius: var(--radius-sm); text-decoration: none;
  font-weight: 600; font-size: 14px; color: var(--ink-2);
}
.topnav a:hover { background: var(--leaf-soft); color: var(--ink); }
.topnav a[aria-current=page] { background: var(--leaf-soft); color: var(--green-ink); }

.page { max-width: 1480px; margin: 32px auto 64px; padding: 0 40px; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { font-size: 30px; }
.section-head { margin: 28px 0 12px; }
.section-head h2 { font-size: 21px; }
.btn span[aria-hidden] { font-size: 18px; line-height: 1; }

.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  text-decoration: none; font-weight: 600; font-size: 13px;
}
.tabs a span { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tabs a:hover { border-color: var(--ink-3); color: var(--ink); }
.tabs a[aria-current=page] { background: var(--green); border-color: var(--green); color: #fff; }
.tabs a[aria-current=page] span { color: rgba(255, 255, 255, .8); }
.search { width: 360px; max-width: 100%; }

.card-flush { padding: 6px 0; }
.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 26px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 26px; }
.card-flush .table th { padding-top: 14px; }
.table-links tbody tr:hover { background: var(--surface-2); }
.table-links a { color: var(--ink); text-decoration: none; }
.table-links a:hover { color: var(--green-ink); }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; width: 1%; }
.row-title { font-weight: 600; }
.row-sub { display: block; font-size: 13px; color: var(--ink-3); margin-top: 1px; }

.status {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong);
}
.status-sent { background: color-mix(in srgb, #3B82C4 12%, var(--surface)); border-color: color-mix(in srgb, #3B82C4 40%, transparent); color: #2d6aa3; }
.status-accepted { background: var(--leaf-soft); border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green-ink); }
.status-declined { background: color-mix(in srgb, var(--coral) 10%, var(--surface)); border-color: color-mix(in srgb, var(--coral) 40%, transparent); color: #c8394a; }
@media (prefers-color-scheme: dark) {
  .status-sent { color: #8cbbe8; }
  .status-declined { color: var(--coral); }
}
.pill-muted { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong); }

.empty { text-align: center; padding: 40px 22px; }
.empty h2 { margin-bottom: 6px; }
.empty p { margin: 0 0 16px; }
.empty p:last-child { margin-bottom: 0; }

.grid-2, .grid-3 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; align-items: start; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.hint { margin: 26px 0 0; }

.seg-radio { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.seg-radio label { position: relative; margin: 0; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: calc(var(--radius-sm) - 2px);
  font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.seg-radio input:checked + span { background: var(--leaf-soft); color: var(--green-ink); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 1px; }

.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; margin: 0 0 18px; }
.details .wide { grid-column: 1 / -1; }
.details dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 3px; }
.details dd { margin: 0; }
.pre { white-space: pre-line; }

.split { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 28px; align-items: start; }
.split .section-head { margin-top: 0; min-height: 36px; }
.client-card h2 { margin-bottom: 14px; }
.details-stack { grid-template-columns: 1fr; }

.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.placeholder { border-style: dashed; margin-bottom: 16px; }
.placeholder p { margin: 0; }
code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }

@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .page, .panel { padding: 0 20px; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .brand .logo-full { display: none; }
  .brand .logo-small { display: block; }
  .brand-sub { display: none; }
  .topnav { margin-left: 0; }
  .topnav a { padding: 7px 9px; }
  .menu { margin-left: auto; }
  .page { padding: 0 12px; margin-top: 18px; }
  .page-head h1 { font-size: 24px; }
  .search { width: 100%; }
  .hide-sm { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hint { margin-top: 0; }
}

.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-ink); }
.alert-info { background: color-mix(in srgb, #3B82C4 10%, var(--surface)); border-left-color: #3B82C4; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; font-weight: 500;
}
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history-list li { padding-top: 10px; border-top: 1px solid var(--line); }
.history-list li:first-child { padding-top: 0; border-top: 0; }
.history-mail { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.history-mail.is-failed { color: var(--coral); font-weight: 600; }

/* ---------- reports ---------- */
.fake-banner { background: var(--coral); color: #fff; font-weight: 600; font-size: 13px; text-align: center; padding: 5px 12px; }
.status-final { background: var(--leaf-soft); border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green-ink); }
.alert-warn { background: color-mix(in srgb, #E8A317 14%, var(--surface)); border-left-color: #E8A317; }
.flags { margin: 6px 0 0; padding-left: 18px; }
.flags li + li { margin-top: 4px; }
.report-title { display: flex; align-items: center; gap: 12px; }
.report-title h1 { font-size: 30px; margin-top: 6px; }
.report-layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 24px; align-items: start; }
.report-side .card + .card { margin-top: 16px; }
.report-frame { width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); background: #d9d6cc; }
.form-actions.wrap { flex-wrap: wrap; }
.form-actions form { margin: 0; }
.history-list li.is-failed .row-sub { color: var(--coral); font-weight: 600; }
.steps { margin: 0; padding-left: 20px; }
.steps li + li { margin-top: 6px; }
@media (max-width: 1100px) { .report-layout { grid-template-columns: 1fr; } }

/* page indexing request on the draft */
.needs-file { border-color: var(--green); border-width: 2px; }
.ok-line { margin: 0; color: var(--green-ink); font-weight: 600; }
.ok-line::before { content: "¹3  "; }
.ok-line strong { overflow-wrap: anywhere; }
.steps .row-sub { margin-top: 4px; }
.steps input[type=file] { display: block; margin: 8px 0; max-width: 100%; font-size: 13px; }
.help summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--green-ink); }
.help ul { margin: 8px 0 0; padding-left: 18px; }
.help li + li { margin-top: 6px; }
.help > .stack { margin-top: 10px; }
