/* Flock design system tokens — mirrored from flock-app/frontend/src/app/globals.css.
   Keep in sync: type 32/24/18/14/13/11, radius 4/8/12, control heights 32/36/40,
   accent coral, warm light surfaces / neutral dark planes over a faint grid. */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --surface-0: #f3ede5; --surface-1: #faf8f5; --surface-2: #ebe4da; --surface-3: #e3dacf;
  --text-primary: #1a1c1d; --text-secondary: #464652; --text-muted: #5e5d6a; --text-ghost: #777683;
  --accent: #b83c20; --accent-strong: #f06040; --accent-hover: #d04828; --accent-active: #b83c20;
  --accent-muted: rgba(240, 96, 64, 0.08); --accent-border: rgba(240, 96, 64, 0.18);
  --success: #047857; --success-muted: rgba(4, 120, 87, 0.07); --success-border: rgba(4, 120, 87, 0.14);
  --warning: #b45309; --warning-muted: rgba(180, 83, 9, 0.07); --warning-border: rgba(180, 83, 9, 0.14);
  --error: #dc2626; --error-muted: rgba(220, 38, 38, 0.06); --error-border: rgba(220, 38, 38, 0.12);
  --border-subtle: rgba(26, 28, 29, 0.08); --border-default: #d7d3ce; --border-strong: #8a8698;
  --grid-line: rgba(26, 28, 29, 0.05);
  --shadow-md: 0 4px 12px rgba(26, 28, 29, 0.08); --shadow-lg: 0 8px 24px rgba(26, 28, 29, 0.12);

  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-full: 9999px;
  --control-h-sm: 32px; --control-h-md: 36px; --control-h-lg: 40px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-0: #0a0a09; --surface-1: #111110; --surface-2: #1a1a19; --surface-3: #222221;
    --text-primary: #ffffff; --text-secondary: #d1d5db; --text-muted: #9ca3af; --text-ghost: #6b7280;
    --accent: #f06040; --accent-strong: #f06040; --accent-hover: #d85438; --accent-active: #c04830;
    --accent-muted: rgba(240, 96, 64, 0.12); --accent-border: rgba(240, 96, 64, 0.25);
    --success: #34d399; --success-muted: rgba(52, 211, 153, 0.10); --success-border: rgba(52, 211, 153, 0.18);
    --warning: #f0b429; --warning-muted: rgba(240, 180, 41, 0.10); --warning-border: rgba(240, 180, 41, 0.18);
    --error: #f06565; --error-muted: rgba(240, 101, 101, 0.10); --error-border: rgba(240, 101, 101, 0.18);
    --border-subtle: rgba(255, 255, 255, 0.06); --border-default: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.20);
    --grid-line: rgba(255, 255, 255, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5); --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 14px/20px var(--font-sans);
  color: var(--text-primary);
  background-color: var(--surface-0);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}

/* Type scale */
.display-lg { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.headline-md { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.title-sm { font-size: 18px; line-height: 24px; font-weight: 600; margin: 0; }
.body-sm { font-size: 13px; line-height: 18px; }
.caption { font-size: 11px; line-height: 15px; }
.label-caps { font-size: 11px; line-height: 16px; letter-spacing: 0.05em; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: 12px; line-height: 16px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

/* Top bar */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-1) 85%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand-mark { width: 24px; height: 24px; border-radius: var(--radius-sm); background: var(--accent-strong); display: grid; place-items: center; color: #fff; font-size: 13px; }
.brand .tag { color: var(--text-muted); font-weight: 400; }
.account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account .email { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

main { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }

/* Buttons — mirror components/Button.tsx */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h-md); padding: 0 16px; border-radius: var(--radius-md);
  font: 500 14px/20px var(--font-sans); border: 0; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.btn-lg { height: var(--control-h-lg); padding: 0 20px; }
.btn-sm { height: var(--control-h-sm); padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-0.5px); }
.btn-primary:active:not(:disabled) { background: var(--accent-active); }
.btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-default); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.btn-danger { background: transparent; color: var(--error); }
.btn-danger:hover:not(:disabled) { background: var(--error-muted); }
.btn-danger-solid { background: var(--error); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
@media (pointer: coarse) { .btn { min-height: 44px; } }

/* Cards */
.card { background: var(--surface-1); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.hero { padding: 32px; text-align: left; box-shadow: var(--shadow-md); }
.hero .lede { color: var(--text-secondary); margin: 8px 0 24px; }
.points { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.points li { display: flex; gap: 8px; color: var(--text-secondary); }
.points li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-strong); margin-top: 7px; flex: none; }
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 24px;
  border-radius: var(--radius-md); background: var(--accent-muted); border: 1px solid var(--accent-border); color: var(--text-secondary);
}

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* Instance list */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.instance { padding: 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.instance .meta { flex: 1; min-width: 200px; display: grid; gap: 4px; }
.instance .name { font-weight: 600; }
.instance .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.instance .actions { display: flex; gap: 8px; }
.instance .err { color: var(--error); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-full); font-size: 11px; line-height: 15px; font-weight: 500;
  border: 1px solid var(--border-default); color: var(--text-secondary); background: var(--surface-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--success); background: var(--success-muted); border-color: var(--success-border); }
.chip.busy { color: var(--warning); background: var(--warning-muted); border-color: var(--warning-border); }
.chip.busy::before { animation: pulse 1.2s ease-in-out infinite; }
.chip.bad { color: var(--error); background: var(--error-muted); border-color: var(--error-border); }
@keyframes pulse { 50% { opacity: .3; } }

.empty { padding: 32px; text-align: center; color: var(--text-muted); border-style: dashed; }
.skeleton { height: 74px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--surface-1), var(--surface-2), var(--surface-1)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Create form */
.create { margin-top: 24px; padding: 16px; display: grid; gap: 12px; }
.create .row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="text"] {
  flex: 1; min-width: 0; height: var(--control-h-md); padding: 0 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border-default); background: var(--surface-0); color: var(--text-primary); font: inherit;
}
input[type="text"]:hover { border-color: var(--border-strong); }

/* Dialog */
dialog { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--surface-1); color: var(--text-primary); padding: 24px; max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface-1); border: 1px solid var(--error-border);
  color: var(--error); box-shadow: var(--shadow-lg); font-size: 13px;
}

@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
@media (max-width: 480px) {
  .hero { padding: 24px; }
  .display-lg { font-size: 24px; line-height: 32px; }
  .instance .actions { width: 100%; }
  .instance .actions .btn { flex: 1; }
}

/* Phase 1–2 screens */
.next { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 4px; color: var(--text-secondary); }
.narrow { max-width: 560px; margin: 0 auto; }
.hero > * + * { margin-top: 16px; }
.hero .lede { margin: 8px 0 0; }
.hero.stack > * + * { margin-top: 24px; }
.page-title { margin-bottom: 24px; }
.google-btn { min-height: 44px; }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-0); border: 1px solid var(--border-subtle); }
.facts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.facts li { display: grid; gap: 2px; }

#v-home { display: grid; gap: 12px; }
#v-home .page-title { margin-bottom: 12px; }
.flock { padding: 20px; display: grid; gap: 14px; }
.flock-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flock-head .title-sm { margin-right: 4px; }
.chip.plan { color: var(--accent); background: var(--accent-muted); border-color: var(--accent-border); }
.chip.plan::before { display: none; }
.flock-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flock-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-card { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dl { display: inline-flex; align-items: center; gap: 12px; }
.dl-intel { color: var(--text-muted); }

.address { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-md); }
.addr, .mono-lg { font-family: var(--font-mono); font-size: 16px; line-height: 24px; overflow-wrap: anywhere; }
.address-actions { display: inline-flex; gap: 8px; align-items: center; }
.btn.link { color: var(--accent); }
.address-edit { display: grid; gap: 8px; width: 100%; }
.addr-field { display: flex; align-items: center; gap: 6px; }
.addr-field input { font-family: var(--font-mono); font-size: 16px; max-width: 260px; }
.field-error { color: var(--error); margin: 0; }
.address-edit p { margin: 0; }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option { padding: 24px; display: grid; gap: 8px; align-content: start; }
.option p { margin: 0 0 8px; }
.option .btn { justify-self: start; }

.steps { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 4px; }
.steps li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-subtle); color: var(--text-muted); }
.steps li:first-child { border-top: 0; }
.steps .st { flex: 1; display: grid; gap: 2px; }
.steps .t { color: var(--text-muted); }
.steps .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-default); flex: none; margin-top: 2px; }
.steps li.done, .steps li.now { color: var(--text-primary); }
.steps li.done .dot { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 3px var(--surface-1); }
.steps li.now .dot { border-color: var(--border-default); border-top-color: var(--accent-strong); animation: spin .9s linear infinite; }
.steps li.bad { color: var(--error); }
.steps li.bad .dot { border-color: var(--error); }
@keyframes spin { to { transform: rotate(360deg); } }
.reserved { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-md); }
.actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions-row .mono { margin-left: auto; }
dialog input[type="text"] { width: 100%; margin-top: 8px; }

@media (max-width: 560px) {
  .choices, .two, .facts { grid-template-columns: 1fr; }
  .addr-field input { max-width: none; }
}
.flock p { margin: 0; }
a.btn { text-decoration: none; }
