/* ============================================
   PAGES: System Information
   ============================================ */

/* 2-column grid: left 2fr, right 1fr */
.sys-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: start;
}

.sys-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.sys-notif-card {
  align-self: flex-start;
  /* Height is set by JS (_syncNotifCardHeight) to match the Subscription card's
     bottom; flex column lets the list fill the middle and the footer stay pinned. */
  display: flex;
  flex-direction: column;
}

/* ========= Info rows ========= */
.sys-rows {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.sys-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* The VALUE side of every row inherits this. It has to be stated, because the
     dashboard never sets a font-size on body (checked across all 32 stylesheets
     index.html loads) — so an unstyled value span fell back to the browser default
     16px while the label beside it was 12.5px, which is why "$39/mo" read as much
     larger than "Billing". The mockup only looked right because its own body was
     14px; 14px is that same inherited size, now made explicit. */
  font-size: 14px;
}

.sys-label {
  font-size: 12.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ========= Section eyebrow ========= */
.sys-eyebrow {
  font: 600 11px/1 var(--font-sans, Inter, sans-serif);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sys-eyebrow i { font-size: 11px; }

/* ========= Divider ========= */
.sys-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ========= Usage meters =========
   Replaces four bare "3 / 5" strings. The quota question a user actually asks is
   "how close am I?", and a bar answers it before the number is read. The fill colour
   is set by JS from the same thresholds the storage row already used (70% / 90%). */
.meter { display: block; }
.meter + .meter { margin-top: 15px; }

.meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.meter-name {
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}

.meter-name i {
  width: 13px;
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Two weights, not one. "2 / 5" set in a single colour makes the reader parse the
   whole string to find the figure that changes; the used side is the measurement and
   the cap is context, so the cap steps back to --text-dim. */
.meter-val {
  font-size: 12.5px;
  /* Same reason: with the inherited 1.6 the 12.5px value built a ~20px line box, and
     .meter-top aligns on the baseline, so the extra height pushed the bar further from
     its label than the design has it. */
  line-height: 1;
  font-weight: 500;
  color: var(--text);
}

.meter-val b    { font-weight: 600; color: var(--text); }
.meter-val span { font-weight: 400; color: var(--text-dim); }

/* Caption belonging to the bar above it — what makes up the total. One line, quieter
   and tighter than a .sys-row, so it reads as part of the meter instead of as another
   row of the card. */
.meter-sub {
  margin-top: 5px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.meter-track {
  height: 6px;
  border-radius: var(--radius-full, 999px);
  /* Explicit in both themes — a track defined only for dark is invisible on white. */
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

/* min-width is set inline by _setMeter() only when usage > 0: 0.10 MB against a 2 GB
   cap is 0.005%, which rounds to zero rendered pixels and reads as "no bar at all"
   rather than as "barely any". The floor says non-zero; the figure above it says how
   much. */
.meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: var(--radius-full, 999px);
  background: var(--color-success);
  transition: width 0.4s ease, background 0.2s;
}

.meter-fill.warn { background: var(--color-warning); }
.meter-fill.err  { background: var(--color-danger); }

/* ========= SMTP detected line =========
   Was three boxes labelled "auto-detected" that were hardcoded to Gmail and never
   changed. The server derives these from the sender's domain now, so one honest
   read-only line replaces three fake inputs. */
.smtp-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-0, #0A0D14);
  border: 1px solid var(--border);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11.5px;
  color: var(--text-dim);
}

.smtp-line i { color: var(--color-success); }
.smtp-line code { color: var(--text); font-family: inherit; }

/* ========= Per-event email toggles ========= */
.ev-group { margin-top: 18px; }

.ev-group-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 9px;
}

.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.ev {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-0, #0A0D14);
  cursor: pointer;
}

.ev:hover { border-color: var(--color-gray-300, rgba(255,255,255,0.14)); }

.ev-txt { flex: 1; min-width: 0; }
.ev-name { display: block; font-size: 12.5px; color: var(--text); }
.ev-hint { display: block; font-size: 10.5px; color: var(--color-text-muted); margin-top: 1px; }

/* An event that is off should read as off without having to look at the switch. */
.ev.off .ev-name { color: var(--text-dim); }

/* Semantic colour for these 14 switches specifically.
   The shared component paints a checked track with --color-primary, which is plain
   white in dark and near-black in light — carrying no meaning, and (before the
   dark-theme fix) hiding its own thumb. "This alert is ON" is a success state, so it
   gets the success token, and ON vs OFF is then legible at a glance across a grid
   rather than one switch at a time. Both themes are defined; neither inherits. */
.ev .toggle-switch-small input:checked + .toggle-slider-small {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

.ev .toggle-switch-small input:checked + .toggle-slider-small:before {
  background-color: #08130c;
}

html[data-theme="light"] .ev .toggle-switch-small input:checked + .toggle-slider-small {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

html[data-theme="light"] .ev .toggle-switch-small input:checked + .toggle-slider-small:before {
  background-color: #FFFFFF;
}

/* Keyboard users need to see which switch has focus — the real <input> is
   visually hidden, so the ring has to go on the track. */
.ev .toggle-switch-small input:focus-visible + .toggle-slider-small {
  outline: 2px solid var(--color-success);
  outline-offset: 2px;
}

/* billing / new sign-in cannot be turned off — say so by making it unclickable
   rather than letting a click silently do nothing. */
.ev.is-locked { cursor: not-allowed; opacity: 0.7; }

/* ========= Activity filters ========= */
.act-filters {
  display: flex;
  gap: 6px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.act-filters::-webkit-scrollbar { display: none; }

.act-f {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  white-space: nowrap;
  border-radius: var(--radius-full, 999px);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast, 0.15s), color var(--transition-fast, 0.15s);
}

.act-f:hover { color: var(--text); }
.act-f.on { background: var(--surface-2); color: var(--text); }

.act-f b {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-full, 999px);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
}

.act-f.on b { background: var(--color-success); color: #08130c; }

/* ========= Day separators in the feed ========= */
.act-day {
  padding: 9px 22px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ========= Notification Panel ========= */

.notif-list {
  display: flex;
  flex-direction: column;
  /* Fill the space between header and footer (card height comes from JS). Falls
     back to natural height when no explicit card height is set (mobile/stacked). */
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast, 0.15s);
}

.notif-item:hover { background: rgba(255,255,255,0.02); }

.notif-item.unread { background: rgba(34,197,94,0.03); }

.notif-item.unread::before {
  content: '';
  width: 5px;
  min-width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-success);
  margin-top: 9px;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.notif-item:last-child { border-bottom: none; }

/* Icon box — 28×28, square-rounded (prototype style) */
.notif-icon-wrap {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: var(--radius-sm, 6px);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  font-size: 12px;
}

.notif-icon-wrap.success {
  background: var(--color-success-light);
  color: var(--color-success);
  border-color: var(--status-online-border);
}
.notif-icon-wrap.error {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border-color: var(--status-offline-border);
}
.notif-icon-wrap.warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
  border-color: var(--status-loading-border);
}
.notif-icon-wrap.info {
  background: var(--color-info-light);
  color: var(--color-info);
  border-color: rgba(110,168,255,0.3);
}
.notif-icon-wrap.system {
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  border-color: var(--border);
}

/* Content */
.notif-content { flex: 1; min-width: 0; }

.notif-title {
  font: 400 12.5px/1.4 var(--font-sans, Inter, sans-serif);
  color: var(--text);
}

.notif-msg {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* Clicking a row lifts the 2-line clamp. The rows have always advertised
   cursor:pointer; until now nothing was listening, so the click did nothing and long
   messages stayed truncated with no way to read them. */
.notif-item.expanded .notif-msg {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}

.notif-time {
  font: 400 11px/1 var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-dim);
  margin-top: 4px;
}

/* Empty state */
.notif-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.notif-empty i {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
  display: block;
  opacity: 0.4;
}

/* Notification footer */
.notif-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-foot .btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.77rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast, 0.15s);
}

.notif-foot .btn-link:hover { color: var(--text); }

/* Unread count badge in card-header */
.notif-unread-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid var(--status-online-border);
  border-radius: var(--radius-full, 999px);
  font: 600 10px/1 var(--font-mono, 'JetBrains Mono', monospace);
}

/* Toggle label row in email settings */
.email-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.email-toggle-row-text { flex: 1; }
.email-toggle-row-text .toggle-main-label {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.email-toggle-row-text .toggle-sub-label {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

@media (max-width: 960px) {
  .sys-grid { grid-template-columns: 1fr; }
  .smtp-info-boxes { grid-template-columns: 1fr; }
}

/* ========= Light-theme corrections for the components added above =========
   These are the only rgba() literals in this file; each is invisible on a white
   surface, so the light theme gets an explicit counterpart rather than inheriting. */
html[data-theme="light"] .meter-track { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .act-f b { background: rgba(0, 0, 0, 0.07); }
html[data-theme="light"] .act-day { background: rgba(0, 0, 0, 0.02); }
html[data-theme="light"] .notif-item:hover { background: rgba(0, 0, 0, 0.02); }
html[data-theme="light"] .notif-item.unread { background: rgba(22, 163, 74, 0.05); }
html[data-theme="light"] .ev:hover { border-color: rgba(0, 0, 0, 0.16); }

/* ========= Dismiss button on a feed row =========
   Hidden until hover so the list stays calm, but always reachable by keyboard. */
.notif-item { position: relative; }

.notif-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast, 0.15s), color var(--transition-fast, 0.15s);
}

.notif-item:hover .notif-x,
.notif-x:focus-visible { opacity: 1; }
.notif-x:hover { color: var(--color-danger); }

.notif-foot .btn-link.danger:hover { color: var(--color-danger); }

/* ========= Plan & Usage: detail rows =========
   The Connection card was folded into this one (2026-09-02): a second card holding
   four rows was mostly chrome, and "how is the server" belongs next to "what am I
   paying for". These are the pieces that arrived with it. */

/* Plain-text connector between two figures ("$39/mo  renews  7/31/2026").
   Deliberately NOT .num — JetBrains Mono is for figures, and setting a word in it is
   what made rows like "Stripe" look wrong. */
.sys-sep {
  margin: 0 7px;
  font-size: 11.5px;
  color: var(--color-text-muted);
}

.sys-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Plan name as a chip beside the card title rather than a "Current Plan" row —
   it is an attribute of the card, not a measurement inside it. */
.plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full, 999px);
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid var(--status-online-border, rgba(34, 197, 94, 0.3));
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.plan-chip.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--border);
}

html[data-theme="light"] .plan-chip.inactive { background: rgba(0, 0, 0, 0.04); }

/* ========= Webhook URL block =========
   Was a right-aligned value in a label/value row, where a 60-character URL had nowhere
   to go and truncated. It is the one string on this page people copy, so it gets the
   full width. */
.sys-urlbox {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-0, #0A0D14);
}

.sys-urlbox-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.sys-urlbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sys-urlbox-row code {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text);
  /* A URL has no spaces, so it cannot wrap on its own — let it scroll rather than
     blow out the card width. */
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.sys-urlbox-row .icon-btn { width: 30px; height: 30px; flex-shrink: 0; }

/* ========= Activity panel follows the scroll =========
   The mockup had it pinned; the real page did not, because _syncNotifCardHeight() set
   an explicit pixel height to match the card on the left and nothing made it sticky —
   so scrolling the long left column left the feed behind. Pinning it to the viewport
   is what makes it a monitor rather than a footnote. */
@media (min-width: 961px) {
  .sys-notif-card {
    position: sticky;
    /* The page header is NOT sticky (layout/_header.css) — it scrolls away — so the
       only offset needed is the .container gutter (20px, layout/_container.css). */
    top: 20px;
    /* 20px of breathing room top and bottom so the footer row (Mark all as read /
       Clear) never sits flush against the viewport edge. */
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
  }
}
