/* ═══════════════════════════════════════════════════════════
   Anveshan Alert Rules Panel — dark theme matching the
   campaign diagnostics report aesthetic.
   ═══════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:        #0a0f1a;
  --bg-2:      #111827;
  --bg-3:      #151d2e;
  --bg-4:      #1e293b;
  --text:      #e2e8f0;
  --text-2:    #cbd5e1;
  --muted:     #64748b;
  --muted-2:   #475569;
  --line:      #1e293b;
  --primary:   #3b82f6;
  --primary-2: #2563eb;
  --good:      #22c55e;
  --warn:      #f59e0b;
  --bad:       #ef4444;
  --info:      #3b82f6;
}

html, body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-2);
  min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ─── Top bar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 24px; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ─── Common form controls ─── */
select, input[type="text"], input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
select:focus, input:focus { border-color: var(--primary); }
select { cursor: pointer; }

/* ─── Toolbar ─── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.filters input[type="text"] { min-width: 220px; flex: 1; max-width: 340px; }

.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-2); }
.btn-secondary { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg-3); border-color: var(--muted-2); }

/* ─── Stats strip ─── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 14px 24px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.stat-card .label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card .value { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--text); margin-top: 4px; }

/* ─── Rules list ─── */
main {
  padding: 8px 24px 80px;
}

.rule-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.rule-card:hover { background: var(--bg-3); }

.rule-card.inactive { opacity: 0.5; }

.rule-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.rule-title {
  display: flex; align-items: center; gap: 10px;
  flex: 1;
  min-width: 0;
}
.rule-title .icon { font-size: 22px; line-height: 1; }
.rule-title .name { font-size: 14px; font-weight: 700; color: var(--text); }
.rule-title .desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.rule-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}

.pill {
  font-size: 10px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.pill-system   { background: rgba(148,163,184,0.10); color: #cbd5e1;  border: 1px solid rgba(148,163,184,0.25); }
.pill-custom   { background: rgba(59,130,246,0.10);  color: #93c5fd;  border: 1px solid rgba(59,130,246,0.30);  }
.pill-good     { background: rgba(34,197,94,0.10);   color: #4ade80;  border: 1px solid rgba(34,197,94,0.25);  }
.pill-bad      { background: rgba(239,68,68,0.10);   color: #fca5a5;  border: 1px solid rgba(239,68,68,0.25);  }
.pill-critical { background: rgba(239,68,68,0.18);   color: #fca5a5;  border: 1px solid rgba(239,68,68,0.40);  }
.pill-warning  { background: rgba(245,158,11,0.12);  color: #fcd34d;  border: 1px solid rgba(245,158,11,0.30); }
.pill-info     { background: rgba(59,130,246,0.10);  color: #93c5fd;  border: 1px solid rgba(59,130,246,0.25); }
.pill-mkt      { background: var(--bg);              color: var(--muted); border: 1px solid var(--line); }

.rule-conditions {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  line-height: 1.7;
}
.rule-conditions .combinator { color: var(--primary); font-weight: 600; }

.rule-action-hint {
  font-size: 12px;
  color: #93c5fd;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(59,130,246,0.06);
  border-left: 2px solid var(--primary);
  border-radius: 4px;
}

.rule-actions {
  display: flex; gap: 6px;
  flex-shrink: 0;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted-2); background: var(--bg-3); }
.icon-btn.danger:hover { color: var(--bad); border-color: rgba(239,68,68,0.4); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.rule-footer {
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 10px;
  display: flex; justify-content: space-between;
}

/* ─── Empty state ─── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 13px;
}
.empty .big { font-size: 32px; margin-bottom: 8px; }

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; font-weight: 700; color: var(--text); }
.btn-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 24px; cursor: pointer; line-height: 1;
  width: 30px; height: 30px; border-radius: 6px;
  transition: all 0.15s;
}
.btn-close:hover { background: var(--bg-3); color: var(--text); }

.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11px; font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover { border-color: var(--muted-2); }
.chip.active {
  background: rgba(59,130,246,0.15);
  color: #bfdbfe;
  border-color: var(--primary);
}

.conditions-head { display: flex; justify-content: space-between; align-items: center; }
.conditions-list { display: flex; flex-direction: column; gap: 6px; }

.condition-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}
.condition-row select, .condition-row input { font-size: 12px; padding: 6px 8px; }

.cr-main {
  display: flex;
  gap: 6px;
  align-items: center;
}
.cr-main .level-select { flex: 0 0 130px; font-size: 11px; }
.cr-main .metric-select { flex: 1 1 auto; min-width: 0; }
.cr-main .op-select     { flex: 0 0 120px; }

.cr-compare {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-left: 6px;
  border-left: 2px solid rgba(99,102,241,0.25);
}
.cr-compare .lbl { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cr-compare .ctype-select { font-size: 11px; flex: 0 0 auto; }
.cr-compare .rhs { display: flex; gap: 4px; align-items: center; flex: 1 1 auto; }
.cr-compare .rhs-num { flex: 1 1 auto; }
.cr-compare .compare-rhs select { flex: 1 1 auto; }

.condition-row .remove {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex: 0 0 28px;
}
.condition-row .remove:hover { color: var(--bad); border-color: rgba(239,68,68,0.4); }

.hint { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.hint code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; color: var(--text-2); border: 1px solid var(--line); }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* ─── Toast ─── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  min-width: 240px;
  max-width: 360px;
  animation: slide-in 0.2s ease-out;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.toast.success { border-left-color: var(--good); }
.toast.error   { border-left-color: var(--bad); }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   Auth: login screen + user block + tabs
   ═══════════════════════════════════════════════════════════ */

.login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  text-align: center;
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.login-sub    { font-size: 13px; color: var(--muted); margin-top: 4px; margin-bottom: 24px; }

.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form button { margin-top: 6px; padding: 11px; }

.login-error {
  font-size: 12px;
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 4px;
}

.login-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 22px;
  line-height: 1.6;
}
.login-hint code {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
}

/* Tabs in top bar */
.tabs-nav {
  display: flex; gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}
.tab-btn {
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { background: var(--bg-3); color: var(--text); }

/* User block (right side of top bar) */
.user-block {
  display: flex; align-items: center; gap: 12px;
}
.user-info { text-align: right; }
.user-name { font-size: 13px; color: var(--text); font-weight: 600; }
.user-role { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }

/* Default password warning banner */
.warning-banner {
  background: rgba(245,158,11,0.10);
  border-bottom: 1px solid rgba(245,158,11,0.25);
  color: #fcd34d;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
}
.warning-banner a { color: #fde68a; text-decoration: underline; font-weight: 600; }

/* Tab panels */
.tab-panel { padding-top: 6px; }

/* Team tab intro header */
.team-intro h2 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.team-intro p  { font-size: 12px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   KAMs grid
   ═══════════════════════════════════════════════════════════ */

.kams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 12px;
  padding: 8px 24px 80px;
}

.kam-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  transition: background 0.15s, border-color 0.15s;
}
.kam-card:hover { background: var(--bg-3); }
.kam-card.inactive { opacity: 0.55; }

.kam-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.kam-title { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.kam-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.kam-name { font-size: 14px; font-weight: 700; color: var(--text); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kam-sub  { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kam-sub code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; color: var(--text-2); border: 1px solid var(--line); font-size: 10px; }

.kam-actions { display: flex; gap: 6px; flex-shrink: 0; }

.kam-section { margin-top: 12px; }
.kam-section-label {
  font-size: 10px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.kam-chats { display: flex; flex-wrap: wrap; gap: 4px; }
.pill-chat  { background: rgba(34,197,94,0.08);  color: #86efac;  border: 1px solid rgba(34,197,94,0.25); }
.pill-admin { background: rgba(139,92,246,0.15); color: #c4b5fd;  border: 1px solid rgba(139,92,246,0.30); font-size: 9px; }
.pill-self  { background: rgba(59,130,246,0.15); color: #bfdbfe;  border: 1px solid rgba(59,130,246,0.30); font-size: 9px; }

.empty-inline { font-size: 11px; color: var(--muted-2); font-style: italic; }
.warn-inline  { color: #f59e0b; font-weight: 600; }

/* WhatsApp chats editor in KAM modal */
.wa-chats-list { display: flex; flex-direction: column; gap: 6px; }
.wa-chat-row {
  display: flex; gap: 6px; align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}
.wa-chat-row input { flex: 1; }
.wa-chat-row .remove {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.wa-chat-row .remove:hover { color: var(--bad); border-color: rgba(239,68,68,0.4); }

/* Disabled chip */
.chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chip.disabled:hover { border-color: var(--line); }

/* Danger variant for secondary button (used in modal footer) */
.btn-secondary.danger {
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}
.btn-secondary.danger:hover {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.5);
}

/* ═══════════════════════════════════════════════════════════
   Automation tab
   ═══════════════════════════════════════════════════════════ */

.automation-wrap { padding: 8px 24px 80px; }

.auto-tz { display: flex; align-items: flex-end; gap: 8px; }
.auto-tz .field { margin: 0; }
.auto-tz .field input { width: 160px; }

/* Per-marketplace table */
.auto-batch {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 4px;
}
.auto-batch .btn-primary, .auto-batch .btn-secondary { padding: 6px 12px; font-size: 12px; }
.auto-queue-info { font-size: 12px; color: var(--text-2); margin-left: auto; }

.auto-table-head,
.auto-row-mk {
  display: grid;
  grid-template-columns: 36px 1.2fr 1.4fr 1.2fr 1.6fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
}
.amk-select { display: flex; align-items: center; justify-content: center; }
.amk-select input { width: 15px; height: 15px; accent-color: var(--primary); }
.auto-table-head {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.auto-row-mk {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-top: 8px;
}
.auto-row-mk.is-all { border-color: rgba(59,130,246,0.4); }
.amk-name { font-size: 13px; font-weight: 600; color: var(--text); }
.amk-sched { display: flex; align-items: center; gap: 8px; }
.amk-toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.amk-toggle input { width: 15px; height: 15px; accent-color: var(--primary); }
.amk-time { width: 110px; }
.amk-actions { display: flex; gap: 8px; }
.amk-actions .btn-primary, .amk-actions .btn-secondary,
.amk-sched .btn-secondary { padding: 6px 10px; font-size: 12px; }
.amk-status { font-size: 12px; color: var(--text-2); }
.amk-status .amk-log { color: #93c5fd; margin-left: 4px; text-decoration: underline; font-size: 11px; }

.auto-output-wrap { margin-top: 18px; }
.auto-status { font-size: 12.5px; color: var(--text-2); min-height: 20px; line-height: 1.6; }
.auto-status .muted, .amk-status .muted { color: var(--muted); }
.auto-badge {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 700; margin-right: 4px;
}
.auto-badge.running { background: rgba(59,130,246,0.15); color: #93c5fd; }
.auto-badge.queued  { background: rgba(245,158,11,0.15); color: #fcd34d; }
.auto-badge.ok      { background: rgba(34,197,94,0.15);  color: #86efac; }
.auto-badge.err     { background: rgba(239,68,68,0.15);  color: #fca5a5; }

.auto-output {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

/* Reports grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 8px 24px 80px;
}
.report-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all 0.15s;
}
.report-card:hover { border-color: var(--primary); background: var(--bg-3); }
.report-open {
  display: block;
  padding: 18px;
  text-decoration: none;
  text-align: center;
}
.report-icon { font-size: 28px; }
.report-date { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 8px; }
.report-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   Responsive / mobile
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  /* Top bar wraps; tabs scroll horizontally */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .brand-sub { display: none; }
  .tabs-nav {
    order: 3; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  .tab-btn { white-space: nowrap; }

  /* Toolbars + filters stack */
  .toolbar { flex-direction: column; align-items: stretch; }
  .filters { width: 100%; }
  .filters input[type="text"] { min-width: 0; max-width: none; }
  .toolbar > .btn-primary { width: 100%; }

  .stats { grid-template-columns: repeat(2, 1fr); }

  /* Cards go single-column and lose the fixed min-width */
  .kams-grid { grid-template-columns: 1fr; padding: 8px 14px 60px; }
  .reports-grid { grid-template-columns: repeat(2, 1fr); padding: 8px 14px 60px; }
  .automation-wrap { padding: 8px 14px 60px; }
  .auto-tz { width: 100%; }
  .auto-batch { flex-wrap: wrap; }
  .auto-queue-info { margin-left: 0; width: 100%; }

  /* Automation rows become stacked cards (header row hidden) */
  .auto-table-head { display: none; }
  .auto-row-mk {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "select name"
      "sched sched"
      "actions actions"
      "status status";
    gap: 8px 10px;
  }
  .amk-select  { grid-area: select; }
  .amk-name    { grid-area: name; font-size: 14px; }
  .amk-sched   { grid-area: sched; flex-wrap: wrap; }
  .amk-actions { grid-area: actions; }
  .amk-actions .btn-primary, .amk-actions .btn-secondary { flex: 1; }
  .amk-status  { grid-area: status; padding-top: 8px; border-top: 1px solid var(--line); }

  /* Modals fill the screen */
  .modal { width: 94%; max-width: 94%; max-height: 88vh; overflow-y: auto; margin: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Rule cards: let action buttons wrap instead of overflowing */
  .rule-head { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .auto-output { font-size: 10.5px; max-height: 280px; }
  .topbar { padding: 8px 12px; }
  .brand-name { font-size: 14px; }
}
.report-del {
  position: absolute; top: 6px; right: 6px;
  background: transparent; border: none; cursor: pointer;
  font-size: 13px; opacity: 0.5; padding: 4px; border-radius: 5px;
}
.report-del:hover { opacity: 1; background: rgba(239,68,68,0.15); }

