/* =============================================================
   THEME  -  warm paper / editorial, two-tone accents
   ============================================================= */
:root {
  --bg: #f6f1e7;
  --bg-2: #fbf8f1;
  --paper: #fffdf8;
  --ink: #24201a;
  --ink-soft: #6b6356;
  --line: #e7ddcb;
  --line-2: #efe7d6;
  --accent: #0f766e;
  --rose: #be123c;
  --gold: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40,30,15,.04), 0 8px 24px rgba(40,30,15,.06);
  --shadow-lg: 0 24px 60px rgba(40,30,15,.18);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Spline Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #fcefe1 0%, transparent 55%),
    radial-gradient(1000px 500px at -10% 110%, #e7f0ec 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
.display { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 560; letter-spacing: -.01em; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }
.dot { display: inline-block; border-radius: 50%; }

/* brand mark */
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: conic-gradient(from 200deg, var(--accent), var(--gold), var(--rose), var(--accent));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}

/* =============================================================
   BUTTONS / INPUTS
   ============================================================= */
.btn {
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 9px 15px; border-radius: 10px; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.04); box-shadow: none; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f1c9c9; }

.iconbtn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { box-shadow: var(--shadow); }

input, select, textarea {
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%;
}
input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin: 6px 0; cursor: pointer; }
.check input { width: auto; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* =============================================================
   BOOT / LOGIN
   ============================================================= */
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-soft); }
.login-wrap { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 24px; gap: 18px; }
.login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 38px 34px; width: min(420px, 92vw); }
.login-brand { display: grid; justify-items: center; gap: 6px; margin-bottom: 22px; text-align: center; }
.login-brand h1 { margin: 8px 0 0; font-size: 32px; }
.login-brand p { margin: 0; }
.login-note { text-align: center; margin-top: 14px; font-size: 13px; }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px; font-size: 15px; }
.g-mark { font-family: var(--font-display); font-weight: 700; color: var(--accent); }
.demo-people { display: grid; gap: 10px; margin-top: 8px; }
.demo-person { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-width: 1.5px; }
.demo-person strong { display: block; }
.demo-person small { display: block; font-size: 12px; }
.dp-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.alert { background: #fdeaea; border: 1px solid #f3c7c7; color: #8a1c1c; padding: 11px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.login-foot { font-size: 12.5px; }

/* =============================================================
   TOP BAR
   ============================================================= */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 22px; background: rgba(255,253,248,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.tb-title { margin: 0; font-size: 22px; line-height: 1; }
.tb-quote { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-soft); font-style: italic; max-width: 280px; }
.tb-nav { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.navbtn { border: none; background: transparent; padding: 8px 16px; border-radius: 9px; font-family: var(--font-body); font-size: 14px; cursor: pointer; color: var(--ink-soft); }
.navbtn.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); font-weight: 500; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.tb-uname { font-size: 14px; font-weight: 500; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; }

.demo-banner { background: #fff6e6; border-bottom: 1px solid #f0e0bd; color: #7a5b12; font-size: 13px; padding: 9px 22px; text-align: center; }
.demo-banner code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 5px; }

.content { padding: 22px; max-width: 1180px; margin: 0 auto; }

/* day / week bar */
.daybar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.day-title { margin: 0; font-size: 24px; }
.add-fab { margin-left: auto; }
.week-filter { margin-left: auto; display: flex; gap: 6px; }

/* =============================================================
   TIMELINE (Today)
   ============================================================= */
.timeline {
  display: grid;
  grid-template-columns: 56px repeat(var(--grid-cols), 1fr);
  gap: 0 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 16px 16px; box-shadow: var(--shadow); overflow: hidden;
}
.tl-corner { position: sticky; top: 0; }
.tl-head {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  display: flex; align-items: center; gap: 8px; padding: 14px 4px 12px;
  font-weight: 600; font-size: 14px; border-bottom: 2px solid var(--accent, var(--line));
}
.tl-head-dot { width: 10px; height: 10px; border-radius: 50%; }
.tl-add { margin-left: auto; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-size: 15px; line-height: 1; color: var(--ink-soft); }
.tl-add:hover { color: var(--ink); }

.tl-axis { position: relative; }
.tl-hour { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.tl-col { position: relative; border-left: 1px solid var(--line-2); }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line-2); }
.tl-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--rose); z-index: 6; }
.tl-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }

.tcard {
  position: absolute; left: 4px; right: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 9px; padding: 5px 9px; overflow: hidden; cursor: pointer;
  transition: box-shadow .12s ease, transform .08s ease;
}
.tcard:hover { box-shadow: var(--shadow); z-index: 8; transform: translateY(-1px); }
.tcard.is-done { opacity: .55; }
.tcard.is-done .tcard-title { text-decoration: line-through; }
.tcard-top { display: flex; align-items: center; gap: 7px; }
.tcard-time { font-size: 10.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tcard-title { font-size: 13px; font-weight: 500; line-height: 1.25; margin-top: 1px; }
.tcheck { width: 15px; height: 15px; border-radius: 5px; border: 2px solid; cursor: pointer; flex: none; }
.streak { position: absolute; right: 7px; bottom: 5px; font-size: 10px; font-weight: 600; color: var(--gold); background: #fff3df; padding: 1px 6px; border-radius: 999px; }

/* =============================================================
   WEEK
   ============================================================= */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week-col { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-height: 320px; overflow: hidden; }
.week-col.is-today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(15,118,110,.12), var(--shadow); }
.week-head { padding: 11px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.week-head strong { font-size: 14px; }
.week-head span { font-size: 11.5px; }
.week-list { padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.week-empty { text-align: center; margin: 12px 0; }
.week-item { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; border: none; background: var(--bg-2); border-radius: 8px; padding: 7px 8px; cursor: pointer; font-family: var(--font-body); }
.week-item:hover { background: #fff; box-shadow: var(--shadow); }
.wi-time { font-size: 10.5px; color: var(--ink-soft); width: 34px; flex: none; font-variant-numeric: tabular-nums; }
.wi-bar { width: 3px; align-self: stretch; border-radius: 2px; flex: none; }
.wi-title { font-size: 12.5px; flex: 1; line-height: 1.2; }
.wi-owner { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* =============================================================
   ADMIN
   ============================================================= */
.admin { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.admin-tabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.atab { border: none; background: transparent; padding: 11px 16px; border-radius: 9px 9px 0 0; font-family: var(--font-body); font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.atab.active { background: var(--bg-2); color: var(--ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--accent); }
.admin-body { padding: 22px; }
.panel { max-width: 620px; }
.card-edit { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--bg-2); }
.cat-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; margin-bottom: 9px; }
.cat-row input[type="color"] { height: 36px; }
.toggle { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--bg-2); }
.admin-foot { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--bg-2); }
.saved-pill { background: #e6f4ea; color: #1d6b34; font-size: 13px; padding: 5px 12px; border-radius: 999px; }

/* =============================================================
   MODALS
   ============================================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(36,27,12,.34); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 18px; }
.modal { background: var(--paper); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 26px; width: min(480px, 94vw); max-height: 90vh; overflow: auto; animation: pop .18s ease; }
.modal h3 { margin: 0 0 18px; font-size: 22px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.focus-modal { text-align: center; width: min(360px, 92vw); }
.timer-display { font-family: var(--font-display); font-size: 64px; font-variant-numeric: tabular-nums; margin: 8px 0 16px; }
.timer-presets { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
@keyframes pop { from { transform: scale(.96) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 860px) {
  .week { grid-template-columns: repeat(2, 1fr); }
  .tb-quote { display: none; }
  .timeline { grid-template-columns: 44px repeat(var(--grid-cols), 1fr); padding: 0 8px 12px; }
  .content { padding: 16px; }
}
@media (max-width: 560px) {
  .topbar { gap: 10px; }
  .tb-nav { order: 3; width: 100%; justify-content: center; }
  .week { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .add-fab { width: 100%; margin-top: 6px; }
}
