:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2027;
  --text-muted: #5b6673;
  --border: #d8dee4;
  --accent: #0d7d6f;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-text: #ffffff;
  --banner-error-bg: #fdecea;
  --banner-error-text: #611a15;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --surface: #1c2229;
    --text: #e6ebf0;
    --text-muted: #9aa7b4;
    --border: #313a44;
    --accent: #4fd1c0;
    --accent-text: #0b1210;
    --danger: #ff6b60;
    --danger-text: #2a0b09;
    --banner-error-bg: #3a1815;
    --banner-error-text: #ffb4ab;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.1rem;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.user-info a {
  color: var(--accent);
  text-decoration: none;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

section h2 {
  margin-top: 0;
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  color: var(--text-muted);
  font-weight: 600;
}

button, .btn {
  font: inherit;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

button:hover, .btn:hover {
  filter: brightness(1.08);
}

button.danger, .btn.danger {
  background: var(--danger);
  color: var(--danger-text);
}

.delete-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

input[type="text"] {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  margin-right: 0.5rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.banner.error {
  background: var(--banner-error-bg);
  color: var(--banner-error-text);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  max-width: 360px;
}

.login-card h1 {
  margin-top: 0;
}

.google-signin-btn {
  display: inline-block;
  margin-top: 1rem;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* An author `display` declaration on an element overrides the browser's
   default [hidden]{display:none} rule (a well-known CSS gotcha - the
   `hidden` attribute alone is not enough once you set `display` on the
   same element via a class). Without this, the modal is visible from
   page load, showing its static markup with none of the JS-populated
   content, since the script that fills it in only runs on demand. */
.modal[hidden] {
  display: none;
}

.modal-content {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-content .btn,
.modal-content button {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
}
