/* Alpha AI — Support. Tokens and measurements follow the design handoff exactly. */
:root {
  --pg: #ffffff; --card: #f7f7f8; --card2: #ececf1; --line: #e6e6ea; --line2: #d2d2d8;
  --tx: #0d0d0d; --tx2: #50505a; --tx3: #8e8ea0; --inv: #ffffff;
  --ok: #10a37f; --okSoft: #e8f7f1; --warn: #c2410c; --warnSoft: #fff2ea;
  --enter: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.32, 1.2, .5, 1);
}
:root[data-theme="dark"] {
  --pg: #0d0d0d; --card: #171717; --card2: #242424; --line: #262626; --line2: #353535;
  --tx: #ececec; --tx2: #b8b8b8; --tx3: #8a8a8a; --inv: #0d0d0d;
  --ok: #19c37d; --okSoft: #0f2a20; --warn: #fb923c; --warnSoft: #2a1a0f;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--pg); -webkit-text-size-adjust: 100%; transition: background-color 420ms cubic-bezier(.4, 0, .2, 1); }
body { font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--tx); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
[hidden] { display: none !important; }
input::placeholder, textarea::placeholder { color: inherit; opacity: .5; }

@keyframes fbSpin { to { transform: rotate(360deg); } }
@keyframes fbUpIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fbPop { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

.root { position: relative; min-height: 100svh; background: var(--pg); color: var(--tx); transition: background-color 420ms, color 420ms; }

/* Header */
.hdr {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(16px, 3vw, 28px) 12px;
  background: color-mix(in srgb, var(--pg) 86%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--tx); }
.logo { width: 22px; height: 22px; object-fit: contain; filter: invert(1); transition: filter 420ms; }
:root[data-theme="dark"] .logo { filter: invert(0); }
.brand-name { font-size: 15.5px; font-weight: 600; letter-spacing: -.015em; }
.brand-sep { font-size: 15px; color: var(--tx3); }
.brand-page { font-size: 15px; color: var(--tx2); }
.grow { flex: 1; }
.theme-btn {
  appearance: none; position: relative; overflow: hidden; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--tx2); cursor: pointer;
  transition: background 200ms, color 200ms;
}
.theme-btn:hover { background: var(--card); color: var(--tx); }
.theme-btn > span { display: inline-flex; position: absolute; transition: transform 460ms cubic-bezier(.34, 1.3, .5, 1), opacity 260ms ease; }
.ico-sun { opacity: 0; transform: rotate(-90deg) scale(.6); }
.ico-moon { opacity: 1; transform: none; }
:root[data-theme="dark"] .ico-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .ico-moon { opacity: 0; transform: rotate(90deg) scale(.6); }

/* Main column */
.main {
  max-width: 600px; margin: 0 auto;
  padding: clamp(20px, 6vh, 72px) clamp(18px, 4vw, 24px) calc(clamp(48px, 10vh, 100px) + env(safe-area-inset-bottom, 0px));
}
.view { animation: fbUpIn 460ms var(--enter) both; }
.view.done { animation-duration: 480ms; }

.form { display: flex; flex-direction: column; gap: clamp(22px, 4vw, 28px); }
.head { display: flex; flex-direction: column; gap: 12px; }
.head-tight { gap: 10px; }
h1 { margin: 0; font-size: clamp(30px, 7vw, 44px); line-height: 1.08; font-weight: 600; letter-spacing: -.035em; }
.intro { margin: 0; max-width: 52ch; font-size: clamp(15.5px, 2.4vw, 16.5px); line-height: 1.6; color: var(--tx2); text-wrap: pretty; }

/* Topic segmented control */
.seg { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 16px; background: var(--card); }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 16px) / 3);
  border-radius: 12px; background: var(--pg); outline: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 16px -8px rgba(0, 0, 0, .18);
  transition: transform 420ms var(--spring);
}
.seg-opt {
  appearance: none; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  min-width: 0; min-height: 72px; padding: 10px 6px; border: 0; border-radius: 12px; background: transparent;
  font-size: 14px; font-weight: 600; line-height: 1.25; text-align: center; text-wrap: balance; color: var(--tx3);
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color 240ms ease;
}
.seg-opt svg { flex: none; }
.seg-opt[aria-checked="true"] { color: var(--tx); }

/* Fields */
.fields { display: flex; flex-direction: column; gap: 22px; }
.fields.swap { animation: fbUpIn 380ms var(--enter) both; }
.field { display: flex; flex-direction: column; gap: 8px; }
#areaField { gap: 10px; }
.label { font-size: 14px; font-weight: 600; }
.opt { font-weight: 400; color: var(--tx3); }
.input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 14px; background: var(--pg);
  font-family: inherit; font-size: 16px; color: var(--tx); outline: none; transition: border-color 200ms, box-shadow 200ms;
}
textarea.input { line-height: 1.6; resize: vertical; }
.input:focus { border-color: var(--tx); box-shadow: 0 0 0 4px var(--card); }
.area-lg { min-height: 140px; }
.area-md { min-height: 120px; }
.area-sm { min-height: 96px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line2); border-radius: 999px; background: transparent; font-size: 14px; font-weight: 500; color: var(--tx2);
  cursor: pointer; transition: background 200ms, color 200ms, border-color 200ms;
}
.chip:hover { border-color: var(--tx); }
.chip.on { background: var(--tx); border-color: var(--tx); color: var(--inv); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Screenshots */
.shots { display: flex; flex-direction: column; gap: 10px; }
.drop {
  appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
  border: 1.5px dashed var(--line2); border-radius: 14px; background: transparent; color: var(--tx2); text-align: left; cursor: pointer;
  transition: border-color 200ms, background 200ms;
}
.drop:hover { border-color: var(--tx3); background: var(--card); }
.drop-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--card); color: var(--tx); }
.drop-text { display: flex; flex-direction: column; gap: 2px; }
.drop-title { font-size: 14.5px; font-weight: 600; color: var(--tx); }
.drop-sub { font-size: 14px; color: var(--tx3); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; max-width: 480px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card); border: 1px solid var(--line);
  transition: opacity 200ms ease, transform 240ms var(--enter); animation: fbPop 340ms var(--enter) backwards;
}
.thumb.removing { opacity: 0; transform: scale(.85); }
.thumb-open { appearance: none; position: absolute; inset: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.thumb-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--enter); }
.thumb-open:hover img { transform: scale(1.06); }
.thumb-scrim { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 7px; background: rgba(0, 0, 0, .4); pointer-events: none; }
.thumb-bar { flex: 1; height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.thumb-fill { display: block; height: 100%; width: 0; background: #ffffff; transition: width 140ms linear; }
.thumb-x {
  appearance: none; position: absolute; top: 4px; right: 4px; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #ffffff; cursor: pointer; transition: background 160ms;
}
.thumb-x:hover { background: rgba(0, 0, 0, .85); }
.thumb-add {
  appearance: none; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0;
  border: 1.5px dashed var(--line2); border-radius: 12px; background: transparent; color: var(--tx2); cursor: pointer; transition: border-color 200ms, background 200ms;
}
.thumb-add:hover { border-color: var(--tx3); background: var(--card); }
.err { padding: 10px 12px; border-radius: 10px; background: var(--warnSoft); font-size: 14px; color: var(--warn); animation: fbUpIn 260ms var(--enter) both; }

/* Send */
.send-wrap { display: grid; min-height: 52px; }
.send {
  grid-area: 1 / 1; appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; height: 52px;
  border: 0; border-radius: 14px; background: var(--tx); font-size: 15.5px; font-weight: 600; color: var(--inv); cursor: pointer;
  transition: opacity 260ms ease, transform 380ms var(--enter), filter 180ms;
}
.send:hover { filter: brightness(1.15); }
.send:disabled { opacity: .35; pointer-events: none; }
.send.busy { opacity: 1; }
.spin { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: fbSpin 720ms linear infinite; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 24px; padding-top: 4px; font-size: 14px; color: var(--tx3); text-align: center; line-height: 1.5; }
.link {
  appearance: none; padding: 0; border: 0; background: transparent; font-size: 14px; font-weight: 600; color: var(--tx); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line2);
}

/* Sent */
.done { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 4vh; text-align: center; }
.ok-ico { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 999px; background: var(--okSoft); color: var(--ok); animation: fbPop 520ms cubic-bezier(.34, 1.4, .5, 1) 100ms backwards; }
.done-title { font-size: clamp(28px, 4vw, 36px); line-height: 1.1; letter-spacing: -.03em; }
.done-line { margin: 0; max-width: 40ch; font-size: 16px; line-height: 1.6; color: var(--tx2); text-wrap: pretty; overflow-wrap: anywhere; }
.ref-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--card); font-size: 14px; color: var(--tx2); }
.ref-pill strong { font-weight: 700; letter-spacing: .04em; color: var(--tx); }
.done-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; width: 100%; max-width: 440px; }
.pill { appearance: none; flex: 1 1 180px; height: 48px; padding: 0 22px; border-radius: 999px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.pill-pri { border: 0; background: var(--tx); color: var(--inv); transition: filter 180ms; }
.pill-pri:hover { filter: brightness(1.15); }
.pill-out { border: 1px solid var(--line2); background: transparent; color: var(--tx); transition: background 180ms; }
.pill-out:hover { background: var(--card); }

/* Track */
.track { display: flex; flex-direction: column; gap: 24px; }
.back {
  appearance: none; align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 8px; margin-left: -8px;
  border: 0; border-radius: 999px; background: transparent; font-size: 14px; font-weight: 600; color: var(--tx2); cursor: pointer; transition: background 180ms, color 180ms;
}
.back:hover { background: var(--card); color: var(--tx); }
.lookup { display: flex; flex-wrap: wrap; gap: 10px; }
.lookup-input { flex: 999 1 220px; width: auto; letter-spacing: .05em; text-transform: uppercase; }
.check {
  appearance: none; flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 52px; padding: 0 24px;
  border: 0; border-radius: 14px; background: var(--tx); font-size: 15px; font-weight: 600; color: var(--inv); cursor: pointer; transition: filter 180ms;
}
.check:hover { filter: brightness(1.15); }
.result { display: flex; flex-direction: column; gap: 22px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; animation: fbUpIn 400ms var(--enter) both; }
.result-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.result-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.result-title { font-size: 16.5px; font-weight: 600; text-wrap: pretty; overflow-wrap: anywhere; }
.result-meta { font-size: 14px; color: var(--tx3); }
.status-pill { display: inline-flex; align-items: center; height: 30px; padding: 0 13px; border-radius: 999px; background: var(--tx); font-size: 14px; font-weight: 600; color: var(--inv); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 14px; padding-bottom: 20px; }
.step:last-child { padding-bottom: 0; }
.step-line { position: absolute; left: 11px; top: 26px; bottom: 2px; width: 1px; background: var(--line); }
.step-line.done { background: var(--tx); }
.step-dot { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 999px; background: transparent; border: 1px solid var(--line2); color: var(--tx3); }
.step.done .step-dot { background: var(--tx); border-color: var(--tx); color: var(--inv); }
.step-text { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.step-label { font-size: 15px; font-weight: 600; color: var(--tx3); }
.step.done .step-label { color: var(--tx); }
.step-desc { font-size: 14px; line-height: 1.55; color: var(--tx2); }
.reply { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; background: var(--card); }
.reply-label { font-size: 14px; font-weight: 600; color: var(--tx2); }
.reply-body { font-size: 15px; line-height: 1.6; color: var(--tx); white-space: pre-wrap; overflow-wrap: anywhere; }
.none { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px dashed var(--line2); border-radius: 18px; animation: fbUpIn 340ms var(--enter) both; }
.none-title { font-size: 15.5px; font-weight: 600; }
.none-body { font-size: 14.5px; line-height: 1.6; color: var(--tx2); }
.recent { display: flex; flex-direction: column; }
.recent-h { padding-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--tx2); }
.recent-row {
  appearance: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 14px 4px;
  border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--tx); text-align: left; cursor: pointer; transition: background 160ms;
}
.recent-row:hover { background: var(--card); }
.recent-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { font-size: 14px; color: var(--tx3); }
.recent-status { font-size: 14px; font-weight: 600; color: var(--tx2); white-space: nowrap; }

/* Overlays */
.dragging {
  position: fixed; inset: 12px; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed var(--tx); border-radius: 24px; background: color-mix(in srgb, var(--pg) 84%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none; animation: fbFade 160ms ease both;
  font-size: 18px; font-weight: 600;
}
.preview {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fbFade 180ms ease both; cursor: zoom-out;
}
.preview img { max-width: min(100%, 1100px); max-height: 84svh; border-radius: 12px; object-fit: contain; animation: fbPop 280ms var(--enter) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
