:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #172420;
  background: #eef2ef;
  --ink: #172420;
  --muted: #52615b;
  --border: #d6dfd9;
  --surface: #fff;
  --accent: #13664e;
  --accent-hover: #0c503c;
  --soft-green: #e3f1e9;
  --warning: #754c0e;
  --soft-warning: #f8edcf;
  --error: #a12d30;
  --soft-error: #f9ebeb;
  --radius: .75rem;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.44; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--accent-hover); }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { font-size: 1.16rem; letter-spacing: -.018em; }
small { font-size: .83rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
input, select, textarea { min-width: 0; max-width: 100%; }
input:not([type=checkbox]), select, textarea {
  border: 1px solid #bfcac3;
  border-radius: .45rem;
  background-color: #fff;
  padding: .48rem .62rem;
  width: 100%;
  min-height: 2.5rem;
}
select {
  appearance: none;
  padding-right: 1.8rem;
  background-image: linear-gradient(45deg,transparent 50%,#50625a 50%), linear-gradient(135deg,#50625a 50%,transparent 50%);
  background-position: calc(100% - 13px) 53%, calc(100% - 8px) 53%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
textarea { resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); width: 1rem; height: 1rem; flex: 0 0 auto; }
:focus-visible { outline: 2px solid #24745c; outline-offset: 3px; }
::selection { background: #c4e8d5; color: var(--ink); }

.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.muted, .subtitle { color: var(--muted); }
.subtitle { margin-top: .48rem; }
.separator { color: var(--muted); padding: 0 .25em; }
.button {
  align-items: center;
  background: #fff;
  border: 1px solid #bfcac3;
  border-radius: .45rem;
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  min-height: 2.5rem;
  padding: .45rem .75rem;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { background: #f0f5f2; color: var(--ink); }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { color: var(--error); }
.button.danger:hover { background: var(--soft-error); }
.button.small { min-height: 2.25rem; padding: .32rem .55rem; font-size: .87rem; }
.field { display: grid; gap: .28rem; align-content: start; font-size: .9rem; min-width: 0; }
.field > :is(input, select, textarea) { font-size: .95rem; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; }
.stack { display: grid; gap: .95rem; }
.stack .button { justify-self: start; }
.stack.compact { gap: .55rem; }
.fields { display: flex; gap: .6rem; }
.fields > * { flex: 1; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: .45rem;
  padding: .28rem .52rem;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.badge.good { color: #12523d; background: var(--soft-green); }
.badge.neutral { color: #3f5049; background: #edf1ee; }
.badge.warn { color: var(--warning); background: var(--soft-warning); }
.notice { margin-bottom: 1rem; border-radius: .5rem; padding: .7rem .85rem; }
.notice.error { background: var(--soft-error); color: var(--error); }
.notice.success { background: var(--soft-green); color: var(--accent-hover); }
.status-dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; flex: none; }

.topbar { background: #17372d; color: #eef7f1; }
.top-inner { max-width: 99rem; margin: auto; padding: 0 clamp(1rem, 3.4vw, 3.15rem); display: flex; align-items: center; gap: clamp(1rem, 4vw, 3rem); min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; font-size: 1.1rem; font-weight: 720; letter-spacing: -.025em; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand-icon { display: inline-flex; align-items: end; gap: 3px; border-radius: .45rem; background: #d9f2e4; color: #17674d; padding: .46rem; }
.brand-icon i { width: 3px; height: 6px; background: currentColor; border-radius: 1px; }
.brand-icon i:nth-child(2) { height: 9px; }
.brand-icon i:nth-child(3) { height: 12px; }
.tabs { display: flex; align-items: stretch; align-self: stretch; gap: .25rem; font-size: .93rem; }
.tabs a { color: #dbe8e0; border-bottom: 2px solid transparent; display: flex; align-items: center; padding: .48rem .6rem; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: #fff; background: #25473b; }
.tabs a[aria-current=page] { color: #fff; border-color: #a7e2c5; font-weight: 650; }
.logout { margin-left: auto; }
.button.quiet { color: #edf7f0; background: transparent; border-color: #688376; min-height: 2.25rem; font-size: .88rem; }
.button.quiet:hover { color: #fff; background: #25473b; }
.topbar :focus-visible { outline-color: #e1f4e9; }
.shell { max-width: 99rem; margin: auto; padding: clamp(1.25rem, 3.3vw, 3rem) clamp(1rem, 3.4vw, 3.15rem) 3rem; }
.heading { display: flex; justify-content: space-between; align-items: start; gap: .75rem; margin-bottom: 1.25rem; }
.monitor-status { text-decoration: none; margin-top: .15rem; min-height: 1.85rem; padding-inline: .65rem; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.padded { padding: 1.15rem; }
.panel-head, .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.panel-head { padding: 1rem; border-bottom: 1px solid var(--border); }
.panel-head a, .section-head a { font-size: .89rem; }
.padded h2 + form, .padded .section-head + form { margin-top: 1rem; }
.section-stack { display: grid; gap: 1rem; }
.catalog-layout { display: grid; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 1fr); align-items: start; gap: 1rem; }
.sticky-card, .category-panel { position: sticky; top: .75rem; }
.category-nav { padding: .35rem; max-height: min(70vh, 48rem); overflow-y: auto; }
.category-search { margin: .2rem .35rem .45rem; }
.category-search input { min-height: 2.15rem; }
.category-nav a { display: flex; justify-content: space-between; align-items: flex-start; gap: .35rem; padding: .48rem .52rem; text-decoration: none; color: var(--ink); border-radius: .4rem; font-size: .92rem; }
.category-nav .tree-group > summary { color: var(--muted); padding-left: .45rem; }
.category-nav .tree-group > summary a { display: inline-flex; width: calc(100% - 1.15rem); vertical-align: middle; padding-left: .25rem; }
.tree-children { border-left: 1px solid var(--border); margin-left: .8rem; padding-left: .2rem; }
.empty-category-search { padding: .4rem; font-size: .9rem; }
.category-nav a:hover, .category-nav a[aria-current] { background: var(--soft-green); }
.category-nav small { color: var(--muted); font-variant-numeric: tabular-nums; }
.category-nav span, .tree-name { overflow-wrap: anywhere; min-width: 0; }
.tree-step { display: inline-block; width: .55rem; margin-right: .18rem; border-bottom: 1px solid #b8cdc0; transform: translateY(-.22em); }

.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem; padding: 1rem; }
.toolbar .field { flex: 1; min-width: 7rem; }
.toolbar .search-field { flex: 1.65; min-width: 12rem; }
.toolbar .field:has([name=sort]) { flex: 1.28; min-width: 10rem; }
.toolbar .field:has([name=currency]) { flex: .6; min-width: 5.5rem; }
.filter-note { margin: 0 1rem .7rem; font-size: .9rem; color: var(--muted); }
.filter-note a { margin-left: .35rem; }
.move-offer { margin: 0 1rem 1rem; padding: .75rem; border: 1px solid #bfcac3; border-radius: .5rem; background: #f2f7f4; }
.move-offer form { margin-top: .65rem; }
.move-offer .source-form .field { max-width: 28rem; }
.table-wrap { overflow-x: auto; width: 100%; }
.offers-table { border-collapse: collapse; width: 100%; text-align: left; font-size: .93rem; }
.offers-table th { padding: .65rem .65rem; color: #354a40; background: #ebf1ed; text-align: left; font-weight: 650; white-space: nowrap; font-size: .84rem; }
.offers-table td { border-top: 1px solid #e5ebe7; padding: .75rem .65rem; vertical-align: top; }
.offers-table :is(td, th):first-child { padding-left: 1rem; }
.offers-table :is(td, th):last-child { padding-right: 1rem; }
.offers-table tr:hover td { background: #f8fbf9; }
.offers-table th small { font-size: .75rem; color: var(--muted); }
.offers-table td small { color: var(--muted); display: block; margin-top: .18rem; }
.offers-table .price-cell small { display: inline; }
.offers-table td.inactive, .offers-table tr.inactive td { color: var(--muted); }
.offer-name { min-width: 12rem; overflow-wrap: anywhere; }
.offer-name a, .offer-name strong { font-weight: 640; }
.offer-name .badge { margin-top: .35rem; }
.source-cell { overflow-wrap: anywhere; max-width: 12rem; }
.price-cell, .date-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions summary, .delete-panel summary { color: var(--accent); white-space: nowrap; }
.row-actions details[open] { min-width: 11rem; }
.row-actions details > :is(a, form, dl) { display: block; margin-top: .65rem; }
.row-actions details .stack { display: grid; }
.metadata { font-size: .84rem; max-width: 15rem; }
.metadata dt { color: var(--muted); }
.metadata dd { overflow-wrap: anywhere; margin-bottom: .32rem; }
.empty { padding: 2rem 1rem; display: grid; justify-items: center; gap: .35rem; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); }
.pagination { display: flex; align-items: center; justify-content: center; gap: .85rem; padding: .75rem; border-top: 1px solid var(--border); }
.pagination span { color: var(--muted); font-size: .9rem; }

.category-list, .subscription-list { padding-inline: 1rem; }
.category-entry + .category-entry, .subscription-entry + .subscription-entry { border-top: 1px solid #e5ebe7; }
.entry-main, .subscription-entry { display: flex; justify-content: space-between; align-items: center; gap: .55rem; padding: .65rem 0; }
.tree-name small { display: inline-block; margin-left: .45rem; color: var(--muted); }
.manage { display: inline-block; margin-bottom: .65rem; font-size: .9rem; }
.delete-panel { margin-top: 1.2rem; }
.delete-panel form { margin-top: .65rem; }
.danger-zone { border-radius: .5rem; background: #fcf6f5; padding: .7rem; }
.subscription-entry strong, .subscription-entry small { display: block; overflow-wrap: anywhere; }
.entry-actions, .subscription-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.subscription-filters { margin-top: .35rem; }
.subscription-form { margin-top: 1rem; }
.rule-list { margin-top: .75rem; }
.rule { display: grid; grid-template-columns: minmax(0,1fr) minmax(7rem,.7fr) auto; gap: .55rem; align-items: center; border-top: 1px solid var(--border); padding: .65rem 0; }
.rule small { display: block; overflow-wrap: anywhere; }
.overview { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.source-list { display: grid; gap: .5rem; }
.source-card summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(9rem,.45fr) minmax(11rem,.48fr); align-items: center; gap: .55rem; padding: .8rem 1rem; min-height: 3.35rem; }
.source-card summary strong { color: var(--accent); overflow-wrap: anywhere; }
.source-card summary strong::before { content: "＋"; display: inline-block; width: 1.25rem; }
.source-card[open] summary strong::before { content: "−"; }
.source-card summary small { margin-left: .4rem; }
.source-card summary .badge { justify-self: end; }
.source-last small { display: block; margin-left: 0 !important; }
.source-body { display: grid; gap: .65rem; padding: .8rem 1rem 1rem; border-top: 1px solid var(--border); }
.source-reason { color: var(--muted); overflow-wrap: anywhere; }
.source-times { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.source-times dt, .delivery dt { color: var(--muted); font-size: .88rem; }
.source-times dd, .delivery dd { font-variant-numeric: tabular-nums; }
.source-form { display: flex; gap: .65rem; flex-wrap: wrap; align-items: end; }
.source-form .field { flex: 1 1 10rem; max-width: 14rem; }
.source-form .check { min-height: 2.5rem; }
.account-card > p + form, .account-card > div + form { margin-top: .75rem; }
.account-card img { width: min(100%, 16rem); display: block; margin-top: .75rem; image-rendering: pixelated; }
.delivery { display: grid; gap: .6rem; margin-top: .8rem; }
.delivery + .notice { margin: .75rem 0 0; }

.login-shell { min-height: 100svh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(100%, 26rem); padding: clamp(1.2rem, 6vw, 2rem); }
.login-card h1 { font-size: 2rem; margin: 1.25rem 0; }
.login-card .button { justify-self: stretch; }

@media (max-width: 70rem) {
  .catalog-layout { grid-template-columns: minmax(10.5rem, 12rem) minmax(0, 1fr); }
  .top-inner { gap: .8rem; }
}
@media (max-width: 57rem) {
  .top-inner { flex-wrap: wrap; padding-top: .65rem; gap: .35rem .6rem; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .catalog-layout, .two-columns { grid-template-columns: minmax(0,1fr); }
  .category-panel, .sticky-card { position: static; }
  .category-nav { max-height: 13rem; }
  .offer-name { min-width: 10rem; }
}
@media (max-width: 41rem) {
  .shell { padding-inline: .7rem; }
  .heading { align-items: center; }
  .monitor-status { max-width: 8.8rem; font-size: .77rem; }
  .tabs { justify-content: space-between; flex-wrap: wrap; overflow: visible; gap: 0 .3rem; font-size: .83rem; }
  .tabs a { padding-inline: .2rem; }
  .toolbar { gap: .45rem; padding: .75rem; }
  .toolbar .search-field { min-width: 100%; }
  .toolbar .field:has([name=source]) { max-width: 55%; }
  .offers-table, .offers-table tbody { display: block; }
  .offers-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .offers-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid var(--border); padding: .6rem .75rem; gap: .55rem .65rem; }
  .offers-table td { display: block; padding: 0 !important; border: 0; font-size: .9rem; }
  .offers-table td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); }
  .offers-table .offer-name, .row-actions { grid-column: 1 / -1; }
  .offers-table .offer-name::before { display: none !important; }
  .offers-table .source-cell { max-width: none; }
  .row-actions details[open] { max-width: 100%; }
  .row-actions details .stack { max-width: 100%; }
  .subscription-entry, .overview { align-items: flex-start; flex-direction: column; }
  .source-card summary { grid-template-columns: minmax(0,1fr) minmax(0,.8fr); }
  .source-card summary .source-last { display: none; }
  .source-card summary small { display: block; margin-left: 1.25rem; }
  .rule { grid-template-columns: minmax(0, 1fr) auto; }
  .rule > div { grid-column: 1 / -1; }
}
