:root {
  --ink: #111814;
  --muted: #56625b;
  --paper: #c9cec8;
  --card: #e7e9e4;
  --line: #89928b;
  --green: #174d39;
  --green-2: #c5d6ca;
  --lime: #c5d878;
  --amber: #c07a2c;
  --red: #ad4139;
  --blue: #416d80;
  --shadow: 0 3px 0 rgba(23, 34, 29, .14);
  --radius: 4px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }
img { max-width: 100%; }
code { font-size: .86em; overflow-wrap: anywhere; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  min-height: 70px;
  padding: 10px clamp(18px, 4vw, 60px);
  background: rgba(201, 206, 200, .97);
  border-bottom: 2px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 3px; background: var(--green); color: white; font-family: Georgia, serif; }
.brand-mark.large { width: 56px; height: 56px; margin-bottom: 20px; font-size: 28px; }
nav { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
nav a { padding: 10px 9px; color: #39443e; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; border-radius: 2px; }
nav a:hover, nav a:focus-visible { background: var(--green-2); color: var(--green); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions form { margin: 0; }
.notification-link { position: relative; padding: 10px 5px; font-size: 14px; font-weight: 700; text-decoration: none; }
.badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--red); color: white; font-size: 11px; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 24px clamp(18px, 4vw, 60px) 80px; }
.login-main { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: min(430px, 100%); padding: clamp(28px, 7vw, 48px); background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card h1 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: clamp(34px, 7vw, 46px); font-weight: 500; letter-spacing: -.03em; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 16px; }
.page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 3.4vw, 46px); font-weight: 500; line-height: 1; letter-spacing: -.035em; }
.page-heading p { margin: 0; }
.dashboard-heading { min-height: 0; }
.today-title { display: flex; align-items: baseline; gap: 13px; }
.today-title span { color: var(--muted); font-size: 13px; font-weight: 700; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.hero-stat { display: flex; align-items: baseline; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 3px; background: rgba(255, 253, 248, .68); white-space: nowrap; }
.hero-stat strong { font-family: Georgia, serif; font-size: 21px; }
.hero-stat span { color: var(--muted); font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 10px; }
.dashboard-grid .card { padding: 14px; }
.dashboard-grid .card-heading { margin-bottom: 8px; }
.dashboard-grid .card-heading .eyebrow, .dashboard-grid > .metric-card > .eyebrow { margin: 0 0 2px; }
.dashboard-grid .card h2 { font-size: 20px; }
.dashboard-grid .list-row { gap: 8px; padding: 8px 0; }
.dashboard-grid .empty-state { margin-top: 5px; padding: 12px 8px; }
.dashboard-grid .condition { padding: 7px 0; }
.dashboard-grid .condition strong { font-size: 30px; }
.dashboard-grid .small-text { margin: 4px 0 0; }
.dashboard-grid .metric-card { min-height: 108px; }
.dashboard-grid .metric-card .big-number { margin: 0; font-size: 46px; }
.dashboard-grid .video-thumb { max-height: 110px; margin-bottom: 7px; }
.card { min-width: 0; padding: 24px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.span-2 { grid-column: span 2; }
.card h2 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 24px; font-weight: 550; letter-spacing: -.02em; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card p { line-height: 1.55; }
.attention-card { background: var(--green); color: white; border-color: var(--green); }
.attention-card a, .attention-card .eyebrow { color: var(--lime); }
.attention-card .list-row { color: white; border-color: rgba(255,255,255,.16); }
.attention-card .list-row small, .attention-card .list-row time { color: #cddbd4; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.card-heading > a, .card-heading > span { font-size: 13px; font-weight: 700; }
.item-list { display: grid; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 13px 0; color: var(--ink); border-top: 1px solid var(--line); text-decoration: none; }
.list-row:first-child { border-top: 0; }
.list-row span { min-width: 0; }
.list-row strong, .list-row small { display: block; }
.list-row strong { overflow: hidden; text-overflow: ellipsis; }
.list-row small, .list-row time { margin-top: 3px; color: var(--muted); font-size: 12px; }
.list-row time { white-space: nowrap; }
.compact .list-row { grid-template-columns: auto minmax(0, 1fr); }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }
.status-dot.attention, .status-dot.awaiting_authorization, .status-dot.sending { background: var(--amber); }
.status-dot.error, .status-dot.unavailable, .status-dot.failed { background: var(--red); }
.status-dot.healthy, .status-dot.configured, .status-dot.sent { background: #3c9463; }
.status-dot.unsupported, .status-dot.unconfigured, .status-dot.paused { background: #9a9d96; }
.date-chip { display: grid; place-items: center; min-width: 52px; min-height: 38px; padding: 4px 8px; border-radius: 9px; background: var(--green-2); color: var(--green); font-size: 11px; font-weight: 800; }
.status-pill, .category { display: inline-flex; align-items: center; width: fit-content; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #e7ece9; color: #435047; font-size: 11px; font-weight: 800; text-transform: capitalize; white-space: nowrap; }
.status-pill.delayed, .status-pill.exception, .status-pill.error, .status-pill.failed, .status-pill.unavailable { background: #f4dedb; color: #923a34; }
.status-pill.delivered, .status-pill.healthy, .status-pill.sent, .status-pill.completed { background: var(--green-2); color: var(--green); }
.status-pill.unsupported, .status-pill.unconfigured, .status-pill.paused, .status-pill.seasonal { background: #ecebe5; color: #686c67; }
.checkbox-visual { width: 20px; height: 20px; border: 2px solid #9ba49e; border-radius: 6px; }
.trend-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-2); color: var(--green); }
.empty-state { margin: 10px 0 0; padding: 28px 14px; color: var(--muted); text-align: center; background: rgba(245, 243, 236, .65); border-radius: 12px; }
.metric-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 190px; color: var(--ink); text-decoration: none; background: var(--lime); }
.metric-card .big-number { margin: 2px 0; font-family: Georgia, serif; font-size: 72px; line-height: .9; font-weight: 500; }
.metric-card span { color: #52613d; }
.metric-card.pale { background: #e5ebd8; }
.metric-card.neutral { background: #e8e1d4; }
.condition { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 18px 0; }
.condition strong { font-family: Georgia, serif; font-size: 40px; font-weight: 500; }
.condition span { color: var(--muted); font-size: 13px; }
.small-text { font-size: 13px; }
.video-thumb { aspect-ratio: 16/9; width: 100%; margin: 2px 0 12px; object-fit: cover; border-radius: 11px; }
.video-title { display: block; font-weight: 750; }

.split-layout { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.6fr); align-items: start; gap: 20px; }
.form-card { position: sticky; top: 90px; }
.stack { display: grid; gap: 20px; min-width: 0; }
.stack-form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #39443e; font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 46px; padding: 11px 12px; color: var(--ink); background: #f4f5f1; border: 2px solid #8f9991; border-radius: 3px; outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,93,69,.13); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.check-row input { width: 20px; min-height: 20px; }
.hint { color: var(--muted); font-size: 11px; font-weight: 500; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 2px solid transparent; border-radius: 3px; font-weight: 750; text-decoration: none; }
.button.primary { background: var(--green); color: white; }
.button.secondary { background: var(--green-2); color: var(--green); border-color: #bfd1c4; }
.button.ghost { background: transparent; color: var(--green); border-color: var(--line); }
.button.danger { color: var(--red); }
.button.small { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.icon-button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 25px; }
hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }

.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 18px; padding: 20px 0; border-top: 1px solid var(--line); }
.timeline-item:first-child { border-top: 0; }
.timeline-date strong, .timeline-date span { display: block; }
.timeline-date span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.timeline-item p { margin: 4px 0; color: var(--muted); }
.task-list, .shopping-list, .package-list, .monitor-list, .notification-list { display: grid; }
.task-row, .package-row, .monitor-row, .notification-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.task-row:first-child, .package-row:first-child, .monitor-row:first-child, .notification-row:first-child { border-top: 0; }
.task-row > div, .package-row > div, .monitor-row > div, .notification-row > div { min-width: 0; }
.task-row p, .package-row p, .monitor-row p, .notification-row p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.task-row small, .package-row small, .monitor-row small, .notification-row small { color: var(--muted); }
.monitor-main { flex: 1; }
.compact-monitor { align-items: start; padding: 11px 0; }
.monitor-title-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.monitor-title-line h3 { margin: 0; font-size: 15px; }
.monitor-title-line h3 a { color: var(--ink); text-decoration: none; }
.monitor-title-line h3 a:hover { color: var(--green); }
.monitor-current { font-size: 13px; white-space: nowrap; }
.monitor-meta { display: block; margin: 3px 0 0 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-tools { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr); align-items: start; gap: 10px; margin: 5px 0 0 17px; font-size: 12px; }
.monitor-tools > a, .monitor-tools > details > summary { color: var(--green); font-size: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.monitor-tools > details[open] { grid-column: 1 / -1; width: 100%; }
.live-status { margin: 3px 0 0; color: var(--green); font-size: 12px; font-weight: 700; }
.live-status.error-text { color: var(--red); }
.price-history { margin: 0; }
.price-history > summary { width: fit-content; color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.price-history .table-wrap { margin-top: 8px; border: 1px solid var(--line); background: #e5e8e2; }
.price-history table { min-width: 480px; }
.price-history th, .price-history td { padding: 9px 10px; }
.price-chart { min-height: 150px; margin-top: 9px; padding: 8px; background: #dfe3dc; border: 1px solid var(--line); }
.price-chart svg { display: block; width: 100%; height: auto; max-height: 190px; }
.chart-grid-line { stroke: #aab2ab; stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-price-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: square; stroke-linejoin: miter; }
.chart-price-point { fill: var(--lime); stroke: var(--green); stroke-width: 2; }
.task-row.overdue { border-left: 3px solid var(--red); padding-left: 14px; }
.pending-confirmation { border-left: 3px solid var(--amber); padding-left: 14px; }
.shopping-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; min-height: 44px; padding: 4px 0; border-top: 1px solid var(--line); }
.shopping-row:first-child { border-top: 0; }
.shopping-row strong, .shopping-row small { display: block; }
.shopping-row small { color: var(--muted); }
.shopping-row.checked span { opacity: .55; text-decoration: line-through; }
.shopping-row > span { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; }
.shopping-row > span > strong, .shopping-row > span > small { grid-column: 1; }
.shopping-row > span > .button-row { grid-column: 2; grid-row: 1 / 3; }
.shopping-row > span > .inline-edit-panel { grid-column: 1 / -1; }
.check-button { width: 28px; min-height: 28px; padding: 0; color: white; background: transparent; border: 2px solid #737d76; border-radius: 2px; }
.checked .check-button { background: var(--green); border-color: var(--green); }
.archive summary { display: flex; justify-content: space-between; cursor: pointer; font-family: Georgia, serif; font-size: 21px; font-weight: 600; }
.archive[open] summary { margin-bottom: 15px; }
.inline-edit { margin: 0; }
.inline-edit summary { width: fit-content; color: var(--green); font-size: 12px; font-weight: 750; cursor: pointer; }
.inline-edit .stack-form, .inline-edit-panel { margin-top: 10px; padding: 13px; background: var(--paper); border-radius: 10px; }
.inline-edit-panel { display: grid; gap: 9px; }
.inline-edit-panel[hidden] { display: none; }

.health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.health-card dl { display: grid; gap: 8px; margin: 18px 0; }
.health-card dl div { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 10px; }
.health-card dt { color: var(--muted); font-size: 12px; }
.health-card dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.lower-section { margin-top: 20px; grid-template-columns: 1.25fr .75fr; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.notification-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.notification-row.read { opacity: .55; }

.calendar-layout { display: grid; gap: 20px; }
.calendar-card { overflow: hidden; }
.calendar-toolbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 18px; }
.calendar-toolbar h2 { text-align: center; }
.month-calendar { display: grid; grid-template-columns: 58px repeat(7, minmax(90px, 1fr)); border-top: 2px solid var(--line); border-left: 2px solid var(--line); overflow-x: auto; }
.calendar-head, .calendar-week, .calendar-day { border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.calendar-head { padding: 9px 6px; color: var(--muted); background: #d4d8d2; font-size: 12px; font-weight: 800; text-align: center; }
.calendar-week { display: grid; place-items: start center; min-height: 112px; padding-top: 12px; color: var(--muted); background: #d4d8d2; font-size: 12px; font-weight: 800; }
.calendar-day { min-height: 112px; padding: 7px; background: #eef0eb; }
.calendar-day > time { display: inline-grid; place-items: center; width: 27px; height: 27px; font-weight: 800; }
.calendar-day.outside-month { color: #858d87; background: #daddd8; }
.calendar-day.today > time { color: white; background: var(--green); }
.day-events { display: grid; gap: 4px; margin-top: 4px; }
.calendar-event { min-width: 0; padding: 4px 5px; color: #102019; background: var(--green-2); border-left: 3px solid var(--green); font-size: 11px; line-height: 1.25; }
.calendar-event strong, .calendar-event small { display: block; overflow: hidden; text-overflow: ellipsis; }
.calendar-lower { grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); }
.saved-search-list { display: grid; }
.saved-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.saved-search-row:first-child { border-top: 0; }
.saved-search-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 8px; min-width: 0; }
.saved-search-summary h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-search-summary small { grid-column: 2; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-search-actions { justify-content: flex-end; }
.saved-search-edit[open] { grid-column: 1 / -1; width: min(620px, 80vw); }
.saved-search-edit .stack-form { position: absolute; z-index: 5; right: clamp(18px, 4vw, 60px); width: min(620px, calc(100vw - 36px)); box-shadow: var(--shadow); }
.listing-grid { display: grid; gap: 5px; }
.listing-result { display: grid; gap: 3px; padding: 9px 10px; color: var(--ink); background: #eef0eb; border: 1px solid var(--line); text-decoration: none; }
.listing-result:hover { border-color: var(--green); }
.listing-result small { color: var(--muted); }
.listing-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; }
.listing-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listing-title b { white-space: nowrap; }
.compact-listing .category { min-height: 19px; padding: 1px 6px; font-size: 9px; }
.listing-time { font-size: 10px; }

.flash-stack { position: fixed; z-index: 20; top: 82px; right: 22px; display: grid; gap: 8px; width: min(430px, calc(100vw - 36px)); }
.flash { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 13px 12px 13px 16px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 4px; box-shadow: var(--shadow); }
.flash.error { border-left-color: var(--red); }
.flash.success { border-left-color: #3c9463; }
.flash-close { width: 30px; min-height: 30px; margin-top: -5px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; font-size: 22px; line-height: 1; }
.flash-close:hover, .flash-close:focus-visible { color: var(--ink); border-color: var(--line); }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: auto 1fr; }
  nav { grid-column: 1 / -1; grid-row: 2; }
  .top-actions { grid-column: 2; grid-row: 1; justify-self: end; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { position: static; gap: 6px 12px; padding: 10px 16px 5px; }
  .brand span:last-child { display: none; }
  .top-actions .button { min-width: 44px; font-size: 0; }
  .top-actions .button::after { content: "↗"; font-size: 16px; }
  nav { margin: 0 -16px; padding: 4px 16px 6px; }
  main { padding: 26px 16px 60px; }
  .page-heading { min-height: 0; align-items: flex-start; flex-direction: row; margin-bottom: 14px; }
  .today-title { flex-wrap: wrap; gap: 4px 10px; }
  .hero-stat { padding: 11px 16px; }
  .dashboard-grid, .health-grid { grid-template-columns: 1fr; }
  .card.span-2 { grid-column: auto; }
  .split-layout, .lower-section { grid-template-columns: 1fr; }
  .calendar-lower { grid-template-columns: 1fr; }
  .saved-search-row { grid-template-columns: 1fr; }
  .saved-search-actions { justify-content: flex-start; }
  .saved-search-edit .stack-form { right: 18px; }
  .calendar-card { overflow-x: auto; }
  .month-calendar { min-width: 760px; }
  .form-card { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 82px minmax(0, 1fr) auto; gap: 10px; }
  .task-row, .package-row, .monitor-row { align-items: flex-start; flex-direction: column; }
  .notification-row { grid-template-columns: auto minmax(0, 1fr); }
  .notification-row > .button-row { grid-column: 2; }
}

@media (max-width: 400px) {
  .card { padding: 19px 16px; }
  .list-row { grid-template-columns: auto minmax(0, 1fr); }
  .list-row time { grid-column: 2; }
  .timeline-item { grid-template-columns: 1fr auto; }
  .timeline-date { grid-column: 1; }
  .timeline-item > div:nth-child(2) { grid-column: 1; }
  .timeline-item > form { grid-column: 2; grid-row: 1; }
  .condition { align-items: flex-start; flex-direction: column; }
}
