:root {
  --ink: #19332b;
  --ink-soft: #5e6d67;
  --paper: #f4f0e7;
  --panel: rgba(255, 253, 247, .82);
  --panel-solid: #fffdf7;
  --line: rgba(25, 51, 43, .14);
  --sage: #a9c5ae;
  --sage-dark: #315c4c;
  --coral: #e98168;
  --gold: #e3b75c;
  --blue: #73a8b2;
  --shadow: 0 22px 60px rgba(45, 64, 53, .10);
  --display: "Fraunces", Georgia, serif;
  --sans: "DM Sans", sans-serif;
}

[data-theme="night"] {
  --ink: #f0eee6;
  --ink-soft: #aebcb6;
  --paper: #12221e;
  --panel: rgba(28, 48, 41, .88);
  --panel-solid: #1c3029;
  --line: rgba(229, 238, 233, .14);
  --sage: #759b81;
  --sage-dark: #d2e2d6;
  --coral: #ed907a;
  --gold: #e3bd70;
  --blue: #86b7c0;
  --shadow: 0 22px 60px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgba(233,129,104,.15), transparent 26rem),
    radial-gradient(circle at 8% 42%, rgba(169,197,174,.24), transparent 30rem),
    var(--paper);
  font-family: var(--sans);
  min-height: 100vh;
  transition: background .3s, color .3s;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.shell { width: min(1420px, calc(100% - 48px)); margin: 0 auto; position: relative; }

.topbar {
  height: 90px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; width: max-content; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50% 50% 12px 50%; color: var(--paper); background: var(--ink); font-family: var(--display); font-size: 18px; transform: rotate(-8deg); }
.topnav { display: flex; gap: 32px; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-size: 14px; transition: color .2s; }
.topnav a:hover { color: var(--ink); }
.topbar > .icon-button { justify-self: end; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 18px; }
.icon-button:hover { background: var(--panel); }

.hero { padding: 64px 0 48px; display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(40px, 8vw, 130px); align-items: end; }
.eyebrow, .kicker { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 700; color: var(--coral); }
.hero h1 { font: 600 clamp(55px, 7vw, 108px)/.94 var(--display); letter-spacing: -.055em; margin: 0; }
.hero-line { margin: 20px 0 0; color: var(--ink-soft); font-size: 19px; }
.dot { color: var(--coral); padding: 0 5px; }
.weather-card { background: var(--ink); color: var(--paper); padding: 28px 30px; border-radius: 2px 34px 2px 34px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.weather-card::after { content: ""; position: absolute; width: 150px; height: 150px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; top: -85px; right: -40px; }
.weather-main { display: flex; align-items: center; gap: 18px; }
.weather-icon { font-size: 44px; color: var(--gold); }
.weather-temp { font: 600 42px/1 var(--display); margin: 0; }
.weather-label { margin: 4px 0 0; font-size: 13px; opacity: .74; }
.weather-detail { border-top: 1px solid rgba(255,255,255,.16); margin-top: 24px; padding-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); }
.weather-detail p { margin: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.weather-detail span { opacity: .55; }
.weather-detail strong { font-size: 13px; font-weight: 600; }
.weather-status { font-size: 11px; opacity: .55; margin: 14px 0 0; min-height: 1em; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); gap: 22px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 28px; backdrop-filter: blur(15px); }
.calendar-panel { border-radius: 28px 4px 28px 4px; min-height: 650px; }
.side-stack { display: grid; gap: 22px; }
.tasks-panel { border-radius: 4px 28px 4px 28px; }
.links-panel { border-radius: 28px 4px 28px 4px; }
.notes-panel { border-radius: 4px 28px 4px 28px; grid-column: 1 / -1; margin-top: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.panel h2, .dialog-form h2 { font: 600 28px/1.1 var(--display); letter-spacing: -.025em; margin: 0; }
.calendar-heading { align-items: center; }
.calendar-actions { display: flex; gap: 12px; align-items: center; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 100px; }
.segmented button { padding: 7px 12px; border: 0; border-radius: 100px; background: transparent; font-size: 12px; cursor: pointer; }
.segmented button.active { background: var(--ink); color: var(--paper); }
.button { border: 0; background: var(--coral); color: #fff; padding: 12px 18px; border-radius: 100px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 18px rgba(233,129,104,.22); }
.button:hover { transform: translateY(-1px); }
.button-small { padding: 9px 14px; font-size: 12px; }
.calendar-nav { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 20px 0 12px; }
.text-button { background: transparent; border: 0; cursor: pointer; color: var(--ink-soft); padding: 5px 8px; }
.text-button:hover { color: var(--ink); }
.today-button { font-size: 12px; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.weekday { padding: 10px 7px; text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 700; color: var(--ink-soft); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.month-day { min-height: 88px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.month-day.muted { opacity: .34; }
.date-number { display: grid; place-items: center; width: 24px; height: 24px; font-size: 11px; border-radius: 50%; margin-bottom: 4px; }
.month-day.today .date-number { background: var(--coral); color: white; font-weight: 700; }
.event-chip { display: block; width: 100%; border: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 3px; margin-top: 4px; padding: 4px 5px; font-size: 9px; cursor: pointer; color: #183229; }
.event-chip.sage { background: #cfe0d1; }
.event-chip.coral { background: #f5b7a8; }
.event-chip.gold { background: #f3d899; }
.event-chip.blue { background: #b6d7dc; }
.agenda { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.agenda-day { background: var(--panel-solid); display: grid; grid-template-columns: 100px 1fr; min-height: 72px; }
.agenda-date { padding: 17px; border-right: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); }
.agenda-date strong { display: block; font: 600 25px/1 var(--display); color: var(--ink); }
.agenda-events { padding: 12px 15px; display: grid; align-content: center; gap: 7px; }
.agenda-event { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.agenda-event::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--event-color, var(--sage)); }
.agenda-event time { color: var(--ink-soft); font-size: 11px; min-width: 46px; }
.empty-agenda { color: var(--ink-soft); font-size: 12px; }

.count-pill, .save-state { color: var(--ink-soft); font-size: 11px; border: 1px solid var(--line); border-radius: 100px; padding: 6px 9px; }
.quick-form { display: grid; grid-template-columns: 1fr 36px; gap: 8px; margin: 22px 0 14px; }
.quick-form input, .dialog-form input, .dialog-form select { width: 100%; border: 1px solid var(--line); color: var(--ink); background: transparent; border-radius: 10px; padding: 11px 12px; outline: none; }
.quick-form input:focus, .dialog-form input:focus, .dialog-form select:focus { border-color: var(--sage-dark); box-shadow: 0 0 0 3px rgba(91,127,104,.12); }
.quick-form button { border: 0; border-radius: 50%; background: var(--sage); color: #173128; font-size: 20px; cursor: pointer; }
.task-list { padding: 0; margin: 0; list-style: none; }
.task-item { display: grid; grid-template-columns: 24px 1fr 28px; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: 0; }
.task-check { appearance: none; width: 18px; height: 18px; border: 1px solid var(--sage-dark); border-radius: 50%; cursor: pointer; position: relative; }
.task-check:checked { background: var(--sage-dark); }
.task-check:checked::after { content: "✓"; color: var(--paper); position: absolute; font-size: 11px; left: 3px; top: 0; }
.task-item.done .task-text { color: var(--ink-soft); text-decoration: line-through; }
.task-text { font-size: 13px; overflow-wrap: anywhere; }
.delete-button { opacity: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 17px; transition: opacity .2s; }
.task-item:hover .delete-button, .link-tile:hover .delete-button { opacity: 1; }
.empty-state { color: var(--ink-soft); font-size: 12px; padding: 16px 0 4px; }

.links-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 22px; }
.link-tile { position: relative; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-size: 12px; transition: transform .2s, background .2s; }
.link-tile:hover { transform: translateY(-2px); background: var(--panel-solid); }
.link-icon { width: 27px; height: 27px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; color: white; background: var(--sage-dark); font-weight: 700; text-transform: uppercase; }
.link-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-tile .delete-button { position: absolute; right: 2px; top: 1px; }

.note-wrap { position: relative; margin-top: 20px; }
.note-wrap textarea { display: block; width: 100%; min-height: 190px; resize: vertical; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 22px 118px 16px 2px; color: var(--ink); font: 500 19px/1.7 var(--display); outline: none; }
.note-wrap textarea::placeholder { color: var(--ink-soft); opacity: .55; }
.dictate-button { position: absolute; top: 18px; right: 0; border: 1px solid var(--line); border-radius: 100px; padding: 9px 13px; background: transparent; color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; }
.dictate-button.listening { background: var(--coral); border-color: var(--coral); color: white; }
.mic { display: inline-block; font-size: 9px; color: var(--coral); margin-right: 5px; }
.listening .mic { color: white; animation: pulse 1s infinite; }
.dictation-hint { margin: 0; font-size: 10px; color: var(--ink-soft); }

footer { display: flex; justify-content: space-between; padding: 30px 2px 42px; color: var(--ink-soft); font-size: 10px; }
dialog { width: min(440px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 4px 28px 4px 28px; padding: 0; color: var(--ink); background: var(--panel-solid); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(14,30,25,.55); backdrop-filter: blur(4px); }
.dialog-form { padding: 28px; display: grid; gap: 18px; }
.dialog-heading { display: flex; justify-content: space-between; }
.dialog-form label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { transform: scale(1.45); opacity: .6; } }
.hero > *, .panel { animation: rise .55s both; }
.hero > :nth-child(2) { animation-delay: .08s; }
.side-stack .panel:first-child { animation-delay: .1s; }
.side-stack .panel:last-child { animation-delay: .17s; }
.notes-panel { animation-delay: .23s; }

@media (max-width: 920px) {
  .shell { width: min(100% - 30px, 760px); }
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 48px; }
  .weather-card { max-width: 520px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .notes-panel { grid-column: auto; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 520px); }
  .topbar { height: 72px; grid-template-columns: 1fr auto; }
  .topnav { display: none; }
  .hero { padding: 38px 4px 34px; }
  .hero h1 { font-size: clamp(50px, 17vw, 75px); }
  .weather-card { padding: 24px; }
  .panel { padding: 20px; }
  .calendar-panel { min-height: 0; }
  .calendar-heading { align-items: start; }
  .calendar-actions { align-items: flex-end; flex-direction: column-reverse; }
  .segmented button { padding: 6px 9px; }
  .month-day { min-height: 70px; padding: 4px; }
  .date-number { width: 20px; height: 20px; font-size: 9px; }
  .event-chip { font-size: 0; height: 5px; padding: 0; border-radius: 10px; }
  .agenda-day { grid-template-columns: 70px 1fr; }
  .agenda-date { padding: 14px 10px; }
  .notes-panel .panel-heading { align-items: center; }
  .note-wrap textarea { padding-right: 2px; padding-top: 65px; }
  .dictate-button { left: 0; right: auto; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
