/* AiAutomations product family style: same tokens, font, logo, buttons, inputs, pills, cards and split login page as
   AiSocialMediaAssistant (frontend/src/styles.css), the Invoice Reader (web/src/styles/tokens.css + family.css) and
   the ingredient label tool (static/family.css). Light is the reference; dark follows the system. */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Variable.woff") format("woff");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
:root {
  --accent: #0F766E; --accent-hover: #115E59; --accent-dark: #0F4F49; --accent-light: #E6F4F1; --accent-border: #8CCFC4;
  --accent-fg: #FFFFFF;
  --warn-bg: #FEF3E2; --warn-text: #9A4D00; --warn-border: #F5C98A;
  --err-bg: #FDECEC; --err-text: #B42318; --err-border: #F3B4AE;
  --logo-ink: #0F172A; --logo-dot: #5EEAD4; --brand-panel: #E6F4F1; --brand-panel-line: #CDE7E1; --headline: #0F4F49;
  --bg: #F1F5F9; --surface: #FFFFFF; --surface-2: #F8FAFC; --surface-3: #E2E8F0; --line: #E2E8F0; --line-2: #CBD5E1;
  --fg: #0F172A; --fg-2: #334155; --muted: #475569; --faint: #64748B;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-pop: 0 4px 14px rgba(15, 23, 42, .12);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --f-ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 8px; --r-s: 6px; --r-l: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2DD4BF; --accent-hover: #5EEAD4; --accent-dark: #99F6E4; --accent-light: #0F2F2D; --accent-border: #1F6F67;
    --accent-fg: #042F2E;
    --warn-bg: #2E2412; --warn-text: #FBBF5A; --warn-border: #6B4B12;
    --err-bg: #2F1517; --err-text: #FCA5A5; --err-border: #7A2A2A;
    --logo-ink: #E2E8F0; --logo-dot: #5EEAD4; --brand-panel: #0F2F2D; --brand-panel-line: #1F4A45; --headline: #99F6E4;
    --bg: #0B1220; --surface: #111A2B; --surface-2: #162236; --surface-3: #22304A; --line: #22304A; --line-2: #33445F;
    --fg: #F1F5F9; --fg-2: #CBD5E1; --muted: #9AA8BC; --faint: #7C8BA1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-pop: 0 6px 18px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-ui); }
h1, h2 { letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
pre { font: 13px var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; overflow-x: auto; margin: 0; }

/* ---------- logo + product name ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); flex: none; }
.aia-logo { flex: none; display: block; }
.aia-logo .ink { fill: none; stroke: var(--logo-ink); stroke-width: 4.5; stroke-linecap: round; }
.aia-logo circle.ink { stroke-linecap: butt; }
.aia-logo .dot { fill: var(--logo-dot); stroke: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { display: block; font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--fg); white-space: nowrap; }
.brand-name span { color: var(--accent); }
.brand-by { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 1px; white-space: nowrap; }

/* ---------- top bar + page ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px;
  min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); }
main.page { max-width: 820px; margin: 0 auto; padding: 24px 16px; }
main.page.slim { max-width: 660px; }
.copy { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 16px; }
.card.center { text-align: center; padding: 40px 24px; }
.card.center p { margin: 0; }

/* ---------- buttons (family: teal outline; .primary filled) ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--accent-border); border-radius: var(--r); background: var(--surface); color: var(--accent-dark);
  font: 500 14px var(--f-ui); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .button:hover { background: var(--accent-light); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { border-color: var(--err-border); color: var(--err-text); }
button.danger:hover { background: var(--err-bg); }
button.link { min-height: 0; border: 0; padding: 0 2px; background: none; color: var(--accent); }
button.link:hover { background: none; color: var(--accent-hover); text-decoration: underline; }

/* ---------- inputs ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--fg-2); margin-top: 14px; }
label.field { display: flex; flex-direction: column; gap: 6px; }
label .muted { font-weight: 400; }
input[type=text], input[type=password], textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; font: 14px var(--f-ui); color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
}
label + input, label + textarea { margin-top: 6px; }
textarea { line-height: 1.5; resize: vertical; }
input:hover, textarea:hover { border-color: var(--line-2); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.error { background: var(--err-bg); border: 1px solid var(--err-border); border-radius: var(--r); color: var(--err-text);
  padding: 8px 12px; margin: 12px 0 0; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row input[type=text] { flex: 1 1 220px; min-width: 0; width: auto; font-family: var(--f-mono); font-size: 13px; }

/* ---------- send ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; margin-top: 16px;
  border: 2px dashed var(--line-2); border-radius: var(--r-l); background: var(--surface-2); padding: 36px 16px;
  color: var(--muted); transition: background .15s, border-color .15s; }
.drop strong { color: var(--fg); font-size: 16px; font-weight: 600; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-light); }
.files { list-style: none; margin: 12px 0 0; padding: 0; }
.files li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.files li .name, .transfer .name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.files li .muted { white-space: nowrap; font-variant-numeric: tabular-nums; }
.files.downloads { margin: 16px 0; border-top: 1px solid var(--line); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 18px 0 8px; }
#bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#progress-text { font-variant-numeric: tabular-nums; }
.done { margin-top: 16px; padding: 16px; border: 1px solid var(--accent-border); border-radius: var(--r); background: var(--accent-light); }
.done h2 { color: var(--accent-dark); margin-bottom: 0; }
.done p { margin: 10px 0 0; color: var(--fg-2); }
.done input[type=text] { background: var(--surface); }
.message { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; color: var(--fg-2); }

/* ---------- list ---------- */
.transfer { padding: 16px 0; border-bottom: 1px solid var(--line); }
.transfer:first-child { padding-top: 0; }
.transfer:last-child { border-bottom: 0; padding-bottom: 0; }
.transfer .row:first-child { margin-top: 0; }
.transfer p { margin: 4px 0 0; overflow-wrap: anywhere; }
.badge { font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 10px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.badge.ready { background: var(--accent-light); color: var(--accent-dark); border-color: var(--accent-border); }
.badge.expired { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }
.badge.uploading { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
#server-info { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- login: split screen (family .auth-*) ---------- */
.auth-split { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg); }
.auth-left { flex: 1 1 420px; max-width: 46%; background: var(--brand-panel); padding: 48px; display: flex;
  flex-direction: column; justify-content: space-between; position: relative; min-height: 100vh;
  border-right: 1px solid var(--brand-panel-line); }
.auth-logo-round { position: absolute; top: 48px; right: 48px; width: 112px; height: 112px; border-radius: 50%;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px var(--accent-border), var(--shadow-pop); }
.auth-left-body { margin: auto 0; padding-top: 140px; max-width: 520px; }
.auth-brand-card { display: inline-flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 12px;
  border: 1px solid var(--line); box-shadow: var(--shadow); padding: 12px 22px 12px 12px; margin-bottom: 28px; }
.auth-brand-card .brand-name { font-size: 20px; font-weight: 600; }
.auth-brand-card .brand-by { font-size: 12px; }
.auth-headline { font-size: 38px; line-height: 1.12; font-weight: 800; margin: 0 0 20px; letter-spacing: -.02em;
  color: var(--headline); text-wrap: balance; }
.auth-sub { font-size: 16px; line-height: 1.6; color: var(--fg-2); margin: 0; }
.auth-foot { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 32px 0 0; max-width: 460px; }
.auth-right { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px; position: relative; min-height: 100vh; }
.login-card { width: 100%; max-width: 460px; padding: 36px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.login-card p, .login-card .field, .login-card .error { margin: 0; }
.login-card .muted { font-size: 14px; }
.auth-step { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.auth-title { font-size: 26px; font-weight: 700; margin: 0; }
.login-card .field input { min-height: 44px; background: var(--bg); }
.auth-submit { width: 100%; min-height: 44px; margin-top: 4px; }
.auth-copy { position: absolute; bottom: 16px; right: 24px; font-size: 12px; color: var(--muted); margin: 0; }
@media (max-width: 860px) {
  .auth-left { max-width: none; min-height: auto; padding: 24px 16px; border-right: none; border-bottom: 1px solid var(--brand-panel-line); }
  .auth-logo-round { display: none; }
  .auth-left-body { padding-top: 0; }
  .auth-brand-card { margin-bottom: 16px; }
  .auth-headline { font-size: 26px; }
  .auth-foot { display: none; }
  .auth-right { min-height: auto; padding: 32px 16px 56px; }
  .login-card { padding: 24px; }
}
@media (max-width: 480px) {
  .files li { flex-wrap: wrap; }
  .card { padding: 16px; }
}
