/* ═══════════════════════════════════════════════════════════════════
   ROGUE — application styles
   ═══════════════════════════════════════════════════════════════════

   Everything except the landing page, which has its own home.css.
   The language is taken from that page so the two read as one product:

     ground      #08090b, flat
     surfaces    white at low alpha, never tinted
     lines       hairlines at 9% / 17%
     display     Rajdhani for headings, Inter for text, mono for data
     accent      #6574ff for actions and current location
     signal      #1ed8d2 for live/active state
     status      green / amber / red, meaning only

   Colour is never decorative. If something is coloured it is either the
   primary action, where you are, or a state you need to notice.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════ Tokens ═══════════ */

:root {
  --bg: #08090b;
  --bg-soft: #0d0f12;
  --bg-raised: #101216;

  --surface-1: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-3: rgba(255, 255, 255, 0.07);

  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);

  --text: #f7f8fa;
  --text-2: #c9ced8;
  --text-muted: #9399a6;
  --text-faint: #5f6570;

  --accent: #6574ff;
  --accent-hover: #7a87ff;
  --accent-soft: rgba(101, 116, 255, 0.13);
  --accent-line: rgba(101, 116, 255, 0.4);
  --signal: #1ed8d2;
  --signal-soft: rgba(30, 216, 210, 0.12);

  --success: #3ba55d;
  --warning: #faa61a;
  --danger: #ed4245;
  --success-soft: rgba(59, 165, 93, 0.13);
  --warning-soft: rgba(250, 166, 26, 0.13);
  --danger-soft: rgba(237, 66, 69, 0.13);

  --r-sm: 6px;
  --r: 14px;
  --r-pill: 999px;

  --display: Rajdhani, Inter, sans-serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.5);

  --nav-h: 60px;
}

/* ═══════════ Reset ═══════════ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}
p { margin: 0; }

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.11);
  border: 2px solid var(--bg);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

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

/* ═══════════ Type helpers ═══════════ */

/* The small uppercase label that names a group without shouting. */
.eyebrow,
.rogue-kicker,
.section-label {
  margin: 0 0 0.6rem;
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

code, kbd, samp, pre { font-family: var(--mono); }
code {
  padding: 0.1rem 0.36rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.88em;
}
.text-muted { color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; }

/* ═══════════ Top navigation ═══════════ */

.rogue-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--nav-h);
  padding: 0 1.5rem;
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.rogue-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}
.rogue-brand-mark { width: 30px; height: 30px; object-fit: contain; }
.rogue-nav-links { display: flex; align-items: center; gap: 1.6rem; }
.rogue-nav-links a {
  position: relative;
  padding: 0.35rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.16s;
}
.rogue-nav-links a:hover { color: var(--text); }
.rogue-nav-links a.active { color: var(--text); }
.rogue-nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-1 * (var(--nav-h) - 100%) / 2 - 1px);
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.rogue-nav-actions { display: flex; align-items: center; gap: 0.6rem; }

.rogue-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 0.83rem;
  font-weight: 500;
  transition: border-color 0.16s, background 0.16s;
}
.rogue-user:hover { border-color: var(--line-strong); background: var(--surface-1); }
.rogue-user img { width: 26px; height: 26px; border-radius: 50%; }

.rogue-main { min-height: calc(100vh - var(--nav-h)); }

/* ═══════════ Footer ═══════════ */

.rogue-footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
}
.rogue-footer a { color: var(--text-muted); }
.rogue-footer a:hover { color: var(--text); }

/* ═══════════ Page shell ═══════════ */

.rogue-tool-page {
  max-width: 74rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}
.rogue-tool-page.wide { max-width: 92rem; }

.rogue-tool-hero {
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.rogue-tool-title {
  font-size: 2.1rem;
  letter-spacing: -0.01em;
}
.rogue-tool-title span { color: var(--text-muted); font-weight: 600; }
.rogue-tool-sub {
  margin-top: 0.5rem;
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}
.breadcrumb a { color: var(--text-muted); transition: color 0.16s; }
.breadcrumb a:hover { color: var(--text); }

/* ═══════════ Panels and cards ═══════════ */

.rogue-panel,
.card {
  padding: 1.35rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-1);
}
.rogue-panel > h2,
.rogue-panel > h3 {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card { padding: 0; overflow: visible; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.card-header h3 {
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.card-header h3 i { margin-right: 0.5rem; color: var(--accent); }
.card-body { padding: 1.25rem; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.rogue-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.85rem;
}
.rogue-metric-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-1);
}
.rogue-metric-card i {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  font-size: 0.85rem;
  color: var(--accent);
}
.rogue-metric-card h3 {
  margin-bottom: 0.2rem;
  color: var(--text-faint);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.rogue-metric-card p { font-size: 1.05rem; font-weight: 600; }

/* ═══════════ Buttons ═══════════
   Three weights: primary for the one action a screen is for, default for
   everything else, and ghost for actions that sit inside another
   control. Danger is a state, not a fourth weight -- it recolours the
   variant it is applied to.

   Base is deliberately quiet. Filling every button makes none of them
   read as the action, which is what a settings page needs most.
   ─────────────────────────────── */

.btn,
.rogue-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover,
.rogue-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
}
.btn:active,
.rogue-btn:active { transform: translateY(1px); }
/* Keyboard focus has to be visible even where a hover is not. */
.btn:focus-visible,
.rogue-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn:disabled,
.rogue-btn:disabled,
.btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn i,
.rogue-btn i { font-size: 0.9em; }

/* ── Primary ── */

.btn-primary,
.rogue-btn-primary,
.btn-accent,
.db-invite-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover,
.rogue-btn-primary:hover,
.btn-accent:hover,
.db-invite-btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #fff;
}

/* ── Ghost ── */

.btn-outline,
.rogue-btn-outline,
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
}
.btn-outline:hover,
.rogue-btn-outline:hover,
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Destructive ── */

.btn-danger,
.rogue-btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover,
.rogue-btn-danger:hover {
  border-color: #f25a5d;
  background: #f25a5d;
  color: #fff;
}
/* Quiet until hovered: these sit next to a save button, and a filled red
   control beside it reads as the primary action. */
.btn-danger-outline,
.btn-outline-danger {
  border-color: rgba(237, 66, 69, 0.35);
  background: transparent;
  color: #ef8b8d;
}
.btn-danger-outline:hover,
.btn-outline-danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

/* ── Positive ── */

.btn-success {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.btn-success:hover { border-color: #45b76b; background: #45b76b; }

/* ── Sizes ── */

.btn-sm,
.rogue-btn-small {
  min-height: 2rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  gap: 0.4rem;
}
.btn-lg {
  min-height: 2.85rem;
  padding: 0.7rem 1.4rem;
  font-size: 0.92rem;
}
.btn-block { width: 100%; }

/* An icon with no label should be square rather than a wide pill. */
.btn-icon {
  min-width: 2.4rem;
  padding: 0.5rem;
}
.btn-icon.btn-sm { min-width: 2rem; padding: 0.32rem; }

/* ── Groups ── */

.btn-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 640px) {
  /* Comfortable tap targets, and a row of buttons goes full width rather
     than leaving three narrow ones on a line. */
  .btn,
  .rogue-btn { min-height: 2.6rem; }
  .btn-sm,
  .rogue-btn-small { min-height: 2.2rem; }
  .btn-row > .btn,
  .btn-row > .rogue-btn { flex: 1 1 9rem; }
}

/* ═══════════ Forms ═══════════ */

.form-group { margin-bottom: 1.1rem; }
.form-group > label,
label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.input,
input[type="text"],
input[type="search"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.58rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder,
input::placeholder,
textarea::placeholder { color: var(--text-faint); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select option { background: var(--bg-raised); color: var(--text); }

.input-group { display: flex; gap: 0.5rem; align-items: stretch; }
.input-group .input { flex: 1; }

.feedback { margin-top: 0.55rem; font-size: 0.82rem; line-height: 1.5; }
.feedback:empty { margin-top: 0; }
.feedback.success { color: var(--success); }
.feedback.error { color: var(--danger); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.13);
  cursor: pointer;
  transition: background 0.18s;
}
.slider::before {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(17px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Reference boxes for variables and command hints */
.variables-box {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}
.variables-title {
  margin-bottom: 0.55rem;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.variables-title i { margin-right: 0.4rem; color: var(--accent); }
.variables-desc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ═══════════ Tables ═══════════ */

.rogue-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-1);
  overflow-x: auto;
}
.rogue-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.rogue-table th {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.rogue-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: middle;
}
.rogue-table tbody tr:last-child td { border-bottom: none; }
.rogue-table tbody tr { transition: background 0.14s; }
.rogue-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* ═══════════ Status ═══════════ */

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.up, .dot.success { background: var(--success); box-shadow: 0 0 8px var(--success-soft); }
.dot.warn, .dot.warning { background: var(--warning); }
.dot.down, .dot.danger { background: var(--danger); }
.dot.live { background: var(--signal); box-shadow: 0 0 8px rgba(30, 216, 210, 0.5); }

.badge, .pill, .legacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-success { border-color: transparent; background: var(--success-soft); color: var(--success); }
.badge-warning { border-color: transparent; background: var(--warning-soft); color: var(--warning); }
.badge-danger  { border-color: transparent; background: var(--danger-soft);  color: var(--danger); }
.badge-accent  { border-color: transparent; background: var(--accent-soft);  color: var(--accent); }

/* Inline notices */
.notice {
  display: flex;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-1);
  font-size: 0.86rem;
  line-height: 1.55;
}
.notice i { margin-top: 0.15rem; flex-shrink: 0; }
.notice strong { display: block; margin-bottom: 0.2rem; color: var(--text); }
.notice p { color: var(--text-muted); }
.notice-warn { border-color: rgba(250, 166, 26, 0.32); background: var(--warning-soft); }
.notice-warn i { color: var(--warning); }
.notice-info { border-color: var(--accent-line); background: var(--accent-soft); }
.notice-info i { color: var(--accent); }
.notice-danger { border-color: rgba(237, 66, 69, 0.32); background: var(--danger-soft); }
.notice-danger i { color: var(--danger); }

/* ═══════════ Empty states ═══════════ */

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 1.6rem; color: var(--text-faint); margin-bottom: 0.75rem; }

/* ═══════════ Responsive ═══════════ */

@media (max-width: 860px) {
  .rogue-nav { padding: 0 1rem; }
  .rogue-nav-links { display: none; }
  /* Less dead space above the heading on a phone, where the screen is
     short and the first line should be near the top. */
  .rogue-tool-page { padding: 1.5rem 1rem 4rem; }
  .rogue-tool-hero { padding-bottom: 1.1rem; margin-bottom: 1.35rem; }
  .rogue-tool-title { font-size: 1.65rem; }
  .rogue-tool-sub { font-size: 0.86rem; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .rogue-tool-page { padding: 1.15rem 0.9rem 3.5rem; }
  .rogue-tool-title { font-size: 1.45rem; }
  .rogue-card-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .rogue-metric-card { padding: 0.85rem 1rem; }
}
