/* ---------- Design tokens ---------- */
:root {
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 16px rgb(15 23 42 / .06);
  --shadow-lg: 0 10px 30px rgb(15 23 42 / .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  color-scheme: light;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e3e8f0;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --accent-soft: rgb(91 91 214 / .12);
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --success-soft: rgb(22 163 74 / .12);
  --danger: #dc2626;
  --danger-soft: rgb(220 38 38 / .1);
  --warning: #d97706;
  --warning-soft: rgb(217 119 6 / .12);
  --image-bg: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / .45);
  --bg: #0a0e17;
  --surface: #121826;
  --surface-2: #1a2233;
  --text: #e6e9f0;
  --muted: #8b95a8;
  --border: #232c3f;
  --accent: #8b8cf8;
  --accent-2: #b48cff;
  --accent-soft: rgb(139 140 248 / .16);
  --accent-contrast: #0a0e17;
  --success: #34d399;
  --success-soft: rgb(52 211 153 / .14);
  --danger: #f87171;
  --danger-soft: rgb(248 113 113 / .14);
  --warning: #fbbf24;
  --warning-soft: rgb(251 191 36 / .14);
  --image-bg: #f8fafc;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .75rem; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }
main.container { padding-top: 1.5rem; padding-bottom: 3rem; }

.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; gap: 1.5rem; height: 100%; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px var(--accent-soft);
}
.brand-mark .icon { width: 18px; height: 18px; }
/* Official enjoy365.ch wordmark; the dark "365" is lightened in dark mode so it stays readable */
.logo { display: inline-flex; align-items: flex-end; gap: .45rem; line-height: 1; }
.logo-mark { display: block; height: 34px; width: auto; flex: none; }
.logo-enjoy { fill: #bc67ef; }
.logo-365 { fill: #462564; }
[data-theme="dark"] .logo-365 { fill: #d9c3f7; }
.logo-suffix { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; color: var(--text); padding-bottom: 1px; }
.login .logo-mark { height: 52px; }
.login .logo-suffix { font-size: 1.5rem; padding-bottom: 2px; }
.login-title { text-align: center; font-size: 1.1rem; margin: -.75rem 0 1.25rem; color: var(--muted); }
.nav { display: flex; gap: .25rem; margin-right: auto; }
.nav a {
  display: flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: .92rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav .icon { width: 18px; height: 18px; }
.top-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }

.tabbar { display: none; }

@media (max-width: 860px) {
  .nav { display: none; }
  body.has-tabbar main.container { padding-bottom: calc(var(--tabbar-h) + 2rem + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: .68rem; font-weight: 500;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .icon { width: 22px; height: 22px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; }
.section { margin-top: 2rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-title h2, .card-title h3 { margin: 0; font-size: 1rem; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } }
.stat {
  display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .82rem; }
.schedule { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .schedule { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } }
.schedule-card { display: grid; gap: .3rem; }
.schedule-title { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.schedule-time { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scan-progress { margin-bottom: 1.5rem; border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.scan-progress .card-title { flex-wrap: wrap; margin-bottom: .75rem; }
.scan-progress .status { font-size: 1rem; text-transform: none; }
.progress-phase { font-weight: 600; }
.progress-bar { height: 6px; margin: .5rem 0 .35rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s; }
.progress-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-counts { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: .6rem; font-size: .9rem; color: var(--muted); }
.progress-counts strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 40px; padding: 0 1rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, transform .05s;
  background: var(--accent); color: var(--accent-contrast);
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); filter: none; }
.btn-sm { height: 32px; padding: 0 .7rem; font-size: .82rem; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
form.inline { display: inline-flex; margin: 0; }

.theme-toggle .icon-moon, [data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-sun, [data-theme="dark"] .theme-toggle .icon-moon { display: none; }

label { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=url], input:not([type]), select {
  display: block; width: 100%; height: 42px; margin-top: .35rem; padding: 0 .85rem; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s; outline: none; appearance: none;
}
select {
  padding-right: 2.2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b95a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.check { display: flex; align-items: center; gap: .6rem; margin: .6rem 0; font-size: .95rem; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.inline-select { display: inline-flex; gap: .4rem; align-items: center; }
.inline-select select { width: auto; height: 32px; margin: 0; font-size: .85rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 600; }

.search { position: relative; flex: 1 1 280px; }
.search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { margin: 0; padding-left: 2.5rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.25rem; }
.toolbar select { width: auto; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; height: 42px; padding: 0 .9rem; margin: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .88rem;
  user-select: none; transition: background-color .15s, border-color .15s, color .15s;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 560px) {
  .toolbar select { flex: 1 1 40%; }
  .chip { flex: 1 1 40%; justify-content: center; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1.4; white-space: nowrap; vertical-align: middle;
  background: var(--surface-2); color: var(--muted);
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.good { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.solid-good { background: var(--success); color: #fff; }

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
@media (max-width: 560px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } }
.product-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.product-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.product-card.is-removed { opacity: .6; }
.product-media { position: relative; aspect-ratio: 4 / 3; background: var(--image-bg); display: grid; place-items: center; padding: .75rem; }
.product-media img { width: 100%; height: 100%; object-fit: contain; }
.product-media .placeholder { color: #cbd5e1; }
.media-badges { position: absolute; top: .6rem; left: .6rem; right: .6rem; display: flex; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.media-badges > span { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.media-badges > span:first-child { justify-content: flex-start; }
.media-badges > span:last-child { margin-left: auto; }
.media-badges .badge { background: rgb(15 23 42 / .75); color: #fff; }
.media-badges .badge.bad { background: #dc2626; }
.media-badges .badge.solid-good { background: #16a34a; }
.discount-pill {
  padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 2px 8px rgb(239 68 68 / .3);
}
.product-body { display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem 1rem; flex: 1; }
.product-brand { font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.product-name { font-weight: 600; font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-top: auto; padding-top: .35rem; }
.price-now { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-was { color: var(--muted); text-decoration: line-through; font-size: .85rem; font-variant-numeric: tabular-nums; }
.product-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--muted); }
@media (max-width: 560px) {
  .product-body { padding: .7rem .75rem .8rem; }
  .product-name { font-size: .88rem; }
  .price-now { font-size: 1.05rem; }
  .product-meta { flex-direction: column; gap: 0; }
}

.stock { display: flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--muted); }
.stock-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stock-bar span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.stock-bar.low span { background: var(--warning); }

/* ---------- Deal hero ---------- */
.deal { display: grid; grid-template-columns: 160px 1fr; gap: 1.25rem; align-items: center; }
.deal-media { aspect-ratio: 1; background: var(--image-bg); border-radius: var(--radius-sm); display: grid; place-items: center; padding: .5rem; }
.deal-media img { width: 100%; height: 100%; object-fit: contain; }
.deal-name { font-size: 1.1rem; font-weight: 700; color: var(--text); display: block; margin-bottom: .5rem; }
.countdown { display: inline-flex; align-items: center; gap: .35rem; }
@media (max-width: 560px) { .deal { grid-template-columns: 110px 1fr; gap: .9rem; } }

/* ---------- Product detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 1.5rem; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.detail-media { background: var(--image-bg); border-radius: var(--radius); aspect-ratio: 1; display: grid; place-items: center; padding: 1.25rem; border: 1px solid var(--border); }
.detail-media img { width: 100%; height: 100%; object-fit: contain; }
.detail h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.detail .price-now { font-size: 2rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.fact { padding: .75rem .9rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.fact dt { font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
.fact dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.watched-by { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .75rem; }
.coming-deal { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .75rem 0 0; padding: .5rem .75rem;
  border-radius: var(--radius-sm); background: var(--accent-soft); }
.next-deal-title { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.card > .next-deal-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.deal .rule-criteria { margin-top: .5rem; }
.upcoming-card .rule-criteria { margin-top: .5rem; }
.back { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }

.chart { position: relative; height: 300px; }
@media (max-width: 560px) { .chart { height: 230px; } }

/* ---------- Event list ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .8rem 1rem; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.event-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.event-icon.good { background: var(--success-soft); color: var(--success); }
.event-icon.bad { background: var(--danger-soft); color: var(--danger); }
.event-icon.accent { background: var(--accent-soft); color: var(--accent); }
.event-icon .icon { width: 18px; height: 18px; }
.event-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-title a { color: var(--text); }
.event-sub { font-size: .8rem; color: var(--muted); }
.event-value { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.event-value .old { color: var(--muted); text-decoration: line-through; font-size: .8rem; }
@media (max-width: 560px) {
  .list-item { grid-template-columns: auto minmax(0, 1fr); }
  .event-value { grid-column: 2; text-align: left; }
}

.tabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .85rem; font-weight: 500;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ---------- Tables (stack on mobile) ---------- */
.table-card { padding: 0; overflow: hidden; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2); padding: .7rem 1rem;
}
.table td { padding: .8rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .6rem 1rem; border-top: 1px solid var(--border); }
  .table tr:first-child { border-top: 0; }
  .table td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  .table td.td-full { display: block; text-align: left; }
  .table td.td-full::before { content: none; }
}

/* ---------- Watchlist ---------- */
.rules { display: grid; gap: .75rem; }
.rule { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.rule.is-paused { opacity: .6; }
.rule-main { flex: 1 1 260px; min-width: 0; }
.rule-name { font-weight: 600; }
.rule-criteria { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.rule-count { text-align: center; min-width: 70px; }
.rule-count strong { display: block; font-size: 1.3rem; line-height: 1.1; }
.rule-actions { display: flex; gap: .4rem; }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--success); }
.status-partial, .status-running { color: var(--warning); }
.status-running::before { animation: pulse 1.2s infinite; }
.status-failed { color: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Flash / pager / login ---------- */
.flash {
  display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; margin-bottom: 1.25rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  animation: slide-in .25s ease-out;
}
.flash .icon { color: var(--accent); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0 0; color: var(--muted); font-size: .9rem; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; margin-bottom: .5rem; opacity: .5; }

.login-wrap { min-height: calc(100vh - 4rem); display: grid; place-items: center; }
.login { width: 100%; max-width: 400px; padding: 2rem; }
.login .brand { justify-content: center; margin-bottom: 1.5rem; font-size: 1.25rem; }
.login label { margin-bottom: 1rem; }
.login .btn { width: 100%; height: 44px; margin-top: .5rem; }
.login-theme { position: fixed; top: 1rem; right: 1rem; }
.error { color: var(--danger); background: var(--danger-soft); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .9rem; }

.toolbar.htmx-request ~ #results { opacity: .5; transition: opacity .2s; }
