/* InstaTrack design system: shared by the popup, board, account page and the phone page. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --surface: #fff; --surface-2: #f0f2f5; --text: #14161a; --muted: #5f6774;
  --border: #e3e6eb; --border-strong: #cdd2da;
  --accent: #4f46e5; --accent-hover: #4338ca; --on-accent: #fff; --accent-soft: #eef0ff; --visited: #7c3aed;
  --good: #15803d; --good-soft: #e6f5eb; --bad: #c62828; --bad-soft: #fdecec; --warn: #b45309; --warn-soft: #fdf2e2;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .07);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013; --surface: #171a1f; --surface-2: #1f232a; --text: #e8eaed; --muted: #9aa3ae;
    --border: #2a2f37; --border-strong: #3a404a;
    --accent: #8b8df9; --accent-hover: #a3a5fb; --on-accent: #0e1013; --accent-soft: #23244a; --visited: #c4a7ff;
    --good: #4ade80; --good-soft: #132a1c; --bad: #f87171; --bad-soft: #331a1a; --warn: #fbbf24; --warn-soft: #33270f;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Layout */
.page { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.page-wide { max-width: 1440px; margin: 0 auto; padding: 20px 20px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #a855f7); }
.logo svg { width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.chip:hover { text-decoration: underline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 14px;
  font: 600 14px var(--font); border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { width: 100%; }
.btn-lg { min-height: 44px; font-size: 15px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { min-height: 28px; padding: 3px 8px; font-size: 12.5px; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn[aria-busy="true"]::before, .spinner { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 4px; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.notice:empty { display: none; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.good { background: var(--good-soft); color: var(--good); }
.empty { color: var(--muted); font-size: 13px; }
.empty-state { text-align: center; padding: 20px 8px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.stat .num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .label { font-size: 12px; line-height: 1.3; color: var(--muted); }
.delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }

/* Pills */
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--muted); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

/* Collapsible list sections */
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.section > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px;
  font-weight: 600; cursor: pointer; list-style: none; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: ""; width: 7px; height: 7px; margin: -4px 4px 0 0; border: solid var(--muted);
  border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.section[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.section > summary .title { display: inline-flex; align-items: center; gap: 8px; }
.section > .users { padding: 0 8px 6px; max-height: 240px; overflow-y: auto; }
.section > .empty { padding: 0 14px 12px; }

/* People */
.users { list-style: none; margin: 0; padding: 0; }
.users li + li { border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 6px; border-radius: 6px; color: var(--text); text-decoration: none; }
.user:visited { color: var(--visited); }
.user:hover .handle { text-decoration: underline; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--h, 240) 45% 50%); }
.handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
label { font-size: 13px; font-weight: 600; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
input { width: 100%; min-height: 40px; padding: 8px 12px; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); }

/* Progress */
.progress { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress::before { content: ""; display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent);
  animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Checklist */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 8px; }
.checks li::before { content: "✓"; color: var(--good); font-weight: 700; }

/* Kanban board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.col { --c: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px;
  transition: background .15s, border-color .15s; }
.col[data-col="important"] { --c: #d97706; }
.col[data-col="ok"] { --c: #16a34a; }
.col[data-col="considering"] { --c: #dc2626; }
.col[data-col="unfollowed"] { --c: #6b7280; }
.col.over { background: var(--accent-soft); border-color: var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 4px 10px; font-size: 13px; font-weight: 600; }
.col-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col-head .btn-ghost { margin-left: auto; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; overflow-x: hidden; max-height: calc(100vh - 210px); overflow-y: auto; }
.kcard { display: flex; align-items: center; gap: 4px; padding: 3px 5px 3px 3px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.kcard[draggable="true"] { cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard .user { flex: 1; }
.kcard select { flex: none; max-width: 100px; min-height: 28px; padding: 2px 4px; font-size: 12px; }
.drop-empty { padding: 16px 8px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); text-align: center; color: var(--muted); font-size: 12.5px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search { width: 260px; max-width: 100%; }

/* Extension popup */
body.popup { width: 360px; }
.popup .topbar { margin: 0; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.popup main { padding: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before { animation-duration: 0s !important; transition: none !important; } }
