/* MyClaude web client — a Keep-style board.
   Visual language only: masonry cards, a collapsed composer, a left category
   drawer. No Google branding anywhere. */

:root {
  --bg: #fff;
  --surface: #fff;
  --line: #e0e0e0;
  --line-soft: #f1f3f4;
  --ink: #202124;
  --ink-2: #5f6368;
  --ink-3: #80868b;
  --hover: #f1f3f4;
  --accent: #1a73e8;
  --danger: #d93025;
  --shadow-1: 0 1px 2px rgba(60,64,67,.1), 0 1px 3px 1px rgba(60,64,67,.08);
  --shadow-2: 0 1px 3px rgba(60,64,67,.2), 0 4px 8px 3px rgba(60,64,67,.1);
  --radius: 8px;
  --topbar-h: 64px;
  --drawer-w: 260px;
  /* Card accent colours, keyed off the category id so a category keeps the
     same colour between sessions without storing one. */
  --c0: #fff; --c1: #fff8c4; --c2: #d7f3e3; --c3: #d3e8fd;
  --c4: #fdd9d7; --c5: #f6e2c9; --c6: #e8d9f5; --c7: #d9f0f3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124; --surface: #202124; --line: #5f6368; --line-soft: #3c4043;
    --ink: #e8eaed; --ink-2: #bdc1c6; --ink-3: #9aa0a6; --hover: #303134;
    --accent: #8ab4f8; --danger: #f28b82;
    --c0: #202124; --c1: #41331c; --c2: #1e3a2f; --c3: #1e3a5f;
    --c4: #5c2b29; --c5: #614a19; --c6: #42275e; --c7: #1b3b40;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-top: var(--topbar-h);
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ── top bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  z-index: 30;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: 0 0 44px;
  border: 0; background: none; color: var(--ink-2);
  border-radius: 50%; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--hover); border-radius: var(--radius);
  padding: 0 10px; height: 46px; color: var(--ink-3);
}
.search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--ink); font-size: 15px; height: 100%;
}
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 32px; height: 32px; flex: 0 0 32px; }

/* ── drawer ────────────────────────────────────────────────────────────── */
.drawer {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--drawer-w);
  background: var(--surface); z-index: 25; overflow-y: auto;
  padding: 8px 8px 24px; transform: translateX(-100%);
  transition: transform .18s ease;
}
.drawer.open { transform: none; }
.drawer-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin: 12px 16px 6px; font-weight: 600;
}
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list button {
  display: flex; align-items: center; gap: 14px; width: 100%;
  border: 0; background: none; cursor: pointer; text-align: left;
  color: var(--ink); font: inherit;
  padding: 11px 16px; border-radius: 0 25px 25px 0;
}
.cat-list button:hover { background: var(--hover); }
.cat-list button.active { background: #feefc3; color: #202124; font-weight: 500; }
@media (prefers-color-scheme: dark) { .cat-list button.active { background: #41331c; color: #e8eaed; } }
.cat-count { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 24; }

/* ── board ─────────────────────────────────────────────────────────────── */
.board { padding: 24px 16px 80px; max-width: 1200px; margin: 0 auto; }

.composer {
  max-width: 600px; margin: 0 auto 32px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.composer-collapsed {
  width: 100%; text-align: left; border: 0; background: none; cursor: text;
  color: var(--ink-3); font: 500 15px/1 inherit; padding: 16px;
}
.composer-form { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 4px; }
.c-title, .c-body, .s-title, .s-body {
  border: 0; background: none; outline: none; color: var(--ink);
  font-family: inherit; width: 100%; resize: none;
}
.c-title, .s-title { font-size: 16px; font-weight: 500; padding: 4px 0; }
.c-body, .s-body { font-size: 14px; padding: 4px 0; line-height: 1.6; }
.composer-actions, .sheet-actions { display: flex; align-items: center; gap: 4px; padding-top: 4px; }
.c-cat, .s-field {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 4px; padding: 6px 8px; font: inherit; font-size: 13px; max-width: 180px;
}
.text-btn {
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  font: 500 14px inherit; padding: 8px 16px; border-radius: 4px;
}
.text-btn:hover { background: var(--hover); }
.text-btn.primary { color: var(--accent); }

/* Masonry. CSS columns keep card heights natural, which is what makes a Keep
   board read correctly — a grid would stretch every card to its row. */
.grid { columns: 240px; column-gap: 16px; }
.card {
  break-inside: avoid; margin: 0 0 16px;
  background: var(--card, var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; cursor: default;
  transition: box-shadow .12s ease;
}
.card:hover { box-shadow: var(--shadow-2); }
/* Task cards carry a checkbox for the task as a whole, aligned with the
   title's first line rather than centred on the block. */
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.card-check {
  width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 18px;
  accent-color: var(--ink-2); cursor: pointer;
}
.card-head .card-title { margin: 0; flex: 1; min-width: 0; }
.card-title { font-size: 15px; font-weight: 500; margin: 0 0 6px; word-break: break-word; }
.card-body {
  font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap;
  word-break: break-word; margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 12; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  font-size: 11px; color: var(--ink-2); background: rgba(0,0,0,.05);
  border-radius: 10px; padding: 2px 9px; white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .chip { background: rgba(255,255,255,.08); } }
.chip.status-doing { background: #d3e8fd; color: #174ea6; }
.chip.status-done  { background: #d7f3e3; color: #0d652d; }
.chip.status-on-hold { background: #fdd9d7; color: #a50e0e; }
@media (prefers-color-scheme: dark) {
  .chip.status-doing { background: #1e3a5f; color: #8ab4f8; }
  .chip.status-done  { background: #1e3a2f; color: #81c995; }
  .chip.status-on-hold { background: #5c2b29; color: #f28b82; }
}
.card.is-done .card-title { text-decoration: line-through; color: var(--ink-3); }
.card.is-done { opacity: .62; }
.card.is-done .card-body { color: var(--ink-3); }

/* ── shopping (checkoff) card ──────────────────────────────────────────── */
.card-list { list-style: none; margin: 4px 0 0; padding: 0; }
.li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 5px 0; border-radius: 4px;
}
.li:hover { background: rgba(0,0,0,.03); }
@media (prefers-color-scheme: dark) { .li:hover { background: rgba(255,255,255,.04); } }
.li input[type=checkbox] {
  width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 18px;
  accent-color: var(--ink-2); cursor: pointer;
}
.li-text { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-word; }
.li-qty { color: var(--ink-3); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.li.done .li-text { text-decoration: line-through; color: var(--ink-3); }
.li-del {
  border: 0; background: none; color: var(--ink-3); cursor: pointer;
  padding: 0 4px; font-size: 16px; line-height: 1; opacity: 0; flex: 0 0 auto;
}
.li:hover .li-del { opacity: .7; }
.li-del:hover { opacity: 1; color: var(--danger); }
.list-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-3);
}
.list-divider button {
  margin-left: auto; border: 0; background: none; color: var(--ink-3);
  font: inherit; font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.list-divider button:hover { color: var(--danger); background: var(--hover); }
.add-row { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; }
.add-row span { color: var(--ink-3); font-size: 16px; width: 18px; text-align: center; }
.add-row input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--ink); font: inherit; font-size: 13.5px; padding: 4px 0;
}

/* ── editor sheet ──────────────────────────────────────────────────────── */
.sheet-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sheet {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-2); width: 100%; max-width: 600px;
  max-height: 90vh; display: flex; flex-direction: column; padding: 16px;
}
.s-body { flex: 1; min-height: 160px; }
.sheet-row { display: flex; gap: 8px; padding: 8px 0; flex-wrap: wrap; }

.empty { text-align: center; color: var(--ink-3); padding: 48px 16px; }
.empty p { margin: 12px 0 0; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 12px 20px; border-radius: 4px;
  font-size: 13.5px; box-shadow: var(--shadow-2); z-index: 60; max-width: 90vw;
}

/* ── auth ──────────────────────────────────────────────────────────────── */
.auth-body {
  padding: 0; min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--hover);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-1); padding: 40px 36px; width: 100%; max-width: 400px;
  margin: 16px;
}
.auth-mark { color: var(--accent); display: flex; justify-content: center; }
.auth-card h1 { font-size: 22px; font-weight: 400; margin: 12px 0 4px; text-align: center; }
.auth-sub { color: var(--ink-2); text-align: center; margin: 0 0 24px; font-size: 14px; }
.auth-card label { display: block; margin-bottom: 16px; }
.auth-card label span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.auth-card input {
  width: 100%; padding: 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--ink); outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-submit {
  width: 100%; padding: 12px; border: 0; border-radius: 4px;
  background: var(--accent); color: #fff; font: 500 15px inherit; cursor: pointer;
}
.auth-error {
  background: #fce8e6; color: #a50e0e; padding: 10px 12px;
  border-radius: 4px; font-size: 13px; margin: 0 0 16px;
}
@media (prefers-color-scheme: dark) { .auth-error { background: #5c2b29; color: #f28b82; } }
.auth-note { color: var(--ink-3); font-size: 12px; text-align: center; margin: 20px 0 0; }

/* ── wide screens: drawer becomes a permanent rail ─────────────────────── */
@media (min-width: 900px) {
  .drawer { transform: none; border-right: 1px solid var(--line-soft); }
  .scrim { display: none !important; }
  .board { margin-left: var(--drawer-w); max-width: none; }
  #menu-btn { display: none; }
}
