/* Vitrine studio — white, slate text, one blue accent. Inter or system-ui only. */
:root {
  --bg: #ffffff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --soft: #f8fafc;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --warn: #9a3412;
  --warn-bg: #fff7ed;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { color: var(--ink); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
h2 { font-size: 0.95rem; font-weight: 600; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 4px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Shell */
.shell { width: min(1120px, 100%); margin: 0 auto; padding: 0 24px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }
.wordmark:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.nav-link { color: var(--muted); font-size: 0.9rem; padding: 8px 10px; border-radius: 8px; }
.nav-link:hover { color: var(--ink); text-decoration: none; background: var(--soft); }
.foot { margin-top: auto; padding: 32px 0 24px; color: var(--muted); font-size: 0.8rem; }

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 12px 18px; font-weight: 500; font-size: 0.95rem;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled { background: var(--line-strong); color: #fff; cursor: default; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--muted); text-decoration: none; }
.btn-secondary:disabled { color: var(--muted); cursor: wait; }
.btn-sm { padding: 8px 14px; font-size: 0.9rem; margin-inline-start: 6px; }
.text-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 0.85rem; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 0.85rem; font-weight: 500; color: var(--ink); }
.opt { font-weight: 400; color: var(--muted); }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: #fff; color: var(--ink); font-size: 0.95rem;
}
.field input::placeholder { color: #94a3b8; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.fine { margin: 0; font-size: 0.85rem; color: var(--muted); text-align: center; }

.status { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 0.88rem; }
.status.warn { background: var(--warn-bg); color: var(--warn); }

/* Home */
.home { width: min(560px, 100%); margin: 0 auto; padding: 72px 0 24px; }
.home-head { text-align: center; margin-bottom: 32px; }
.lead { margin: 12px auto 0; max-width: 30rem; color: var(--muted); font-size: 1rem; }
.start-card { display: flex; flex-direction: column; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }

.drop {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 208px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--soft);
  cursor: pointer; text-align: center; padding: 20px; transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.drop-icon { color: var(--muted); margin-bottom: 4px; }
.drop-title { color: var(--ink); font-weight: 500; }
.drop-sub { color: var(--muted); font-size: 0.85rem; }
.link { color: var(--accent); }
.drop-filled { display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; z-index: 1; }
.drop-filled img { max-height: 180px; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.drop-meta { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; color: var(--muted); }
.drop.has-file input[type=file] { pointer-events: none; }

.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.recent { margin-top: 48px; }
.recent h2 { margin-bottom: 8px; }
.recent-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.recent-list li + li { border-top: 1px solid var(--line); }
.recent-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; color: var(--ink); font-size: 0.92rem; }
.recent-row:hover { background: var(--soft); text-decoration: none; }
.recent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { color: var(--muted); font-size: 0.8rem; }
.pill { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.pill-live { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Editor */
.shell-wide { width: min(1240px, 100%); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; padding: 32px 0; align-items: start; }
.frame-wrap { display: flex; justify-content: center; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; padding: 32px 16px; }
.frame { width: min(400px, 100%); border: 1px solid var(--line-strong); border-radius: 14px; background: #fff; overflow: hidden; }
.frame-bar { height: 36px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); background: #fff; }
.frame-url { font-size: 0.75rem; color: var(--muted); }
.frame-scroll { max-height: calc(100vh - 220px); overflow-y: auto; }
.preview-section { margin: 0; padding: 0; border: 0; position: relative; line-height: 0; }
.preview-section img { width: 100%; display: block; margin: 0; border: 0; }
.preview-empty { padding: 48px 16px; text-align: center; color: var(--muted); margin: 0; }

.panel { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 24px; }
.panel-head h1 { font-size: 1.4rem; overflow-wrap: anywhere; }
.panel-head .muted { margin: 6px 0 0; font-size: 0.88rem; }
.link-box { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem; overflow-wrap: anywhere; }
.edit-form { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 0.82rem; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; }
.activity li { padding-inline-start: 12px; border-inline-start: 2px solid var(--line); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.activity li.you { color: var(--muted); }
.activity li.pending { color: var(--muted); font-style: italic; }
.activity li.err { border-color: var(--warn); color: var(--warn); }

/* Leads + message */
.leads { padding: 32px 0; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 0.9rem; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 0.75rem; font-weight: 500; color: var(--muted); background: var(--soft); }
.message { width: min(480px, 100%); margin: 0 auto; padding: 96px 0; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; gap: 24px; padding: 20px 0; }
  .panel { position: static; order: -1; }
  .frame-wrap { padding: 16px 8px; }
  .frame-scroll { max-height: 70vh; }
}
@media (max-width: 560px) {
  .shell { padding: 0 16px; }
  .home { padding-top: 40px; }
  h1 { font-size: 1.5rem; }
  .start-card { padding: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .recent-row { grid-template-columns: 1fr auto; }
  .recent-date { display: none; }
  .nav-link { padding: 8px 6px; }
}

/* Settings */
.settings { width: min(560px, 100%); margin: 0 auto; padding: 48px 0 24px; }
.settings-head { margin-bottom: 28px; }
.settings-head .lead { margin: 12px 0 0; color: var(--muted); font-size: 1rem; max-width: 34rem; }
.settings-card { display: flex; flex-direction: column; gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.settings-group { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 14px; }
.settings-group + .settings-group { padding-top: 18px; border-top: 1px solid var(--line); }
.settings-group legend { padding: 0; margin: 0 0 2px; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.field-hint { font-size: 0.8rem; color: var(--muted); }
.field-check { flex-direction: row; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text); }
.field-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.settings-actions { padding-top: 4px; }
.status.ok { background: var(--accent-soft); color: var(--accent); }
.nav-link.is-active { color: var(--ink); background: var(--soft); }
.field textarea {
  width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: #fff; color: var(--ink); font-size: 0.95rem; resize: vertical;
}

/* App layout with left sidebar */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.app-wide { grid-template-columns: 220px 1fr; }
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 28px;
  max-width: 1120px;
  width: 100%;
}
.app-wide .app-main { max-width: none; padding: 0 20px 0 0; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .wordmark { display: block; padding: 6px 10px 18px; font-size: 1.1rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 10px;
}
.side-link:hover { color: var(--ink); text-decoration: none; background: var(--soft); }
.side-link.is-active { color: var(--ink); background: var(--accent-soft); font-weight: 500; }
.side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-actions .btn-sm { margin: 0; width: 100%; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.side-profile { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.side-avatar { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: var(--soft); border: 1px solid var(--line); flex-shrink: 0; }
.side-avatar-fallback { display: inline-block; background: var(--accent-soft); }
.side-profile-text { min-width: 0; display: flex; flex-direction: column; }
.side-profile-name { font-size: 0.85rem; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-profile-meta { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.side-version { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; flex-shrink: 0; }
.side-logout { margin: 0; flex: 1; }
.side-logout-btn {
  width: 100%; text-align: right; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 0.85rem; padding: 8px 12px; border-radius: 8px;
}
.side-logout-btn:hover { background: var(--soft); color: var(--ink); }

/* Auth (Landify-like centered card) */
body.bare { background: var(--soft); }
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.auth-card .wordmark { font-size: 1.15rem; }
.auth-card h1 { font-size: 1.45rem; }
.auth-card .lead { margin: 0; color: var(--muted); font-size: 0.95rem; }
.auth-card .btn-primary { width: 100%; }
.auth-switch { margin: 8px 0 0; text-align: center; font-size: 0.85rem; }
.auth-auth0 { text-align: center; }

@media (max-width: 800px) {
  .app, .app-wide { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 14px;
  }
  .sidebar .wordmark { padding: 6px 10px 6px 0; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 0; border-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .side-actions { border-top: 0; margin-top: 0; padding-top: 0; flex-direction: row; align-items: center; }
  .side-profile-meta { display: none; }
  .app-main { padding: 0 16px; }
  .app-wide .app-main { padding: 0 12px; }
}
