:root {
  --bg: #f2ece4;
  --paper: #fffdf8;
  --ink: #2a211b;
  --muted: #74685f;
  --accent: #1d7a69;
  --accent-soft: #d7efe9;
  --line: #ddd2c7;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, #f7e8d3 0, #f2ece4 30%, #e8dfd4 100%);
  min-height: 100vh;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 10%, rgba(29, 122, 105, 0.2), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(166, 80, 42, 0.15), transparent 40%);
}

.app-header {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

h1,h2,h3 { font-family: "Fraunces", serif; margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }

.app-header p { margin: 6px 0 0; color: var(--muted); }

.header-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.sync-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #f0ebe5;
  border: 1px solid var(--line);
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.hidden { display: none !important; }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}

.muted { color: var(--muted); font-size: 0.95rem; }

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.room-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, white);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(26, 19, 12, 0.08);
  padding: 16px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 112px;
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(26, 19, 12, 0.12);
}

.room-card .meta {
  margin-top: 8px;
  font-size: .9rem;
  color: var(--muted);
}

.bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: #efe7dc;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3ba087, #1d7a69);
}

.tasks-view {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 90%, white);
  box-shadow: 0 10px 30px rgba(26, 19, 12, 0.08);
  padding: 14px;
}

.tasks-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.task-list { display: grid; gap: 10px; }

.read-only-banner {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #c8b9a8;
  border-radius: 10px;
  background: #fff6ea;
  color: #6c4d2f;
  font-size: .9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffdfa;
}

.task-card.done {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: #f6fffc;
}

.task-row { display: flex; align-items: flex-start; gap: 10px; }

.task-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.task-title { font-weight: 600; }

.task-time {
  margin-top: 4px;
  font-size: .82rem;
  color: var(--muted);
}

.task-note {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 60px;
  padding: 8px;
  font: inherit;
  resize: vertical;
}

.task-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.submit-btn {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: #11473d;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
}

.chip-btn, .icon-btn {
  border: 1px solid var(--line);
  background: #fffaf2;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  min-height: 42px;
}

.chip-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.report-panel {
  position: fixed;
  right: 16px;
  top: 16px;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 20px 45px rgba(0,0,0,.2);
  padding: 12px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.report-summary { color: var(--muted); margin-bottom: 8px; }

.report-body {
  width: 100%;
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hist-title { margin: 12px 0 6px; font-size: 1rem; }

.session-history {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.session-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
  font-size: .88rem;
}

.footnote { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }

.pin-gate {
  position: fixed;
  inset: 0;
  background: rgba(18, 14, 10, 0.5);
  display: grid;
  place-items: center;
  z-index: 50;
}

.pin-card {
  width: min(360px, calc(100% - 24px));
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

#pinInput {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.pin-error {
  margin-top: 6px;
  color: #a6502a;
  font-size: .85rem;
}

@media (max-width: 720px) {
  .report-panel {
    right: 8px;
    left: 8px;
    width: auto;
    top: 8px;
    max-height: calc(100vh - 16px);
  }
}
