:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #e3e6ea;
  --text: #1d2330;
  --muted: #667085;
  --accent: #1e3a8a;
  --accent-hover: #172e6e;
  --accent-soft: #e7ecf7;
  --danger: #c92a2a;
  --ok: #2f9e44;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 10%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 18%);
  --radius: 4px; /* cards, dialogs, panels */
  --radius-sm: 2px; /* buttons, inputs, tags */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --surface-2: #232830;
    --border: #2e343d;
    --text: #e8eaed;
    --muted: #98a2b3;
    --accent: #5b7fd1;
    --accent-hover: #7393de;
    --accent-soft: #1b2440;
    --danger: #ff6b6b;
    --ok: #51cf66;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- buttons & inputs */
button, .btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.danger { color: var(--danger); }
button.icon { padding: 6px; }
input, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-width: 0;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
svg.i { width: 16px; height: 16px; flex: none; }

/* ---------- top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; display: block; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); }

/* ---------- avatars */
.avatar {
  --c: var(--accent);
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--c); color: #fff; font-size: 12px; font-weight: 700;
  border: 2px solid var(--surface);
  overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

/* ---------- landing */
.landing { max-width: 960px; margin: 0 auto; padding: 72px 20px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.landing h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; }
.landing p { color: var(--muted); font-size: 16px; margin: 0 0 24px; }
.landing ul { padding: 0; margin: 0 0 28px; list-style: none; display: grid; gap: 10px; }
.landing li { display: flex; gap: 10px; align-items: flex-start; }
.landing li svg { color: var(--accent); margin-top: 2px; }
.google-btn { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; padding: 10px 16px; gap: 10px; }
.google-btn:hover { background: #f8f9fa; }
.hero-art { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px; }
.hero-art svg { width: 100%; height: auto; display: block; }
.dev-login { margin-top: 18px; display: flex; gap: 8px; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); margin-bottom: 18px; }

/* ---------- dashboard */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.search { width: 240px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card .thumb { border-radius: var(--radius) var(--radius) 0 0; height: 92px; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); display: grid; place-items: center; color: var(--accent); cursor: pointer; }
.card .thumb svg { width: 150px; height: 40px; }
.card .body { padding: 12px 14px 8px; flex: 1; cursor: pointer; }
.card h3 { margin: 0 0 4px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card .foot { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; border-top: 1px solid var(--border); }
.badge { font-size: 11.5px; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.live { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); border-color: transparent; }
.empty { text-align: center; padding: 64px 20px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h3 { color: var(--text); margin: 0 0 6px; }

/* ---------- menus & dialogs */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 6px; display: grid;
}
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu button { border: 0; background: transparent; justify-content: flex-start; width: 100%; padding: 8px 10px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu small { color: var(--muted); display: block; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgb(10 14 20 / 45%); }
dialog header { padding: 16px 20px 0; font-weight: 700; font-size: 16px; display: flex; align-items: center; }
dialog .content { padding: 14px 20px; display: grid; gap: 12px; max-height: 65vh; overflow: auto; }
dialog footer { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.list { display: grid; gap: 2px; }
.list .item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.list .item:hover { background: var(--surface-2); }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .sub { color: var(--muted); font-size: 12.5px; }
.error { color: var(--danger); min-height: 1em; }
.hint { color: var(--muted); font-size: 12.5px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 100;
}

@media (max-width: 760px) {
  .landing { grid-template-columns: 1fr; padding-top: 40px; }
  .landing h1 { font-size: 32px; }
  .search { width: 100%; order: 3; }
  .topbar { padding: 0 12px; }
  .me .name { display: none; }
}

dialog.wide { width: min(680px, calc(100vw - 32px)); }
.history { display: grid; gap: 4px; }
.edit { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.edit:last-child { border-bottom: 0; }
.edit .grow { flex: 1; min-width: 0; display: grid; gap: 6px; }
.edit .sub, .history .sub { color: var(--muted); font-size: 12.5px; }
.edit ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 13px; }
.edit .row { gap: 6px; flex-wrap: wrap; }
.edit .row button { padding: 5px 10px; font-size: 13px; }
.edit.undone ul { color: var(--muted); text-decoration: line-through; }
.edit .undone-note { color: var(--muted); font-size: 12.5px; }
.edit .undone-note .badge { color: var(--text); }
button.link { padding: 0; color: var(--accent); justify-self: start; font-size: 13px; }
