/* Almanaut — weather dashboard styles */
/* ============================================================
     FONT TOKENS — Red Hat superfamily.
     Swap these three values to retune the whole type system.
     ============================================================ */
  :root {
    --font-display: 'Red Hat Display', system-ui, sans-serif;
    --font-body: 'Red Hat Text', system-ui, sans-serif;
    --font-mono: 'Red Hat Mono', ui-monospace, monospace;
  }

  /* ============================================================
     TOKENS
     Both the page and the card system flip with theme:
       · Light — off-white panels + light-grey tiles, dark ink,
         on a soft warm-grey page.
       · Dark  — dark-grey tiles on a dark-grey page, light ink.
     Accent + data colours stay constant across both modes.
     ============================================================ */
  :root {
    --page-bg: #EFEDE7;
    --page-ink: #1C1B18;
    --page-muted: #6B6862;
    --page-border: rgba(28, 27, 24, 0.12);

    /* light-mode card system: off-white panels, light-grey tiles */
    --card: #FDFCFA;
    --card-2: #E8E6E0;
    --card-ink: #1C1B18;
    --card-muted: #6E6B64;
    --card-border: rgba(28, 27, 24, 0.09);

    /* accent + data */
    --coral: #D85A30;
    --coral-soft: #E27B57;
    --amber: #E7B15C;
    --blue: #7FB2E0;
    --teal: #5FBDA0;

    --radius-lg: 22px;
    --radius: 18px;
    --radius-sm: 12px;
  }

  [data-theme="dark"] {
    --page-bg: #1A1A1C;
    --page-ink: #F3F1EA;
    --page-muted: #9A968C;
    --page-border: rgba(243, 241, 234, 0.10);

    /* dark-mode card system: dark-grey tiles on the grey page */
    --card: #242426;
    --card-2: #2C2C2F;
    --card-ink: #F3F1EA;
    --card-muted: #9A968C;
    --card-border: rgba(243, 241, 234, 0.10);
  }

  * { box-sizing: border-box; }

  html, body { height: 100%; }

  body {
    margin: 0;
    background: var(--page-bg);
    color: var(--page-ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background .35s ease, color .35s ease;
  }

  h1, h2, h3, p { margin: 0; }

  .mono {
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .tnum { font-variant-numeric: tabular-nums lining-nums; }

  button { font-family: inherit; cursor: pointer; }
  :focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 4px; }

  /* ============================================================
     SIGN-IN GATE
     ============================================================ */
  .auth {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--page-bg);
    z-index: 50;
  }
  .auth.hidden { display: none; }

  .auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    color: var(--card-ink);
    border: 0.5px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 34px 30px 30px;
    box-shadow: 0 30px 60px -30px rgba(28,27,24,0.5);
  }
  .auth-brand {
    font-family: var(--font-display); font-weight: 700; font-size: 27px; letter-spacing: -0.01em;
    color: var(--card-ink); text-align: center; margin: 8px 0 6px;
  }
  .auth-tagline {
    text-align: center; color: var(--card-muted); font-size: 13px; line-height: 1.4; margin-bottom: 30px;
  }
  .auth-hint {
    text-align: center; color: var(--card-muted); font-size: 12.5px; line-height: 1.5; margin: -8px 0 22px;
  }
  .auth-hint[hidden] { display: none; }
  .auth-card h1 {
    font-family: var(--font-display); font-weight: 500;
    font-size: 17px; line-height: 1.2; color: var(--card-ink); margin-bottom: 4px;
  }
  .auth-card .sub { color: var(--card-muted); font-size: 13.5px; margin-bottom: 24px; }

  .field { margin-bottom: 16px; }
  .field label {
    display: block; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--card-muted); margin-bottom: 7px;
  }
  .field input {
    width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
    background: var(--card-2); border: 0.5px solid var(--card-border);
    color: var(--card-ink); font-size: 14px; font-family: inherit;
  }
  .field input::placeholder { color: #6d6a63; }
  .field input:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }

  .btn-primary {
    width: 100%; padding: 13px; margin-top: 10px;
    background: var(--coral); color: #fff; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; transition: transform .12s ease, background .2s ease;
  }
  .btn-primary:hover { background: #c94f27; }
  .btn-primary:active { transform: translateY(1px); }

  .btn-ghost {
    width: 100%; padding: 11px; margin-top: 10px; background: transparent;
    color: var(--card-muted); border: 0.5px solid var(--card-border); border-radius: var(--radius-sm);
    font-size: 13px;
  }
  .btn-ghost:hover { color: var(--card-ink); }

  .auth-note { font-size: 11px; color: var(--card-muted); text-align: center; margin-top: 18px; line-height: 1.5; }
  .auth-toggle {
    display: block; width: 100%; margin-top: 16px; padding: 4px; background: none; border: none;
    color: var(--card-muted); font-size: 12.5px; font-family: inherit; text-align: center;
  }
  .auth-toggle:hover { color: var(--card-ink); text-decoration: underline; }
  .auth-forgot {
    display: block; width: 100%; margin-top: 22px; padding: 18px 4px 4px;
    border-top: 0.5px solid var(--card-border);
    background: none; border-left: none; border-right: none; border-bottom: none;
    color: var(--card-muted); font-size: 12.5px; font-family: inherit; text-align: center;
  }
  .auth-forgot:hover { color: var(--card-ink); text-decoration: underline; }
  .auth-forgot + .auth-toggle { margin-top: 6px; }
  /* when "Forgot password?" is hidden (sign-up / reset), the toggle carries the divider */
  .forgot-hidden .auth-toggle { margin-top: 20px; padding-top: 18px; border-top: 0.5px solid var(--card-border); }
  .auth-msg { display: none; font-size: 12px; color: var(--card-muted); text-align: center; margin-top: 14px; line-height: 1.5; }
  .auth-msg.err { color: var(--coral); }

  /* ---- location permission dialog ---- */
  .geo-modal {
    position: fixed; inset: 0; z-index: 60;
    display: grid; place-items: center; padding: 24px;
    background: rgba(20,19,16,0.55);
  }
  .geo-modal[hidden] { display: none; }
  .geo-card {
    width: 100%; max-width: 380px; text-align: center;
    background: var(--card); color: var(--card-ink);
    border: 0.5px solid var(--card-border); border-radius: var(--radius-lg);
    padding: 30px 28px 24px;
    box-shadow: 0 30px 60px -30px rgba(28,27,24,0.5);
  }
  .geo-ic {
    width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 16px;
    display: grid; place-items: center;
    background: rgba(216,90,48,.12); color: var(--coral);
  }
  .geo-card h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; margin-bottom: 8px; }
  .geo-desc { font-size: 13.5px; color: var(--card-muted); line-height: 1.55; margin-bottom: 22px; }
  .geo-actions { display: flex; gap: 10px; }
  .geo-actions button { flex: 1; margin-top: 0; }

  /* ---- profile / settings modal ---- */
  .profile-modal {
    position: fixed; inset: 0; z-index: 60;
    display: grid; place-items: center; padding: 24px;
    background: rgba(20,19,16,0.55);
  }
  .profile-modal[hidden] { display: none; }
  .profile-card {
    width: 100%; max-width: 400px;
    background: var(--card); color: var(--card-ink);
    border: 0.5px solid var(--card-border); border-radius: var(--radius-lg);
    padding: 24px 26px 22px;
    box-shadow: 0 30px 60px -30px rgba(28,27,24,0.5);
  }
  .profile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
  .profile-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; }
  .profile-close {
    width: 32px; height: 32px; border: none; background: transparent; color: var(--card-muted);
    border-radius: 8px; display: grid; place-items: center;
  }
  .profile-close:hover { background: var(--card-2); color: var(--card-ink); }
  .profile-card .field input:read-only { color: var(--card-muted); cursor: not-allowed; opacity: .8; }
  .profile-msg { display: none; font-size: 12px; margin-top: 12px; line-height: 1.5; color: var(--card-muted); }
  .profile-msg.err { color: var(--coral); }
  .profile-msg.ok { color: var(--teal); }
  .profile-actions { display: flex; gap: 10px; margin-top: 20px; }
  .profile-actions button { flex: 1; margin-top: 0; }

  /* ============================================================
     NOTES TOOL — second view alongside Weather
     ============================================================ */
  .view[hidden] { display: none; }

  .notes-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
  .notes-title h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; }
  .notes-sub { font-size: 12.5px; color: var(--page-muted); margin-top: 3px; }
  .notes-actions { display: flex; gap: 10px; align-items: center; }

  .btn-soft {
    display: inline-flex; align-items: center; gap: 7px; margin-top: 0;
    padding: 10px 14px; border-radius: var(--radius-sm); border: 0.5px solid var(--page-border);
    background: var(--card); color: var(--card-ink); font-size: 13px; font-weight: 500; font-family: inherit;
  }
  .btn-soft:hover { background: var(--card-2); }
  .btn-inline { width: auto; display: inline-flex; align-items: center; gap: 7px; margin-top: 0; padding: 10px 16px; }

  .notes-folders { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
  .folder-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
    border: 0.5px solid var(--page-border); background: var(--card); color: var(--card-muted);
    font-size: 12.5px; font-family: inherit; white-space: nowrap;
  }
  .folder-chip:hover { color: var(--card-ink); }
  .folder-chip.active { background: var(--coral); color: #fff; border-color: transparent; }
  .folder-chip .count { opacity: .7; font-variant-numeric: tabular-nums; }

  .notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
  .note-card {
    background: var(--card); border: 0.5px solid var(--card-border); border-radius: var(--radius);
    padding: 16px 16px 14px; text-align: left; cursor: pointer; position: relative;
    display: flex; flex-direction: column; min-height: 124px;
    transition: transform .15s ease, border-color .2s;
  }
  .note-card:hover { transform: translateY(-3px); border-color: var(--coral); }
  .note-card .nc-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 500; color: var(--card-ink); margin-bottom: 6px; padding-right: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .note-card .nc-body { font-size: 12.5px; color: var(--card-muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; flex: 1; white-space: pre-wrap; }
  .note-card .nc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
  .note-card .nc-folder { font-size: 10px; color: var(--card-muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .note-card .nc-date { font-size: 10.5px; color: var(--card-muted); font-family: var(--font-mono); flex: 0 0 auto; }
  .note-pin {
    position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border: none;
    background: transparent; color: var(--card-muted); border-radius: 7px; display: grid; place-items: center;
  }
  .note-pin:hover { background: var(--card-2); color: var(--card-ink); }
  .note-pin.pinned { color: var(--coral); }

  .notes-empty { text-align: center; padding: 48px 20px; color: var(--card-muted); }
  .notes-empty p { font-size: 14px; margin-bottom: 16px; }
  .notes-none { grid-column: 1 / -1; color: var(--card-muted); font-size: 13px; padding: 20px 4px; }

  /* note editor modal */
  .note-editor .field textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--card-2); border: 0.5px solid var(--card-border);
    color: var(--card-ink); font-size: 14px; font-family: inherit; resize: vertical; line-height: 1.5;
  }
  .note-editor select, .bday-select {
    width: 100%; padding: 11px 34px 11px 12px; border-radius: var(--radius-sm);
    background-color: var(--card-2); border: 0.5px solid var(--card-border); color: var(--card-ink);
    font-size: 13.5px; font-family: inherit;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' stroke='%236E6B64' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center;
  }
  [data-theme="dark"] .note-editor select, [data-theme="dark"] .bday-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' stroke='%239A968C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  .note-meta-row { display: flex; gap: 12px; align-items: flex-end; }
  .note-folder-field { flex: 1; margin-bottom: 14px; }
  .note-pin-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--card-muted); padding-bottom: 20px; cursor: pointer; white-space: nowrap; }
  .note-pin-toggle input { accent-color: var(--coral); }
  .note-actions .note-delete.hidden { display: none; }
  .folder-card { max-width: 340px; }

  /* note view / edit — one dialog, two modes: read big, then Edit to amend */
  .note-editor { max-width: 560px; }
  .note-editor .profile-head { align-items: flex-start; gap: 14px; }
  .note-editor #noteModalTitle { min-width: 0; word-break: break-word; line-height: 1.25; }
  .note-head-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
  .note-edit-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
    border: 0.5px solid var(--card-border); background: var(--card-2); color: var(--card-ink);
    font-size: 12.5px; font-weight: 500; font-family: inherit; white-space: nowrap;
  }
  .note-edit-btn:hover { background: var(--card); border-color: var(--coral); }
  .note-view-body {
    font-size: 15px; line-height: 1.7; color: var(--card-ink);
    white-space: pre-wrap; word-break: break-word;
    max-height: 56vh; overflow-y: auto; padding-right: 4px;
  }
  .note-view-body.empty { color: var(--card-muted); font-style: italic; }
  .note-view-meta {
    margin-top: 18px; padding-top: 14px; border-top: 0.5px solid var(--card-border);
    font-size: 10.5px; color: var(--card-muted); text-transform: uppercase; letter-spacing: .05em;
  }
  /* mode switching — hide the half that isn't active */
  .note-editor.mode-view .note-edit,
  .note-editor.mode-edit .note-view,
  .note-editor.mode-edit .note-edit-btn { display: none; }

  /* ============================================================
     APP SHELL — static, anchored dashboard frame
     Sidebar is part of the layout (sticky full-height rail),
     not a floating pill. Collapses to an icon rail on desktop
     and becomes an off-canvas drawer on mobile.
     ============================================================ */
  .app { display: none; }
  .app.active { display: flex; min-height: 100vh; }

  :root { --sb-w: 248px; }

  /* ---- static sidebar rail ---- */
  .sidebar {
    position: sticky; top: 0;
    align-self: flex-start;
    height: 100vh;
    width: var(--sb-w);
    flex: 0 0 var(--sb-w);
    background: var(--card);
    border-right: 0.5px solid var(--card-border);
    display: flex; flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
    transition: width .25s ease, flex-basis .25s ease, transform .25s ease;
    z-index: 40;
  }
  .app.collapsed { --sb-w: 78px; }

  /* brand row */
  .sb-brand {
    display: flex; align-items: center; gap: 8px;
    padding: 18px 22px 14px;
  }
  .sb-lockup { display: flex; align-items: center; min-width: 0; }
  .sb-brand-text { min-width: 0; }
  .sb-brand-text .t {
    font-family: var(--font-display); font-size: 20px; font-weight: 600;
    color: var(--card-ink); white-space: nowrap;
  }

  .sb-collapse {
    margin-left: auto; width: 30px; height: 30px; flex: 0 0 30px; border: none;
    background: transparent; color: var(--card-muted); border-radius: 8px; display: grid; place-items: center;
    transition: transform .25s ease;
  }
  .sb-collapse:hover { background: var(--card-2); color: var(--card-ink); }
  .app.collapsed .sb-collapse { transform: rotate(180deg); }

  /* scrollable nav body */
  .sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .sb-group { margin-bottom: 18px; }
  .sb-group-label {
    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--card-muted); padding: 6px 12px 8px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
  }
  .sb-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 11px; border: none; width: 100%;
    background: transparent; color: var(--card-muted); text-align: left;
    font-size: 13.5px; font-family: inherit; position: relative;
    transition: background .18s ease, color .18s ease; text-decoration: none;
  }
  .sb-item .sb-ic { flex: 0 0 20px; display: grid; place-items: center; }
  .sb-item .sb-label { white-space: nowrap; overflow: hidden; }
  .sb-item .sb-tag {
    margin-left: auto; font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--card-muted); border: 0.5px solid var(--card-border); padding: 2px 6px; border-radius: 6px; white-space: nowrap;
    display: none;
  }
  .sb-item:hover { background: var(--card-2); color: var(--card-ink); }
  .sb-item.active { background: var(--coral); color: #fff; }
  .sb-item.active .sb-tag { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.35); }
  .sb-item.add { border: 1px dashed var(--card-border); }

  /* alert count badge — beside the label when expanded, a corner badge when collapsed */
  .sb-count {
    margin-left: auto; flex: 0 0 auto;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--coral); color: #fff; font-size: 10.5px; font-weight: 700;
    display: none; align-items: center; justify-content: center; line-height: 1;
    font-family: var(--font-body); box-sizing: border-box;
  }
  .sb-item .sb-count:not([hidden]) { display: inline-flex; }
  .app.collapsed .sb-count {
    position: absolute; top: 4px; right: 14px; margin: 0;
    min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px;
    border: 1.5px solid var(--card);
  }

  /* tooltip only when collapsed */
  /* collapsed-rail tooltip removed entirely */
  .sb-item .tip { display: none; }

  /* footer: profile */
  .sb-foot { border-top: 0.5px solid var(--card-border); padding: 12px; }
  .sb-profile {
    display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin-top: 4px; border-radius: 11px;
  }
  .sb-profile .pfp {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
    background: linear-gradient(135deg, #e9c9b8, #d88a63); display: grid; place-items: center;
    font-family: var(--font-display); color: #4a2413; font-weight: 600; font-size: 13px;
  }
  .sb-profile .who { flex: 1; min-width: 0; overflow: hidden; }
  .sb-profile .who .n { font-size: 13px; color: var(--card-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sb-profile .who .r { font-size: 10.5px; color: var(--card-muted); white-space: nowrap; }
  .sb-cog, .sb-signout {
    width: 30px; height: 30px; flex: 0 0 30px; border: none;
    background: transparent; color: var(--card-muted); border-radius: 8px; display: grid; place-items: center;
  }
  .sb-cog:hover, .sb-signout:hover { background: var(--card-2); color: var(--card-ink); }

  /* collapsed rail: hide text, center icons, show tooltips */
  .app.collapsed .sb-brand { padding: 20px 22px 16px; flex-direction: column; align-items: center; gap: 12px; }
  .app.collapsed .sb-collapse { margin-left: 0; }
  .app.collapsed .brand-rest,
  .app.collapsed .sb-group-label,
  .app.collapsed .sb-item .sb-label,
  .app.collapsed .sb-item .sb-tag,
  .app.collapsed .sb-cog,
  .app.collapsed .sb-signout,
  .app.collapsed .sb-profile .who { display: none; }
  .app.collapsed .sb-item { justify-content: center; padding: 11px; }
  .app.collapsed .sb-profile { justify-content: center; padding: 10px; }
  .app.collapsed .sb-nav { padding: 6px 10px 12px; overflow-y: hidden; scrollbar-width: none; }
  .app.collapsed .sb-nav::-webkit-scrollbar { display: none; }

  /* overlay for mobile drawer */
  .overlay {
    position: fixed; inset: 0; background: rgba(20,19,16,0.5);
    opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 39;
  }

  /* ---- main scroll column ---- */
  .main-scroll { flex: 1; min-width: 0; overflow-x: hidden; }
  main.content { min-width: 0; padding-bottom: 32px; }
  .content-inner { max-width: 1120px; margin: 0 auto; padding: 20px 26px 0; }

  .mobile-menu {
    display: none; width: 44px; height: 44px; border-radius: 12px; border: none;
    background: var(--card); color: var(--card-ink); place-items: center; flex: 0 0 44px;
  }

  .topbar {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 6px 0 22px;
  }
  .greeting .hello { font-size: 15px; color: var(--page-muted); }
  .greeting .time-of-day {
    font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.1; margin-top: 2px;
  }
  .top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

  /* ---- home landing ---- */
  .home-hero { position: relative; padding: 26px 0 32px; }
  .home-orb {
    position: absolute; z-index: 0; top: -46px; left: -34px;
    width: 340px; height: 340px; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle at 50% 50%, rgba(216,90,48,0.30), rgba(231,177,92,0.14) 45%, transparent 70%);
    filter: blur(34px); animation: orbFloat 13s ease-in-out infinite;
  }
  @keyframes orbFloat {
    0%, 100% { transform: translate(0,0) scale(1); }
    50%      { transform: translate(44px, 22px) scale(1.14); }
  }
  .home-eyebrow, .home-greeting, .home-sub { position: relative; z-index: 1; }
  .home-eyebrow {
    display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px;
    padding: 6px 13px 6px 9px; border-radius: 999px;
    background: var(--card); border: 0.5px solid var(--card-border);
    font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--card-muted);
  }
  .home-tod-ic { display: grid; place-items: center; width: 18px; height: 18px; color: var(--amber); }
  .home-hero[data-period="morning"]   .home-tod-ic { color: var(--amber); }
  .home-hero[data-period="afternoon"] .home-tod-ic { color: var(--coral); }
  .home-hero[data-period="evening"]   .home-tod-ic { color: var(--blue); }
  .home-greeting {
    font-family: var(--font-display); font-weight: 600;
    font-size: clamp(34px, 8vw, 72px); line-height: 1.12; letter-spacing: -0.02em;
    padding-bottom: 0.08em;
    background: linear-gradient(100deg, var(--coral) 0%, var(--amber) 28%, var(--coral-soft) 52%, var(--coral) 78%, var(--amber) 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: gradientFlow 9s ease-in-out infinite;
  }
  @keyframes gradientFlow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
  .home-sub { font-size: 15.5px; color: var(--page-muted); margin-top: 14px; }
  @media (prefers-reduced-motion: reduce) { .home-orb, .home-greeting { animation: none; } }
  .home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  .home-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 20px; border-radius: var(--radius-lg); text-align: left; width: 100%; cursor: pointer;
    background: var(--card); border: 0.5px solid var(--card-border); color: var(--card-ink);
    font-family: inherit; transition: transform .15s ease, border-color .2s;
  }
  .home-tile:hover { transform: translateY(-3px); border-color: var(--coral); }
  .home-tile .ht-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); color: var(--coral); }
  .home-tile .ht-name { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--card-ink); }
  .home-tile .ht-desc { font-size: 12.5px; color: var(--card-muted); line-height: 1.45; }
  .icon-circle {
    width: 46px; height: 46px; border-radius: 50%; border: none;
    background: var(--card); color: var(--card-ink); display: grid; place-items: center;
    position: relative; transition: background .18s ease, color .18s ease;
  }
  .icon-circle:hover { background: var(--card-2); }
  .icon-circle #themeIcon { display: grid; place-items: center; line-height: 0; }
  .icon-circle .badge {
    position: absolute; top: 10px; right: 11px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--coral); border: 2px solid var(--card);
  }
  .avatar {
    width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 0.5px solid var(--page-border);
    background: linear-gradient(135deg, #e9c9b8, #d88a63); display: grid; place-items: center;
    font-family: var(--font-display); color: #4a2413; font-weight: 600; font-size: 17px;
  }

  /* ---- notification bell dropdown ---- */
  .notif-wrap { position: relative; }
  .notif-panel {
    position: absolute; top: calc(100% + 10px); right: 0;
    width: 320px; max-width: calc(100vw - 32px);
    background: var(--card); color: var(--card-ink);
    border: 0.5px solid var(--card-border); border-radius: var(--radius);
    box-shadow: 0 24px 48px -24px rgba(28,27,24,0.45);
    overflow: hidden; z-index: 45;
    user-select: none; -webkit-user-select: none;   /* it's chrome, not selectable copy */
  }
  .notif-panel[hidden] { display: none; }
  .notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 0.5px solid var(--card-border);
    font-family: var(--font-display); font-weight: 500; font-size: 14px; color: var(--card-ink);
  }
  .notif-count { font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--card-muted); }
  .notif-list { max-height: 360px; overflow-y: auto; }
  .notif-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 13px 16px; border-bottom: 0.5px solid var(--card-border);
  }
  .notif-item:last-child { border-bottom: none; }
  .notif-ic {
    flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center; background: var(--card-2);
  }
  .notif-body { min-width: 0; flex: 1; }
  .notif-title { font-size: 13px; font-weight: 500; color: var(--card-ink); line-height: 1.35; }
  .notif-sub { font-size: 11.5px; color: var(--card-muted); margin-top: 2px; line-height: 1.45; }

  /* ============================================================
     BIRTHDAY BOY — the people you don't want to forget
     ============================================================ */
  .bday-today { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  .bday-today-card {
    display: flex; align-items: center; gap: 14px; padding: 15px 18px;
    border-radius: var(--radius); color: #fff;
    background: linear-gradient(120deg, var(--coral), var(--coral-soft));
  }
  .bday-today-card .cake { flex: 0 0 auto; display: grid; place-items: center; align-self: flex-start; margin-top: 2px; }
  .bday-today-text { flex: 1; min-width: 0; }
  .bday-today-card .t { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; }
  .bday-today-card .s { font-size: 13px; opacity: .95; margin-top: 4px; line-height: 1.45; }
  .bday-copy {
    flex: 0 0 auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
    border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.15);
    color: #fff; font-size: 12px; font-weight: 500; font-family: inherit;
    transition: background .15s ease;
  }
  .bday-copy:hover { background: rgba(255,255,255,.28); }
  .bday-copy.copied { background: #fff; color: var(--coral); border-color: #fff; }

  .bday-list { display: flex; flex-direction: column; gap: 10px; }
  .bday-card {
    display: flex; align-items: center; gap: 14px; padding: 13px 16px; text-align: left; width: 100%;
    background: var(--card); border: 0.5px solid var(--card-border); border-radius: var(--radius);
    cursor: pointer; font-family: inherit; transition: transform .15s ease, border-color .2s;
  }
  .bday-card:hover { transform: translateY(-2px); border-color: var(--coral); }
  .bday-date-badge {
    flex: 0 0 auto; width: 52px; padding: 8px 0; text-align: center;
    background: var(--card-2); border-radius: var(--radius-sm);
  }
  .bday-date-badge .m { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--card-muted); }
  .bday-date-badge .d { display: block; font-family: var(--font-display); font-size: 19px; color: var(--card-ink); line-height: 1.15; }
  .bday-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .bday-info .n { font-family: var(--font-display); font-size: 15px; font-weight: 500; color: var(--card-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bday-info .sub { font-size: 12px; color: var(--card-muted); margin-top: 2px; }
  .bday-countdown { flex: 0 0 auto; text-align: right; font-size: 12px; color: var(--card-muted); font-family: var(--font-mono); white-space: nowrap; }
  .bday-countdown.soon { color: var(--coral); }
  .bday-delete.hidden { display: none; }
  .field label .opt { color: var(--card-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

  /* ---- forecast panel ---- */
  .panel {
    background: var(--card); color: var(--card-ink);
    border: 0.5px solid var(--card-border); border-radius: var(--radius-lg);
    padding: 22px 22px 20px; margin-bottom: 16px;
  }
  .panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
  .tabs { display: flex; gap: 4px; background: var(--card-2); padding: 4px; border-radius: 999px; }
  .tab {
    border: none; background: transparent; color: var(--card-muted);
    font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: 999px; transition: all .2s;
  }
  .tab.active { background: var(--card-ink); color: var(--card); }
  .panel-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--card-muted); }
  .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); position: relative; }
  .live-dot::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--coral);
    animation: pulse 2.2s ease-out infinite;
  }
  .live-dot.stale { background: var(--card-muted); }
  .live-dot.stale::after { display: none; }
  @keyframes pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }

  .strip { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 6px; scrollbar-width: thin; }
  .day-card {
    flex: 0 0 auto; width: 104px; background: var(--card-2);
    border: 0.5px solid var(--card-border); border-radius: var(--radius); padding: 16px 12px;
    text-align: center; transition: transform .15s ease, border-color .2s;
  }
  .day-card:hover { transform: translateY(-3px); border-color: var(--coral); }
  .day-card.now { background: linear-gradient(180deg, rgba(216,90,48,.16), var(--card-2)); border-color: rgba(216,90,48,.4); }
  .day-card .d-label { font-size: 12px; color: var(--card-muted); margin-bottom: 12px; }
  .day-card.now .d-label { color: var(--coral-soft); font-weight: 600; }
  .day-card .d-icon { display: grid; place-items: center; margin-bottom: 12px; height: 40px; }
  .day-card .d-temp { font-family: var(--font-display); font-size: 20px; }
  .day-card .d-temp .lo { color: var(--card-muted); font-size: 14px; margin-left: 5px; }

  /* ---- bento ---- */
  .bento { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; align-items: start; }
  .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .card {
    background: var(--card); color: var(--card-ink);
    border: 0.5px solid var(--card-border); border-radius: var(--radius-lg); padding: 22px;
  }
  .card-label { font-size: 10.5px; color: var(--card-muted); margin-bottom: 16px; }

  /* current conditions hero */
  .now-hero .temp-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .now-hero .temp { font-family: var(--font-display); font-weight: 500; font-size: 60px; line-height: .95; }
  .now-hero .temp .deg { font-size: 26px; color: var(--card-muted); }
  .now-hero .cond { font-size: 14px; color: var(--card-muted); margin-top: 6px; }
  .now-hero .cond strong { color: var(--card-ink); font-weight: 500; }
  .now-hero .hero-icon { color: var(--amber); }
  .dispatch {
    font-family: var(--font-display); font-style: italic; font-size: 15.5px; line-height: 1.5;
    margin-top: 20px; padding-top: 18px; border-top: 0.5px solid var(--card-border);
  }
  .dispatch::before { content: '— '; color: var(--coral-soft); font-style: normal; }

  /* mini metric pair */
  .metric-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .metric { }
  .metric .m-top { display: flex; align-items: center; gap: 8px; color: var(--card-muted); margin-bottom: 12px; }
  .metric .m-top .m-name { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; }
  .metric .m-val { font-family: var(--font-display); font-size: 26px; }
  .metric .m-val .u { font-size: 13px; color: var(--card-muted); font-family: var(--font-body); margin-left: 2px; }
  .metric .m-sub { font-size: 11px; color: var(--card-muted); margin-top: 3px; }
  .ic-blue { color: var(--blue); }
  .ic-amber { color: var(--amber); }
  .ic-teal { color: var(--teal); }
  .ic-coral { color: var(--coral-soft); }

  /* hourly chart */
  .chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
  .chart-head .now-temp { font-family: var(--font-display); font-size: 20px; }
  .chart-wrap { position: relative; width: 100%; }
  .chart-wrap svg { width: 100%; height: auto; display: block; touch-action: none; }
  .chart-x { display: flex; justify-content: space-between; margin-top: 8px; }
  .chart-x span { font-size: 10.5px; color: var(--card-muted); font-family: var(--font-mono); }
  .tip-box {
    position: absolute; transform: translate(-50%, -120%); pointer-events: none;
    background: var(--card-2); border: 0.5px solid var(--card-border); color: var(--card-ink);
    padding: 5px 9px; border-radius: 8px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .12s;
  }
  .tip-box .tt { font-family: var(--font-display); }
  .tip-box .th { color: var(--card-muted); font-family: var(--font-mono); font-size: 10px; }

  /* 7-day range viz */
  .range-row { display: grid; grid-template-columns: 46px 1fr 84px; align-items: center; gap: 12px; padding: 9px 0; }
  .range-row + .range-row { border-top: 0.5px solid var(--card-border); }
  .range-row .r-day { font-size: 13px; }
  .range-track { position: relative; height: 8px; background: var(--card-2); border-radius: 999px; }
  .range-fill { position: absolute; top: 0; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--amber), var(--coral-soft)); }
  .range-row .r-temps { text-align: right; font-family: var(--font-display); font-size: 14px; }
  .range-row .r-temps .lo { color: var(--card-muted); margin-left: 6px; }

  /* loading + error */
  .skeleton { background: var(--card-2); border-radius: 8px; position: relative; overflow: hidden; }
  .skeleton::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(28,27,24,.08), transparent);
    animation: shimmer 1.4s infinite;
  }
  [data-theme="dark"] .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  }
  @keyframes shimmer { 100% { transform: translateX(100%); } }
  .err-note { color: var(--card-muted); font-size: 13px; line-height: 1.5; }
  .err-note button { margin-top: 12px; background: var(--card-2); color: var(--card-ink); border: 0.5px solid var(--card-border); padding: 8px 16px; border-radius: 999px; font-size: 12px; }

  /* entrance stagger */
  .rise { opacity: 0; transform: translateY(10px); animation: rise .5s cubic-bezier(.2,.7,.3,1) forwards; }
  .rise.d1 { animation-delay: .05s; }
  .rise.d2 { animation-delay: .12s; }
  .rise.d3 { animation-delay: .19s; }
  .rise.d4 { animation-delay: .26s; }
  @keyframes rise { to { opacity: 1; transform: none; } }

  @media (prefers-reduced-motion: reduce) {
    .live-dot::after, .skeleton::after { animation: none; }
    .rise { opacity: 1; transform: none; animation: none; }
    .day-card { transition: none; }
  }

  /* ---- responsive ---- */
  @media (max-width: 860px) {
    /* sidebar becomes an off-canvas drawer */
    .sidebar {
      position: fixed; left: 0; top: 0; height: 100vh;
      width: 264px; flex-basis: 264px; transform: translateX(-100%);
      box-shadow: 24px 0 48px -24px rgba(20,19,16,0.5);
    }
    .app.collapsed { --sb-w: 264px; }              /* ignore collapse on mobile */
    .app.collapsed .brand-rest,
    .app.collapsed .sb-collapse,
    .app.collapsed .sb-group-label,
    .app.collapsed .sb-item .sb-label,
    .app.collapsed .sb-tag,
    .app.collapsed .sb-profile .who { display: revert; }
    .app.collapsed .sb-brand { flex-direction: row; align-items: center; }
    .sb-brand { flex-direction: row; gap: 11px; padding: 20px 18px 16px; }
    .sb-brand-text { display: revert; }
    .sb-collapse { display: none; }
    .app.drawer-open .sidebar { transform: none; }
    .app.drawer-open .overlay { opacity: 1; pointer-events: auto; }
    .mobile-menu { display: grid; }
    .content-inner { padding: 16px 16px 0; }
    .bento { grid-template-columns: 1fr; }
  }
  @media (max-width: 480px) {
    .now-hero .temp { font-size: 52px; }
    .greeting .time-of-day { font-size: 25px; }
    .metric-pair { grid-template-columns: 1fr 1fr; }
  }
