:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c1e21;
  --muted: #5f6672;
  --border: #dcdfe4;
  --primary: #3b5bdb;
  --primary-text: #ffffff;
  --danger: #c92a2a;
  --ok: #2b8a3e;
  --notice-bg: #fff4e0;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1e2127;
    --text: #eceef1;
    --muted: #98a0ac;
    --border: #343942;
    --primary: #748ffc;
    --primary-text: #10131a;
    --danger: #ff8787;
    --ok: #69db7c;
    --notice-bg: #3a2f17;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { margin: 0 0 4px; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

.card {
  max-width: 440px;
  margin: 0 auto 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app { max-width: 640px; margin: 0 auto; }
.app .card { max-width: none; }

.banner {
  max-width: 640px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--notice-bg);
  border: 1px solid var(--border);
}

.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--notice-bg);
}

label { display: block; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }

input, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { color: var(--primary-text); background: var(--primary); border-color: var(--primary); }
.btn-google { width: 100%; }

.link {
  padding: 4px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 14px;
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

.msg { min-height: 1.5em; margin: 12px 0 0; font-size: 0.9rem; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-text { flex: 1; min-width: 160px; }
.profile-text p { margin: 0; }
.avatar-wrap { width: 56px; height: 56px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px !important; }
.chip {
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.records { list-style: none; margin: 0; padding: 0; }
.records li { padding: 14px 0; border-top: 1px solid var(--border); }
.records li:first-child { border-top: none; }
.rec-title { font-weight: 600; word-break: break-word; }
.rec-note { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.rec-meta { font-size: 0.8rem; color: var(--muted); }
.rec-actions { display: flex; gap: 12px; margin-top: 4px; }
.rec-actions .danger { color: var(--danger); }
