:root {
  --bg: #F3F4FA;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.7);
  --surface-hover: #FAFAFE;
  --border: #E6E8F2;
  --text: #161A25;
  --text-muted: #5B6478;
  --text-faint: #9299AD;
  --accent-1: #4C4FE0;
  --accent-2: #8B5CF6;
  --accent: #4C4FE0;
  --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --accent-ink: #FFFFFF;
  --accent-soft: #EEEEFC;
  --critical: #C43D36;
  --critical-ink: #B63630;
  --critical-soft: #FCECEB;
  --critical-dot: #E1453F;
  --critical-glow: rgba(225, 69, 63, 0.4);
  --ok: #0F9268;
  --ok-ink: #0F9268;
  --ok-soft: #E7F7F1;
  --ok-dot: #17A672;
  --shadow-sm: 0 1px 2px rgba(22, 26, 37, 0.05);
  --shadow: 0 10px 30px -10px rgba(30, 34, 60, 0.16), 0 1px 2px rgba(22, 26, 37, 0.04);
  --shadow-glow: 0 10px 26px -8px rgba(76, 79, 224, 0.38);
  --radius: 14px;
  --radius-sm: 9px;
  --font-ui: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F16;
    --surface: #171B24;
    --surface-glass: rgba(23, 27, 36, 0.68);
    --surface-hover: #1E2330;
    --border: #262B38;
    --text: #ECEEF5;
    --text-muted: #9BA3B8;
    --text-faint: #626B82;
    --accent-1: #8B90F6;
    --accent-2: #B48EF8;
    --accent: #8B90F6;
    --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --accent-ink: #12131C;
    --accent-soft: #242B45;
    --critical: #FF6B62;
    --critical-ink: #FF9791;
    --critical-soft: #34211F;
    --critical-dot: #FF6B62;
    --critical-glow: rgba(255, 107, 98, 0.4);
    --ok: #37D69D;
    --ok-ink: #55E0AB;
    --ok-soft: #142E27;
    --ok-dot: #37D69D;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 14px 36px -12px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 10px 26px -8px rgba(139, 144, 246, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 420px at 18% -12%, color-mix(in srgb, var(--accent-1) 14%, transparent), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.hidden { display: none !important; }

.shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---- Login screen ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-brand .mark {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.login-field input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.login-field input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error {
  background: var(--critical-soft);
  color: var(--critical-ink);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.login-error.visible { display: block; }
.login-submit {
  width: 100%;
  appearance: none;
  border: none;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  padding: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.login-submit:disabled { opacity: 0.6; cursor: default; }
.login-note {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 16px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.beacon-led {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--critical-dot);
  flex: none;
  box-shadow: 0 0 0 0 var(--critical-glow);
}
.beacon-led::before, .beacon-led::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--critical-dot);
  opacity: 0.55;
  animation: beaconPing 2.4s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}
.beacon-led::after { animation-delay: 1.2s; }
.beacon-led.is-clear { background: var(--ok-dot); }
.beacon-led.is-clear::before, .beacon-led.is-clear::after { background: var(--ok-dot); }
@keyframes beaconPing {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}
.brand .mark {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lighthouse-mark {
  flex: none;
  transition: transform 0.25s ease;
}
.brand:hover .lighthouse-mark { transform: translateY(-1px) scale(1.04); }
.login-brand .lighthouse-mark { flex: none; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.who-am-i {
  font-size: 12.5px;
  color: var(--text-muted);
}
.who-am-i strong { color: var(--text); }
.logout-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.logout-btn:hover { border-color: var(--critical); color: var(--critical-ink); }

.summary {
  display: flex;
  gap: 10px;
}
.summary-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.summary-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.summary-chip strong { font-weight: 700; }
.summary-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.summary-chip.critical strong { color: var(--critical-ink); }
.summary-chip.ok strong { color: var(--ok-ink); }
.summary-chip .dot.critical-dot { background: var(--critical-dot); }
.summary-chip .dot.ok-dot { background: var(--ok-dot); }
.summary-chip .synced { color: var(--text-faint); }

/* ---- Tabs ---- */
.tabs {
  position: relative;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  padding: 10px 4px;
  margin-right: 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease;
}
.tab:hover { color: var(--text-muted); }
.tab.active { color: var(--text); }
.tab-indicator {
  position: absolute;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  transition: transform 0.28s cubic-bezier(0.65, 0, 0.35, 1), width 0.28s cubic-bezier(0.65, 0, 0.35, 1);
  transform: translateX(0);
  width: 0;
}

.view { display: none; }
.view.active { display: block; animation: viewIn 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.search:focus-within { border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input {
  border: none;
  background: none;
  width: 100%;
  color: var(--text);
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--text-faint); }
.search svg { flex: none; color: var(--text-faint); }

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.segmented button {
  appearance: none;
  border: none;
  background: none;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  border-right: 1px solid var(--border);
  transition: background 0.2s ease, color 0.2s ease;
}
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--accent-gradient); color: var(--accent-ink); }

select.client-filter, select.range-filter {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 30px 9px 13px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
select.client-filter:hover, select.range-filter:hover { border-color: var(--accent-1); }

/* ---- Feed list (Inbox + History) ---- */
.feed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 16px 92px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 19px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 3px 0 0 0 transparent;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-hover); transform: translateX(2px); }
.row[data-status="critical"] { box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--critical-dot) 55%, transparent); }
.row[data-status="ok"] { box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--ok-dot) 40%, transparent); }
#feed .row { grid-template-columns: 16px 92px 1fr auto auto 92px; }

.mark-done-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  justify-self: end;
  white-space: nowrap;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.mark-done-btn:hover { border-color: var(--ok-dot); color: var(--ok-ink); background: var(--ok-soft); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px transparent;
  flex: none;
}
.status-dot.critical { background: var(--critical-dot); box-shadow: 0 0 0 3px var(--critical-soft); }
.status-dot.ok { background: var(--ok-dot); box-shadow: 0 0 0 3px var(--ok-soft); }

.client-pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.headline { min-width: 0; }
.headline .subject {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.headline .sender {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.service-chip.critical { color: var(--critical-ink); background: var(--critical-soft); }
.service-chip.ok { color: var(--ok-ink); background: var(--ok-soft); }

.time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
  display: none;
}
.empty-state.visible { display: block; }

/* ---- Services / Clients shared bits ---- */
.rules-intro {
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 64ch;
  margin: 0 0 16px;
}

.add-rule-btn {
  appearance: none;
  border: none;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.add-rule-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.add-rule-btn:active { transform: translateY(0); }

.rule-form {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.rule-form.open { display: block; animation: formIn 0.24s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes formIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.rule-form h3 { margin: 0 0 4px; font-size: 15px; }
.rule-form p.hint { margin: 0 0 14px; font-size: 12.5px; color: var(--text-faint); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-grid input, .form-grid select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.form-grid input:focus, .form-grid select:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-grid input.emphasis { font-weight: 700; }
.status-radio { display: flex; gap: 8px; }
.status-radio label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.status-radio label:has(input:checked) { border-color: var(--accent-1); background: var(--accent-soft); }
.status-radio input { accent-color: var(--accent-1); margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.form-error {
  color: var(--critical-ink);
  font-size: 12.5px;
  margin-right: auto;
}
.btn-secondary {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.btn-secondary:hover { border-color: var(--text-faint); color: var(--text); }
.btn-primary {
  appearance: none;
  border: none;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
  transition: transform 0.18s ease, filter 0.18s ease;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; }

.services-list, .clients-list, .team-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.service-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.service-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.service-card[data-status="critical"] { box-shadow: var(--shadow-sm), inset 3px 0 0 0 color-mix(in srgb, var(--critical-dot) 55%, transparent); }
.service-card[data-status="critical"]:hover { box-shadow: var(--shadow), inset 3px 0 0 0 color-mix(in srgb, var(--critical-dot) 55%, transparent); }
.service-card[data-status="ok"] { box-shadow: var(--shadow-sm), inset 3px 0 0 0 color-mix(in srgb, var(--ok-dot) 40%, transparent); }
.service-card[data-status="ok"]:hover { box-shadow: var(--shadow), inset 3px 0 0 0 color-mix(in srgb, var(--ok-dot) 40%, transparent); }
.service-card summary {
  list-style: none;
  display: grid;
  grid-template-columns: 14px 1fr 76px 74px 66px 20px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px 13px 19px;
  cursor: pointer;
  transition: background 0.18s ease;
}
.service-card summary::-webkit-details-marker { display: none; }
.service-card summary:hover { background: var(--surface-hover); }

.service-name-block { min-width: 0; }
.service-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-match {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-match code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
}
.rule-scope { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.rule-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.rule-status-badge.critical { background: var(--critical-soft); color: var(--critical-ink); }
.rule-status-badge.ok { background: var(--ok-soft); color: var(--ok-ink); }

.card-actions { display: flex; gap: 4px; }
.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-faint);
  border-radius: 7px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.icon-btn:hover { color: var(--accent-1); border-color: var(--accent-1); transform: translateY(-1px); }
.icon-btn.delete-btn:hover { color: var(--critical-ink); border-color: var(--critical); }

.chevron-wrap {
  color: var(--text-faint);
  display: flex;
  transition: transform 0.24s cubic-bezier(0.65, 0, 0.35, 1);
}
.service-card[open] .chevron-wrap { transform: rotate(180deg); }

.service-detail { padding: 4px 16px 16px 42px; border-top: 1px solid var(--border); }
.service-card[open] .service-detail { animation: detailIn 0.26s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes detailIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 12px 0 8px;
}
.mini-alerts { list-style: none; margin: 0; padding: 0; }
.mini-alerts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mini-alerts li:last-child { border-bottom: none; }
.mini-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}
.link-btn {
  appearance: none;
  border: none;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 0 0;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-decoration-color: var(--accent-1); }

.client-row, .team-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1fr 1fr 118px 32px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.client-row:hover, .team-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.client-row .client-code, .team-row .team-name { font-weight: 700; }
.client-row .client-alias, .team-row .team-username {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-row .client-count { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }
.team-row { grid-template-columns: 1fr 1fr 100px auto; }
.team-row.disabled { opacity: 0.55; }
.team-row .team-actions { display: flex; gap: 4px; justify-self: end; }
.team-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; justify-self: start; }
.team-status.active { background: var(--ok-soft); color: var(--ok-ink); }
.team-status.disabled { background: var(--critical-soft); color: var(--critical-ink); }

/* ---- Settings view ---- */
.settings-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 18px;
}
.settings-section h3 { margin: 0 0 4px; font-size: 15px; }
.settings-section p.hint { margin: 0 0 16px; font-size: 12.5px; color: var(--text-faint); max-width: 60ch; }
.settings-field { display: grid; grid-template-columns: 160px 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.settings-field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.settings-field input {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
.settings-field input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings-status { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.settings-status.configured { color: var(--ok-ink); }
.settings-save-row { display: flex; justify-content: flex-end; margin-top: 8px; }

@media (max-width: 620px) {
  .row { grid-template-columns: 12px 1fr auto; grid-template-areas: "dot headline time" "dot pill service" "dot done done"; }
  .row .client-pill { grid-area: pill; }
  .row .headline { grid-area: headline; }
  .row .service-chip { grid-area: service; justify-self: start; }
  .row .time { grid-area: time; }
  .row .status-dot { grid-area: dot; }
  .row .mark-done-btn { grid-area: done; justify-self: end; margin-top: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .client-row { grid-template-columns: 1fr auto; grid-template-areas: "code count" "alias del"; row-gap: 6px; }
  .client-row .client-code { grid-area: code; }
  .client-row .client-count { grid-area: count; justify-self: end; }
  .client-row .client-alias { grid-area: alias; }
  .client-row .icon-btn { grid-area: del; justify-self: end; }
  .team-row { grid-template-columns: 1fr auto; grid-template-areas: "name status" "username actions"; row-gap: 6px; }
  .team-row .team-name { grid-area: name; }
  .team-row .team-status { grid-area: status; justify-self: end; }
  .team-row .team-username { grid-area: username; }
  .team-row .team-actions { grid-area: actions; }
  .service-card summary {
    grid-template-columns: 14px 1fr 20px;
    grid-template-areas: "dot name chevron" "dot match chevron" "actions actions actions";
  }
  .service-card summary .status-dot { grid-area: dot; }
  .service-card summary .service-name-block { grid-area: name; }
  .service-card summary .rule-scope, .service-card summary .rule-status-badge { display: none; }
  .service-card summary .card-actions { grid-area: actions; justify-self: end; margin-top: 4px; }
  .service-card summary .chevron-wrap { grid-area: chevron; }
  .service-detail { padding-left: 16px; }
  .settings-field { grid-template-columns: 1fr; }
}
