:root {
  --accent: #00716e;
  --accent-deco: #009f9c;
  --accent-soft: #e3f3f2;
  --bg: #f6f8f8;
  --card: #ffffff;
  --text: #1c2423;
  --muted: #56615f;
  --line: #d6dedd;
  --danger: #a4262c;
  --danger-soft: #fbeaea;
  --warn-soft: #fff4d6;
  --warn-text: #6b4d00;
  --ok-soft: #e3f3f2;
  --radius: 10px;
  --focus: 0 0 0 3px #ffffff, 0 0 0 5px var(--accent);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border-bottom: 3px solid var(--accent-deco); padding: 8px 16px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--text);
}
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }
main:focus, h1:focus { box-shadow: none; outline: none; }
h1 { font-size: 1.6rem; margin: 8px 0 16px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 16px 0 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
label, .label { font-weight: 600; font-size: 0.95rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid #9aa7a5; border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--accent); margin: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.9rem; }

button, .btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
button:hover { filter: brightness(1.08); }
button:disabled { background: #b8c2c0; border-color: #b8c2c0; color: #fff; cursor: not-allowed; filter: none; }
.btn-secondary { background: #fff; color: var(--accent); }
.btn-link { background: none; border: none; color: var(--accent); padding: 0 8px; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* Messages */
.error { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.success { background: var(--ok-soft); color: var(--accent); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.warn { background: var(--warn-soft); color: var(--warn-text); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 12px 0; }
.loading { color: var(--muted); padding: 12px 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge.no { background: #eceff0; color: var(--muted); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

/* Login */
.login { max-width: 380px; margin: 10vh auto 0; }
.login .brand { color: var(--accent); font-weight: 700; margin-bottom: 4px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -10px 0; }
.done-title { text-decoration: line-through; color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }

/* Table -> cards on mobile */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.9rem; color: var(--muted); }
.table a { font-weight: 600; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { border: none; padding: 4px 12px; display: flex; gap: 12px; }
  .table td::before { content: attr(data-label); flex: 0 0 110px; color: var(--muted); font-size: 0.9rem; }
  .table-wrap { border: none; }
  .table { background: transparent; }
  .table tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
}

/* Text thread */
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; background: #eceff0; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble .meta { display: block; font-size: 0.8rem; opacity: 0.85; margin-top: 2px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.preview { overflow-x: auto; }
.preview table { border-collapse: collapse; font-size: 0.9rem; }
.preview th, .preview td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { flex: 1 1 160px; }
.toolbar .search { flex: 2 1 240px; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.status { color: var(--muted); padding: 8px 0; }

/* Google sign-in */
.btn-google { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 1rem; border: 1.5px solid #c9d3d2; border-radius: 10px; background: #fff; color: #1c2423; font-weight: 600; text-decoration: none; }
.btn-google:hover { border-color: #00716e; color: #00716e; }
.login .or { text-align: center; color: #5b6867; font-size: .92rem; margin: .9rem 0 .2rem; }
