/* ==========================================================================
   Maica — teal edition
   Plain CSS, no framework. Custom properties at the top are the only place
   the palette is defined; everything else refers to them.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600&display=swap');

:root {
  /* Teal core */
  --teal:        #0f7a72;
  --teal-soft:   #2a9d94;
  --teal-dark:   #0a544f;
  --teal-deep:   #07403c;
  --mist:        #d8eeeb;
  --mist-deep:   #b7ded9;

  /* Neutrals */
  --ink:         #12302e;
  --muted:       #6d827f;
  --paper:       #f4f7f6;
  --white:       #ffffff;
  --line:        #dbe5e3;

  /* Accents, kept from the original so teal has something warm to sit against */
  --coral:       #ef856f;
  --sand:        #f4d58c;
  --lilac:       #d8d3ef;

  --shadow:      0 18px 50px rgba(15, 60, 55, .08);
  --shadow-soft: 0 8px 24px rgba(15, 60, 55, .05);
  --radius:      6px;
}

* { box-sizing: border-box; }

/* Any `display` rule of ours would otherwise beat the browser's own style for
   [hidden], leaving elements we marked hidden on screen. Settle it once. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', 'Trebuchet MS', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 3px solid var(--teal-soft); outline-offset: 3px; }
a { color: var(--teal); }

h1, h2, h3 { font-family: 'Playfair Display', Georgia, serif; font-weight: 500; }

/* --- App shell ----------------------------------------------------------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 255px;
  flex: none;
  background: var(--teal-deep);
  color: #eef7f5;
  padding: 31px 20px 25px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 24px; letter-spacing: -1px; font-weight: 700;
  padding: 0 12px 38px;
  color: inherit; text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center;
  flex: none;   /* never let the narrow sidebar squash the circle into an oval */
  background: var(--coral); color: var(--teal-deep);
  width: 29px; height: 29px; border-radius: 50%;
  font-family: Georgia, serif; font-size: 22px; font-weight: 700;
}

.space-switcher {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 9px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 10px;
  margin-bottom: 32px;
}
.space-switcher strong, .space-switcher small { display: block; }
.space-switcher strong { font-size: 12px; }
.space-switcher small { font-size: 10px; color: #9cc4bf; margin-top: 3px; }

.avatar {
  border: 0; width: 34px; height: 34px; border-radius: 50%;
  font-weight: 700; display: grid; place-items: center; flex: none;
  text-decoration: none;
}
.avatar-teal   { background: var(--mist);  color: var(--teal-dark); }
.avatar-coral  { background: var(--coral); color: var(--teal-deep); }
.avatar-lilac  { background: var(--lilac); color: #4f466d; }
.avatar-sand   { background: var(--sand);  color: #7a5a1c; }

.main-nav { display: grid; gap: 5px; }
.nav-item {
  border: 0; background: none; color: #9dc0ba;
  border-radius: 8px; text-align: left;
  padding: 12px 13px; font-size: 13px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none;
}
.nav-item .glyph { width: 17px; text-align: center; font-size: 18px; }
.nav-item:hover, .nav-item.active { background: var(--teal-dark); color: #fff; }

.sidebar-footer { margin-top: auto; display: grid; gap: 18px; }
.connection-status {
  display: flex; align-items: center; gap: 8px;
  color: #93b5b0; font-size: 10px; padding: 0 13px;
}
.connection-status i, .status-pill i {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-soft);
}
.connection-status.live i { background: #6fd3a8; animation: pulse 2s infinite; }
.connection-status.offline i { background: var(--coral); animation: none; }

@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(111, 211, 168, .25); } }

.main-content { width: calc(100% - 255px); max-width: 1450px; }

.topbar {
  height: 82px;
  display: flex; justify-content: flex-end; align-items: center; gap: 18px;
  padding: 0 6.5%;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.mobile-brand { display: none; margin-right: auto; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }

.top-action, .plain-button {
  border: 0; background: none; color: var(--teal);
  font-size: 12px; font-weight: 700;
}
.top-action .glyph { font-size: 18px; vertical-align: -2px; margin-right: 6px; }

/* Bell + unread dot */
.bell { position: relative; border: 0; background: none; font-size: 19px; color: var(--teal-dark); padding: 4px; }
.bell .badge {
  position: absolute; top: -2px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--coral); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}

.view { padding: 49px 6.5% 90px; max-width: 1260px; margin: 0 auto; }

.page-heading {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 30px; margin-bottom: 30px;
}
.eyebrow, .card-kicker {
  margin: 0 0 10px; color: var(--teal);
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.7px; font-weight: 700;
}
.page-heading h1 {
  font-size: clamp(35px, 4vw, 54px); line-height: 1.05;
  letter-spacing: -1.5px; margin: 0 0 12px;
}
.lede { font-size: 14px; color: var(--muted); margin: 0; }

.primary-button {
  border: 0; border-radius: 4px;
  background: var(--teal); color: #fff;
  padding: 12px 17px; font-size: 12px; font-weight: 700;
}
.primary-button:hover { background: var(--teal-dark); }
.ghost-button {
  border: 1px solid var(--line); border-radius: 4px; background: var(--white);
  color: var(--teal-dark); padding: 11px 15px; font-size: 12px; font-weight: 700;
}
.ghost-button:hover { border-color: var(--teal-soft); }

/* --- Clocks -------------------------------------------------------------- */

.clock-strip {
  display: flex; gap: 22px; flex-wrap: wrap;
  border-left: 1px solid var(--line); padding-left: 24px;
}
.clock { min-width: 112px; }
.clock .who { display: flex; align-items: center; gap: 7px; }
.clock .who span { color: var(--muted); font-size: 10px; }
.clock .dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.clock strong { display: block; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; margin: 5px 0; }
.clock small { display: block; color: var(--muted); font-size: 10px; }

/* --- Routine board ------------------------------------------------------- */

.board-summary {
  display: flex; align-items: center; gap: 22px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 22px 25px; margin-bottom: 20px;
}
.progress-ring {
  height: 76px; width: 76px; border-radius: 50%;
  display: grid; place-items: center; position: relative; flex: none;
  background: conic-gradient(var(--teal) calc(var(--progress, 0) * 1%), var(--mist-deep) 0);
}
.progress-ring::after {
  content: ''; position: absolute; inset: 7px;
  background: var(--white); border-radius: 50%;
}
.progress-ring span { z-index: 1; font-size: 19px; font-weight: 700; }
.progress-ring small { font-size: 10px; color: var(--muted); font-weight: 400; }

.board-summary h2 { font-size: 22px; margin: 0; }
.board-summary p { font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.streak-badge {
  margin-left: auto; flex: none;
  background: var(--mist); color: var(--teal-dark);
  border-radius: 30px; padding: 9px 14px;
  font-size: 11px; font-weight: 700;
}

.routine-board {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.board-header {
  padding: 16px 25px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.board-header .muted { color: var(--muted); font-weight: 400; }

.board-item {
  min-height: 86px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 15px; padding: 18px 25px;
}
.board-item:last-child { border-bottom: 0; }
.board-item .body { flex: 1; min-width: 0; }
.board-item strong, .board-item small { display: block; }
.board-item strong { font-size: 14px; }
.board-item small { font-size: 10px; color: var(--muted); margin-top: 5px; }
.board-item.done strong { text-decoration: line-through; color: #94a5a1; }
.board-item.next { background: #f2faf8; }
.board-item.overdue { background: #fff6f2; }

.board-state { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; flex: none; }
.board-item.overdue .board-state { color: #c26a52; }
.board-item.next .board-state { color: var(--teal); }

.tick {
  flex: none; width: 27px; height: 27px; border-radius: 50%;
  border: 1px solid var(--mist-deep); background: var(--white);
  display: grid; place-items: center;
  color: transparent; font-size: 14px;
  transition: background .18s, border-color .18s, transform .18s;
}
.tick:hover { border-color: var(--teal-soft); transform: scale(1.06); }
.tick.checked { background: var(--teal); border-color: var(--teal); color: #fff; }
.tick.busy { opacity: .5; pointer-events: none; }

.item-streak {
  flex: none; font-size: 10px; color: var(--teal);
  background: var(--mist); border-radius: 20px; padding: 5px 9px; font-weight: 700;
}
.remove-routine {
  flex: none; border: 0; background: none; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 6px;
}
.remove-routine:hover { color: var(--coral); }

.board-empty { padding: 55px 25px; text-align: center; }
.board-empty h2 { font-size: 24px; margin: 0 0 8px; }
.board-empty p { color: var(--muted); font-size: 12px; margin: 0 0 20px; }

.all-done-note {
  margin-top: 18px; background: var(--mist); border-radius: var(--radius);
  padding: 16px 20px; font-size: 12px; color: var(--teal-dark);
}

/* --- Notification panel -------------------------------------------------- */

.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw;
  background: var(--white); border-left: 1px solid var(--line);
  box-shadow: -18px 0 60px rgba(15, 60, 55, .12);
  z-index: 30; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.notif-panel.open { transform: translateX(0); }
.notif-head {
  padding: 22px 22px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.notif-head h2 { font-size: 21px; margin: 0; flex: 1; }
.notif-list { overflow-y: auto; flex: 1; padding: 6px 0; }
.notif-item { padding: 15px 22px; border-bottom: 1px solid var(--line); }
.notif-item.unread { background: #f2faf8; border-left: 3px solid var(--teal); padding-left: 19px; }
.notif-item strong { display: block; font-size: 13px; }
.notif-item p { margin: 5px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.notif-item time { display: block; margin-top: 7px; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.notif-empty { padding: 40px 22px; text-align: center; color: var(--muted); font-size: 12px; }
.notif-foot { border-top: 1px solid var(--line); padding: 16px 22px; display: grid; gap: 10px; }
.notif-foot .hint { font-size: 10px; color: var(--muted); line-height: 1.5; margin: 0; }

/* --- Modal & toast ------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7, 48, 45, .5);
  display: grid; place-items: center; padding: 20px; z-index: 40;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative; background: var(--white); border-radius: var(--radius);
  padding: 32px; max-width: 460px; width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .2);
}
.modal h2 { font-size: 29px; margin: 0 0 22px; }
.modal-close {
  position: absolute; right: 13px; top: 9px;
  border: 0; background: none; font-size: 26px; color: var(--muted);
}

.field { display: block; margin-bottom: 15px; }
.field span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 4px;
  padding: 12px; font: 13px 'DM Sans', sans-serif; background: #fbfdfc; color: var(--ink);
}
.field textarea { height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: #b8503c; font-size: 11px; margin: 0 0 14px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  background: var(--teal-deep); color: #fff;
  padding: 13px 18px; border-radius: 4px; font-size: 12px;
  max-width: 320px;
  opacity: 0; transform: translateY(8px); transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* --- Install prompt ------------------------------------------------------ */

.install-bar {
  display: flex; align-items: center; gap: 14px;
  background: var(--teal-dark); color: #eaf6f4;
  border-radius: var(--radius); padding: 15px 19px; margin-bottom: 22px;
}
.install-bar p { margin: 0; font-size: 12px; flex: 1; line-height: 1.5; }
.install-bar strong { display: block; font-size: 13px; margin-bottom: 3px; }
.install-bar button {
  border: 0; border-radius: 4px; background: var(--coral); color: var(--teal-deep);
  padding: 10px 15px; font-size: 11px; font-weight: 700; flex: none;
}
.install-bar .dismiss { background: none; color: #a8cbc6; padding: 10px 4px; }

/* --- Auth pages ---------------------------------------------------------- */

.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 30px;
  background: radial-gradient(circle at 20% 10%, #16605a, var(--teal-deep) 60%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--white);
  border-radius: 10px; padding: 38px 34px; box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}
.auth-card .brand { padding: 0 0 26px; color: var(--ink); }
.auth-card h1 { font-size: 30px; margin: 0 0 8px; }
.auth-card .lede { margin-bottom: 26px; font-size: 13px; }
.auth-card .primary-button { width: 100%; padding: 14px; font-size: 13px; }
.auth-note { margin: 22px 0 0; font-size: 10px; color: var(--muted); line-height: 1.6; text-align: center; }
.auth-page.overwatch { background: radial-gradient(circle at 80% 15%, #123f3c, #061e1d 65%); }
.auth-page.overwatch .brand-mark { background: var(--teal-soft); color: #04201e; }

/* --- Offline page -------------------------------------------------------- */

.offline-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; text-align: center; }
.offline-page h1 { font-size: 34px; margin: 0 0 10px; }
.offline-page p { color: var(--muted); font-size: 13px; max-width: 340px; margin: 0 auto 22px; }

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 860px) {
  .sidebar { width: 72px; padding: 24px 10px; }
  .sidebar .brand { padding: 0 10px 34px; font-size: 0; justify-content: center; }
  .sidebar .brand-mark { font-size: 22px; }
  .space-switcher { border: 0; padding: 8px; justify-content: center; }
  .space-switcher .who { display: none; }
  .sidebar .nav-item { font-size: 0; justify-content: center; padding: 13px; gap: 0; }
  .sidebar .nav-item .glyph { font-size: 20px; }
  .connection-status span { display: none; }
  .connection-status { justify-content: center; padding: 0; }
  .main-content { width: calc(100% - 72px); }
  .topbar { height: 68px; padding: 0 5%; }
  .view { padding: 34px 5% 70px; }
  .page-heading { display: block; }
  .page-heading .primary-button { margin-top: 18px; }
  .clock-strip { margin-top: 24px; padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .board-summary { flex-wrap: wrap; }
  .streak-badge { margin-left: 0; }
}

@media (max-width: 520px) {
  .sidebar { width: 58px; padding: 20px 6px; }
  .main-content { width: calc(100% - 58px); }
  .page-heading h1 { font-size: 34px; }
  .board-item { padding: 16px; gap: 12px; }
  .board-state { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* Honour the visitor's motion preference. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
