@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #ffffff;
  --sidebar: #fafafa;
  --ink: #111111;
  --text: #333333;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --pill: #ededed;
  --hover: #fafafa;
  --green-bg: #e7f6ee;
  --green: #137333;
  --danger-bg: #fdecec;
  --danger: #9b2c2c;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: var(--ink); }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 14px; margin: 0 0 8px; }
p { line-height: 1.5; margin: 0.4rem 0; }

.shell { min-height: 100vh; background: white; }
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 230px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  z-index: 2;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  margin: 0 6px 16px;
}
.mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #111;
  color: white;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.nav-primary, .nav-secondary nav { display: flex; flex-direction: column; gap: 2px; }
.rail a.nav, .rail button.quiet {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: #333;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 10px;
  min-height: 0;
  cursor: pointer;
}
.rail a.nav:hover, .rail button.quiet:hover { background: #f3f3f3; }
.rail a.nav.active { background: #ededed; color: #111; }
.rail .ico { width: 16px; text-align: center; font-size: 13px; color: #444; }
.rail em {
  margin-left: auto;
  font-style: normal;
  background: #ededed;
  color: #333;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 11px;
}
.nav-secondary { margin-top: auto; padding-top: 12px; }
.nav-secondary form { margin: 0; }
.rail button.quiet { justify-content: flex-start; margin: 0; }
.workspace { margin-left: 230px; min-height: 100vh; background: white; display: flex; flex-direction: column; }
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.top-title { font-size: 13px; color: var(--muted); font-weight: 500; }
.top-meta { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #111;
  background: white;
}
.icon-btn svg { width: 16px; height: 16px; display: block; }
.name-cell { display: flex; align-items: center; gap: 8px; }
.maps-link {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  color: #111;
  text-decoration: none;
  background: white;
}
.maps-link:hover { background: #fafafa; }
.gmb-thumb {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
  background: #fafafa;
}
#gmb-capture { margin-top: 8px; }
#gmb-capture .spinner { display: none; width: 12px; height: 12px; margin-right: 6px; border: 2px solid #d0d0d0; border-top-color: #111; border-radius: 50%; animation: gmb-spin 0.8s linear infinite; }
#gmb-capture.is-busy .spinner { display: inline-block; vertical-align: -2px; }
@keyframes gmb-spin { to { transform: rotate(360deg); } }
.icon-btn:hover { background: #fafafa; border-color: var(--line); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111;
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}
main { padding: 28px 32px 48px; }
.page-narrow { max-width: 720px; margin: 0 auto; }

.page-head, .row-form, .stats { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head { align-items: flex-start; margin-bottom: 18px; }
.page-head p, .lede, .hint, .switch-line, .kicker { color: var(--muted); }
.page-head p { margin: 0; max-width: 46rem; font-size: 13px; }
.kicker { letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; margin: 0 0 4px; }
.hint, .switch-line { font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: stretch; margin: 8px 0 16px; }
.stats a, .stats div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.stats strong { display: block; font-size: 18px; font-weight: 600; color: var(--ink); }
.stats span { color: var(--muted); font-size: 12px; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13px;
}
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #efefef; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  background: #fafafa;
}
tbody tr:hover td { background: #fafafa; }
.tier, .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f3f3;
  color: #444;
}
.tier-A, .badge-good { background: var(--green-bg); color: var(--green); }
.tier-A::before, .badge-good::before { content: "✓"; font-size: 10px; }
.tier-B { background: #f6f1e4; color: #6b5420; }
.tier-skip, .badge-muted { background: #f3f3f3; color: #666; }

.panel, .card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  margin: 12px 0;
}
.notice { background: var(--green-bg); color: #135c30; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.error { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea, button, .button {
  font: inherit;
  color: var(--ink);
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: white;
  min-height: 32px;
  font-size: 13px;
}
textarea { min-height: 72px; resize: vertical; }
button, .button {
  background: #111;
  color: white;
  border-color: #111;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 550;
  padding: 0 12px;
  height: 32px;
  min-height: 32px;
}
button.secondary, a.secondary {
  background: white;
  color: #111;
  border: 1px solid #e5e5e5;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.quiet { background: transparent; color: #333; border: 0; height: auto; font-weight: 500; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; align-items: end; }
.filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filter-actions label { flex-direction: row; align-items: center; color: #333; }
.filter-actions select { min-width: 140px; }
.check { flex-direction: row; align-items: center; gap: 6px; color: #333; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.pair, .colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.colors { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; align-items: start; }
.edit-split, .studio { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.edit-split iframe, .studio iframe, .preview-frame {
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.editor-col {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: white;
  width: 360px;
  max-width: 100%;
  box-sizing: border-box;
}
.editor-col input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.editor-col select,
.editor-col textarea,
.stack > input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.stack > select,
.stack > textarea { width: 100%; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rows { list-style: none; padding: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.rows li:last-child { border-bottom: 0; }
.rows .row-label { color: #111; font-weight: 500; }
.rows .row-value { margin-left: auto; color: var(--muted); font-size: 12px; }
.rows .chev { color: #b0b0b0; }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.board section { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.board h2 span { color: var(--muted); font-weight: 500; font-size: 12px; }
pre { white-space: pre-wrap; font-family: inherit; font-size: 12px; color: #333; }
.score-block { font-size: 20px; font-weight: 600; margin: 0; color: var(--ink); }
.gate { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; background: #fafafa; }
.card.wide { width: min(640px, 100%); }
.gate .card { width: min(420px, 100%); }
.stamp { letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--muted); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  background: white;
  color: #111;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  height: 30px;
  padding: 0 12px;
  font-weight: 500;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  background: white;
}
.composer textarea {
  border: 0;
  min-height: 32px;
  padding: 6px 0;
  resize: none;
  width: 100%;
  outline: none;
}
.send-round {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  padding: 0;
}
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0; padding: 10px 12px; }
fieldset legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.segment {
  display: flex;
  gap: 2px;
  background: #e4e4e4;
  border: 0;
  border-radius: 8px;
  padding: 2px;
  margin: 0;
}
.segment legend { padding: 0; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.segment label {
  flex: 1;
  position: relative;
  text-align: center;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
}
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label:has(input:checked) { background: white; color: #111; font-weight: 650; box-shadow: 0 0 0 1px #111; }
.pager { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; font-size: 13px; }
.pager a { font-weight: 600; }
.pager-end { color: #b0b0b0; padding: 0 12px; }

.studio-page { background: white; min-height: 100vh; }
.studio-page .topbar { position: sticky; }
.studio-page .studio { height: calc(100vh - 52px); padding: 16px; }
.studio-page .studio iframe { height: 100%; min-height: 0; }
.studio-page .editor-col { height: 100%; overflow: auto; }

@media (max-width: 860px) {
  .rail {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin: 0 8px 0 0; flex: none; }
  .nav-primary, .nav-secondary, .nav-secondary nav { flex-direction: row; flex-wrap: nowrap; margin: 0; padding: 0; }
  .rail a.nav, .rail button.quiet { width: auto; white-space: nowrap; }
  .workspace { margin-left: 0; }
  .split, .edit-split, .studio, .colors { grid-template-columns: 1fr; }
  .editor-col { width: auto; }
  .studio-page .studio { height: auto; }
  .studio-page .studio iframe { min-height: 480px; }
  .stats { display: grid; grid-template-columns: repeat(2, 1fr); }
  main { overflow-x: auto; padding: 16px; }
  table { min-width: 640px; }
}
