/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --elevated: #1c1c1c;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #777;
  --text-dim: #444;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;
  --info: #3b82f6;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 56px;
  --transition: 200ms ease;
  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Names used in the dashboard JS that were never declared here. Anything styled
     with them rendered with no background or colour at all. */
  --bg-elev: var(--elevated);
  --bg-muted: var(--elevated);
  --bg-2: var(--surface);
  --text-danger: var(--danger);
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html { height: 100%; }

body {
  display: flex;
  height: 100vh;
  /* A warm amber glow top-right and a cooler one bottom-left give the flat near-black
     real depth and something for the frosted cards to read against. Our identity. */
  background:
    radial-gradient(1000px 700px at 88% -6%, rgba(245, 158, 11, 0.14), transparent 55%),
    radial-gradient(760px 520px at -6% 106%, rgba(245, 158, 11, 0.06), transparent 52%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  flex-shrink: 0;
  overflow: hidden;
  z-index: 50;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 57px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo-text {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  transition: opacity var(--transition);
}

/* The two halves of the wordmark sit flush in the DOM, but Space Grotesk leaves
   visible air between the "e" and the "C" so it reads as "Hive Code". Closing the
   pair by hand is the fix; the letter boxes already touch, this is optical. */
.sidebar-logo-text em {
  font-style: normal;
  color: var(--accent);
  margin-left: -1.5px;
}

/* Scoped to the rail. Bare .collapsed also matched .nav-group.collapsed, which
   stripped the labels off every item in a folded group. */
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .guild-selector-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .sidebar-user-tag {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.collapse-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.collapse-btn:hover {
  background: var(--elevated);
  color: var(--text);
}

/* Guild selector */
.guild-selector {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
  min-height: 52px;
  overflow: hidden;
  white-space: nowrap;
}

.guild-selector:hover { background: var(--elevated); }

.guild-selector-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--elevated);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}

.guild-selector-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.guild-selector-label {
  flex: 1;
  overflow: hidden;
}

.guild-selector-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guild-selector-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 8px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Was --text-dim (#444) at 10px on a near-black sidebar, which measures 1.98:1
   against the background where 4.5:1 is the floor. The group titles were rendering
   but were effectively invisible, so the sidebar read as a column of bare arrows. */
.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8f8f96;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition), color var(--transition);
}

/* Scoped to the sidebar rail. Unscoped, this also matched .nav-group.collapsed and
   hid a group's own title the moment you folded it away, which is the one label
   that has to stay readable when a group is shut. */
.sidebar.collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
}

/* ── Nav filter ─────────────────────────────────────────────────────────────── */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 10px 10px 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color var(--transition), background var(--transition);
}

.nav-search:focus-within {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.05);
}

.nav-search-icon {
  width: 14px;
  height: 14px;
  margin-left: 9px;
  flex-shrink: 0;
  stroke: var(--text-dim);
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.nav-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 7px 8px;
}

.nav-search input::placeholder { color: var(--text-dim); }

.nav-search-kbd {
  margin-right: 7px;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}

.nav-search:focus-within .nav-search-kbd { opacity: 0; }

.sidebar.collapsed .nav-search { display: none; }

.nav-empty {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 18px 8px;
}

/* ── Nav groups ─────────────────────────────────────────────────────────────── */
.nav-group { margin-bottom: 2px; }

.nav-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 8px 5px;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.nav-group-head:hover { background: rgba(255, 255, 255, 0.03); }
.nav-group-head:hover .nav-section-label { color: var(--text-muted); }

.nav-group-caret {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  stroke: var(--text-dim);
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(90deg);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-group.collapsed .nav-group-caret { transform: rotate(0deg); }

/* Collapsing animates rather than cutting. The grid 0fr trick was tried first and
   does not hold here: it sizes only the first row, so the six items after it land
   in implicit rows and the group kept most of its height. max-height is blunt but
   exact, and 420px clears the tallest group (7 items) with room to spare. */
.nav-group-body {
  overflow: hidden;
  max-height: 420px;
  transition: max-height var(--transition), opacity var(--transition);
}

.nav-group.collapsed .nav-group-body {
  max-height: 0;
  opacity: 0;
}

.nav-group.collapsed .nav-group-body .nav-item { pointer-events: none; }

/* Collapsed sidebar: the group chrome would just be noise next to icon-only rows. */
.sidebar.collapsed .nav-group-head { display: none; }
.sidebar.collapsed .nav-group-body { max-height: none !important; opacity: 1 !important; }
.sidebar.collapsed .nav-group-body .nav-item { pointer-events: auto; }
.sidebar.collapsed .nav-group { margin-bottom: 6px; }

/* While filtering, a collapsed group must still show its matches, otherwise the
   filter would silently hide the thing you searched for. */
.sidebar-nav.filtering .nav-group-body {
  max-height: none !important;
  opacity: 1 !important;
}

.sidebar-nav.filtering .nav-group-body .nav-item { pointer-events: auto; }

/* Someone who asked their OS for less motion gets the collapse instantly rather
   than as a slide. Scoped to the nav so nothing that waits on transitionend
   elsewhere in the dashboard changes behaviour. */
@media (prefers-reduced-motion: reduce) {
  .nav-group-body,
  .nav-group-caret,
  .nav-icon { transition: none; }
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--elevated);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.04));
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
  box-shadow: -8px 0 20px -8px rgba(245, 158, 11, 0.7);
}

/* Was an emoji glyph. Emoji render differently on every OS and read as a template,
   so these are now drawn from the sprite in dashboard.html and inherit colour. */
.nav-icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
  transition: opacity var(--transition);
}

.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-label {
  transition: opacity var(--transition), width var(--transition);
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 8px;
}

.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 100;
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* Sidebar user */
.sidebar-user {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--elevated);
  object-fit: cover;
}

.sidebar-user-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.sidebar-user-tag {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-user-logout {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  background: none;
  border: none;
  transition: color var(--transition);
}

.sidebar-user-logout:hover { color: var(--danger); }

/* ── Main Content ────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  width: 100%;
}

/* ── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: var(--font);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 11px;
}

/* Carries the hexagon through from the site so a logged-in page still reads as
   the same product. */
.page-header h1::before {
  content: '';
  width: 12px;
  height: 14px;
  flex-shrink: 0;
  background: linear-gradient(150deg, var(--accent), var(--accent-hover));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 68ch;
}

/* Ticket AI and Credits write their headings with these instead of .page-header. */
.page-title {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.page-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
/* Translucent + blur over the amber-glow backdrop reads as gentle depth rather than
   full glassmorphism. Modern, but still our dark/amber identity. The inset top
   highlight is the "glass edge". */
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(20, 20, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 34px rgba(0, 0, 0, 0.38);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
}
/* A small glowing amber bar before every card title ties the pages together in
   our own identity. */
.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 13px;
  margin-right: 9px;
  vertical-align: -1px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Was flat while .card next to it had the glass treatment, which made the two look
   like they came from different products. */
.stat-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    rgba(20, 20, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(320px 120px at 100% 0%, rgba(245, 158, 11, 0.09), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.stat-card:hover {
  border-color: rgba(245, 158, 11, 0.26);
  transform: translateY(-2px);
}

.stat-card:hover::after { opacity: 1; }

.stat-label {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Same hexagon that marks a section on the site. */
.stat-label::before {
  content: '';
  width: 7px;
  height: 8px;
  flex-shrink: 0;
  background: var(--accent);
  opacity: 0.7;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.stat-value {
  font-family: var(--font);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 6px;
  position: relative;
}

.stat-trend {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: var(--surface);
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
  background: var(--surface);
  transition: background var(--transition);
}

.table tbody tr:hover { background: var(--elevated); }

/* ── Form Elements ───────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

/* .label is the short alias used across the dashboard JS. It had no rule at all,
   so 60 labels rendered as plain inline body text with no spacing. */
.form-label,
.label {
  display: block;
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-dim); }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.input-row .form-group { flex: 1; margin-bottom: 0; }

/* Number input */
input[type="number"].input::-webkit-inner-spin-button,
input[type="number"].input::-webkit-outer-spin-button {
  opacity: 0.5;
}

/* Range slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.slider-value {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  min-width: 36px;
  text-align: center;
}

/* Color input */
input[type="color"].color-input {
  width: 40px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}

/* ── Toggle Switch ────────────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info {}

.toggle-info .toggle-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
}

.toggle-info .toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle input:checked + .toggle-track {
  background: var(--success);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* ── Overview hero ───────────────────────────────────────────────────────────
   The overview used to open on four small stat boxes. It now opens on the server
   itself, so the first thing you see is which server you are editing and whether
   it is protected. */
.ov-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background:
    radial-gradient(680px 220px at 8% -40%, rgba(245, 158, 11, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(20, 20, 20, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 18px 40px rgba(0, 0, 0, 0.42);
}

/* Same comb field as the marketing site, so the two halves of the product share a
   surface treatment and not just a colour. */
.ov-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='96' viewBox='0 0 56 96'%3E%3Cg fill='none' stroke='%23f59e0b' stroke-opacity='0.07' stroke-width='1'%3E%3Cpath d='M28 1 L54 16 L54 46 L28 61 L2 46 L2 16 Z'/%3E%3Cpath d='M0 49 L26 64 L26 94 L0 109 L-26 94 L-26 64 Z'/%3E%3Cpath d='M56 49 L82 64 L82 94 L56 109 L30 94 L30 64 Z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.ov-hero > * { position: relative; }

/* Holds the initials, with the server icon layered over them. If the icon fails
   it removes itself and the initials are already there underneath, so a dead
   CDN url never leaves an empty hexagon. */
.ov-avatar {
  position: relative;
  width: 62px;
  height: 70px;
  flex-shrink: 0;
  background: var(--elevated);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-weight: 700;
  font-size: 22px;
  color: var(--accent);
  overflow: hidden;
}

.ov-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ov-id { min-width: 0; flex: 1; }

.ov-name {
  font-family: var(--font);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ov-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }

.ov-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.ov-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  white-space: nowrap;
}

.ov-pill svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.9; }

.ov-pill.good { color: #4ade80; border-color: rgba(34, 197, 94, 0.32); background: rgba(34, 197, 94, 0.1); }
.ov-pill.warn { color: #fbbf24; border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.1); }
.ov-pill.bad  { color: #f87171; border-color: rgba(239, 68, 68, 0.32); background: rgba(239, 68, 68, 0.1); }

/* ── Two-column overview split ───────────────────────────────────────────────── */
.ov-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .ov-split { grid-template-columns: 1fr; }
}

.ov-chart-wrap { height: 190px; position: relative; }
.ov-chart-wrap canvas { width: 100%; height: 100%; }

.ov-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }

.ov-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.ov-legend i {
  width: 9px;
  height: 10px;
  display: inline-block;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* Protection readout */
.ov-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.ov-check:last-child { border-bottom: none; padding-bottom: 0; }

.ov-check-dot {
  width: 9px;
  height: 10px;
  margin-top: 4px;
  flex-shrink: 0;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.ov-check-dot.on { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }
.ov-check-dot.off { background: #3a3a40; }
.ov-check-dot.part { background: var(--accent); box-shadow: 0 0 8px rgba(245, 158, 11, 0.45); }

.ov-check-name { font-size: 13px; font-weight: 500; }
.ov-check-note { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.ov-check a { color: var(--accent); text-decoration: none; }
.ov-check a:hover { text-decoration: underline; }

/* ── Module tiles ────────────────────────────────────────────────────────────
   Was a list of rows with an emoji and a switch, which read as a settings form.
   These are tiles you can see the state of at a glance: lit and amber when on,
   dim when off. The whole tile is the control. */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.module-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.018);
  padding: 15px 14px 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  overflow: hidden;
}

.module-tile:hover { transform: translateY(-2px); border-color: #35353a; }

.module-tile.on {
  border-color: rgba(245, 158, 11, 0.34);
  background:
    radial-gradient(200px 90px at 100% 0%, rgba(245, 158, 11, 0.12), transparent 70%),
    rgba(245, 158, 11, 0.045);
}

.module-tile.on:hover { border-color: rgba(245, 158, 11, 0.55); }

.module-hex {
  position: relative;
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.module-hex::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #232327;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background var(--transition);
}

.module-tile.on .module-hex::before { background: rgba(245, 158, 11, 0.18); }

.module-icon {
  position: relative;
  width: 17px;
  height: 17px;
  /* Dim enough to read as off, light enough to still see against the hex. */
  stroke: #6b6b73;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--transition);
}

.module-tile.on .module-icon { stroke: var(--accent); }

.module-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.3;
  transition: color var(--transition);
}

.module-tile.on .module-name { color: var(--text); }

.module-state {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color var(--transition);
}

.module-tile.on .module-state { color: var(--accent); }

.module-tile[aria-busy="true"] { opacity: 0.55; pointer-events: none; }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 2px 18px rgba(245, 158, 11, 0.45);
}
.btn-primary:hover {
  background: var(--accent-hover);
  opacity: 1;
  box-shadow: 0 4px 28px rgba(245, 158, 11, 0.62);
}

.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); opacity: 1; }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--elevated); opacity: 1; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
}

/* ── Badges ───────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(234,179,8,0.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-accent { background: rgba(245,158,11,0.15); color: var(--accent); }
.badge-muted { background: var(--elevated); color: var(--text-muted); }

/* ── Modals ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: fadeIn 150ms ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 200ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ── Skeleton Loading ─────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--elevated) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  display: block;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; margin-bottom: 12px; width: 60%; }
.skeleton-card { height: 90px; margin-bottom: 12px; border-radius: var(--radius-lg); }

/* ── Toast Notifications ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideInRight 250ms ease;
  transition: opacity 250ms ease, transform 250ms ease;
}

.toast.hide {
  opacity: 0;
  transform: translateX(16px);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }

.toast-icon { font-size: 16px; }
.toast-msg { flex: 1; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Tag Input ────────────────────────────────────────────────────────────────── */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 40px;
  cursor: text;
  transition: border-color var(--transition);
}

.tag-input-wrap:focus-within { border-color: var(--accent); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
}

.tag-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
}

.tag-remove:hover { color: var(--danger); }

.tag-input-field {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  min-width: 80px;
  flex: 1;
}

/* ── Multi-select ─────────────────────────────────────────────────────────────── */
.multi-select {
  position: relative;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 30px 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 40px;
  transition: border-color var(--transition);
  position: relative;
}

.multi-select-trigger:focus,
.multi-select-trigger.open { border-color: var(--accent); }

.multi-select-trigger::after {
  content: '▾';
  position: absolute;
  right: 10px;
  color: var(--text-muted);
  font-size: 11px;
}

.multi-select-placeholder { color: var(--text-dim); font-size: 13px; }

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.multi-select-dropdown.open { display: block; }

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}

.multi-select-option:hover { background: var(--surface); }
.multi-select-option.selected { color: var(--accent); }

/* ── Section dividers ─────────────────────────────────────────────────────────── */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

.section-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Charts ───────────────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}

/* ── Server cards (server selector page) ─────────────────────────────────────── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  transition: border-color var(--transition), transform var(--transition);
}

.server-card:hover {
  border-color: rgba(245,158,11,0.3);
  transform: translateY(-2px);
}

.server-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}

.server-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.server-card-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
}

.server-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Danger zone ──────────────────────────────────────────────────────────────── */
.danger-zone {
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-top: 24px;
}

.danger-zone-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 8px;
}

/* ── Pagination ───────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.page-btn:hover,
.page-btn.active {
  background: var(--elevated);
  color: var(--text);
}

.page-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Premium card ─────────────────────────────────────────────────────────────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-card.highlighted {
  border-color: var(--accent);
  background: rgba(245,158,11,0.04);
}

.plan-name {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.plan-highlighted .plan-name { color: var(--accent); }

.plan-price {
  font-family: var(--font);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.plan-price span { font-size: 14px; color: var(--text-muted); font-weight: 400; }

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.plan-features li.has { color: var(--text); }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 700; }
.plan-features li.no::before { content: '×'; color: var(--text-dim); }

/* ── Empty states ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }

.empty-state h3 {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p { font-size: 13px; }

/* ── Variable chips ───────────────────────────────────────────────────────────── */
.variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.var-chip {
  padding: 2px 8px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition);
}

.var-chip:hover { background: rgba(245,158,11,0.2); }

/* ── Warning escalation table ─────────────────────────────────────────────────── */
.escalation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.escalation-row .input { max-width: 80px; }

/* ── Spinner ──────────────────────────────────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.spinner-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
}

/* ── Error state ──────────────────────────────────────────────────────────────── */
.error-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.error-state h3 {
  font-family: var(--font);
  color: var(--danger);
  margin-bottom: 8px;
}

/* ── Giveaway countdown ───────────────────────────────────────────────────────── */
.countdown {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}

/* ── Top bar (mobile) ─────────────────────────────────────────────────────────── */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
}

/* ── Mobile overlay ───────────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 45;
}

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { flex-direction: column; overflow: auto; }

  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--transition), width var(--transition);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible { display: block; }

  .main { height: calc(100vh - 49px); overflow-y: auto; }

  .content { padding: 16px; }

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

  .server-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
}

/* ── Light theme override ──────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --elevated: #f0eee8;
  --border: #e2e0da;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --text-dim: #a8a8a8;
}

[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d6d4ce; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #b8b6b0; }

[data-theme="light"] .modal { background: rgba(20,20,20,0.45); }
[data-theme="light"] .toast { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }

[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
  background: var(--surface);
}

[data-theme="light"] .btn-danger:hover { background: rgba(239,68,68,0.18); }

/* Light theme needs its own versions of the polish: the dark translucent cards and
   the near-black glow would read wrong on a light background. */
[data-theme="light"] body {
  background:
    radial-gradient(1000px 700px at 88% -6%, rgba(245, 158, 11, 0.10), transparent 55%),
    var(--bg);
}
[data-theme="light"] .card {
  background: linear-gradient(180deg, #ffffff, #fcfbf7);
  border: 1px solid var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .sidebar { background: rgba(255, 255, 255, 0.86); }
[data-theme="light"] .btn-primary { box-shadow: 0 2px 14px rgba(245, 158, 11, 0.32); }

/* Theme toggle pill */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: background var(--transition), border-color var(--transition);
}
.theme-toggle:hover { background: var(--elevated); border-color: var(--accent); }
.theme-toggle .theme-toggle-icon { font-size: 14px; line-height: 1; }

/* ── Command palette (Cmd-K) ───────────────────────────────────────────────── */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  z-index: 200;
  animation: cmdk-fade-in 120ms ease;
}
@keyframes cmdk-fade-in { from { opacity: 0; } to { opacity: 1; } }
.cmdk-modal {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  overflow: hidden;
  font-family: var(--font-body);
}
.cmdk-input {
  width: 100%;
  padding: 16px 20px;
  border: 0;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input::placeholder { color: var(--text-dim); }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px 0; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}
.cmdk-item.active { background: var(--elevated); }
.cmdk-icon { width: 18px; text-align: center; font-size: 15px; }
.cmdk-label { flex: 1; }
.cmdk-kind {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.cmdk-empty { padding: 16px 20px; color: var(--text-muted); font-size: 13px; }
.cmdk-hint {
  border-top: 1px solid var(--border);
  padding: 8px 18px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Dirty-state save indicator ────────────────────────────────────────────── */
.dirty-indicator {
  position: fixed;
  bottom: 20px; left: 20px;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-body);
  display: flex; align-items: center; gap: 8px;
  z-index: 150;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.dirty-spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dirty-spin 700ms linear infinite;
}
@keyframes dirty-spin { to { transform: rotate(360deg); } }

/* ── Section tabs ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.tab.active .tab-count { background: var(--accent); color: #0a0a0a; }

/* ── Split editor: controls left, live preview right ────────────────────────── */
.split-pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .split-pane { grid-template-columns: minmax(0, 1fr); }
  .split-pane > .preview-col { position: static; }
}
.preview-col { position: sticky; top: 16px; }
.preview-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ── Builder cards (questions, steps, rules) ────────────────────────────────── */
.builder-list { display: flex; flex-direction: column; gap: 8px; }

.builder-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  transition: border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.builder-card:hover { border-color: #3a3a3a; }
.builder-card.open { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18); }
.builder-card.dragging { opacity: 0.4; }
.builder-card.drop-target { border-color: var(--accent); border-style: dashed; }

.builder-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.builder-grip {
  color: var(--text-dim);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  padding: 2px 1px;
  flex-shrink: 0;
}
.builder-grip:active { cursor: grabbing; }
.builder-grip:hover { color: var(--text-muted); }

.builder-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.builder-card.open .builder-num { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }

.builder-summary { flex: 1; min-width: 0; }
.builder-summary-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.builder-summary-text.empty { color: var(--text-dim); font-style: italic; }
.builder-summary-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.builder-actions { display: flex; gap: 2px; flex-shrink: 0; }
.builder-body {
  padding: 12px 12px 12px 12px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

/* ── Icon type picker ───────────────────────────────────────────────────────── */
.type-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
}
.type-option {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 6px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.type-option:hover { border-color: #3a3a3a; color: var(--text); }
.type-option.selected {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.09);
  color: var(--text);
}
.type-option-icon { font-size: 16px; line-height: 1.2; display: block; }
.type-option-label { font-size: 11px; font-weight: 600; margin-top: 3px; display: block; }

/* ── Template gallery ───────────────────────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.template-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  font-family: var(--font-body);
  color: var(--text);
}
.template-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.template-icon { font-size: 22px; display: block; margin-bottom: 8px; }
.template-name { font-family: var(--font); font-weight: 600; font-size: 14px; }
.template-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.template-meta { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ── Discord modal mock (what the applicant actually sees) ──────────────────── */
.dc-modal {
  background: #313338;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}
.dc-modal-head {
  padding: 14px 16px 0 16px;
  color: #f2f3f5;
  font-size: 15px;
  font-weight: 700;
}
.dc-modal-body { padding: 12px 16px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.dc-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #b5bac1;
  margin-bottom: 6px;
  display: block;
}
.dc-field-label .req { color: #f23f43; margin-left: 2px; }
.dc-input {
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 3px;
  padding: 9px 10px;
  color: #dbdee1;
  font-size: 13px;
  min-height: 36px;
  line-height: 1.4;
}
.dc-input.para { min-height: 68px; }
.dc-input.placeholder { color: #6d6f78; }
.dc-select {
  background: #1e1f22;
  border: 1px solid #1e1f22;
  border-radius: 3px;
  padding: 9px 10px;
  color: #6d6f78;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dc-modal-foot {
  background: #2b2d31;
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dc-btn {
  border-radius: 3px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #5865f2;
}
.dc-btn.secondary { background: none; color: #dbdee1; }
.dc-steps { font-size: 11px; color: var(--text-dim); text-align: center; margin-top: 8px; }

/* ── Entity cards (forms, panels, feeds) ────────────────────────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.entity-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}
.entity-card:hover { border-color: #3a3a3a; }
.entity-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.entity-name { font-family: var(--font); font-weight: 600; font-size: 15px; }
.entity-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.entity-stat-val { font-family: var(--font); font-weight: 700; font-size: 17px; }
.entity-stat-lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.entity-foot { display: flex; gap: 6px; margin-top: 2px; flex-wrap: wrap; }



/* ═══════════════════════════════════════════════════════════════════════════
   COMPONENT LAYER REBUILD, 22 July 2026
   Appended deliberately: later rules of equal specificity win, so this takes
   effect over the definitions above without cutting them out of a 2000 line
   file by hand. Anything above that still wins on specificity is a bug and is
   listed in the commit.
   ═══════════════════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════════════════════
   HiveCode dashboard: the shared component layer.

   All 25 module pages are built from the same five things: a card, a card title,
   a form-group, a toggle-row and a table. This defines all of them. The grammar
   is one settings row repeated: the left column says what the setting is and
   what it does, the right column holds the control, hairlines group the rows,
   the card title becomes a real header band that the rows hang off, and a row
   whose setting is on carries a lit amber rail, so a page of eight filters can
   be read in one pass instead of eight.

   CSS only, on the markup app.js already emits. Nothing here touches the
   sidebar, the nav groups, or the Overview components (.ov-*, .module-tile,
   .stats-grid, .stat-*, .modules-grid).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────────
   New names only, all prefixed hc-, so the existing tokens keep their values
   and the sidebar does not move. */
:root {
  --hc-title: #f2f2f3;
  --hc-desc: #a3a3ab;
  --hc-meta: #b8b8bf;

  --hc-line: rgba(255, 255, 255, 0.075);
  --hc-line-soft: rgba(255, 255, 255, 0.045);

  --hc-field: #0f0f11;
  --hc-field-top: #141417;
  --hc-field-line: #2f2f36;
  --hc-field-line-hi: #46464f;

  --hc-raised: rgba(255, 255, 255, 0.045);
  --hc-raised-hi: rgba(255, 255, 255, 0.085);

  --hc-amber: #f59e0b;
  --hc-amber-lit: #fbbf24;
  --hc-amber-wash: rgba(245, 158, 11, 0.09);
  --hc-amber-edge: rgba(245, 158, 11, 0.32);
  /* The same ink the marketing site puts on an amber surface. */
  --hc-ink: #140d00;
  /* Amber used as text. Split from --hc-amber-lit because the light theme has
     to darken the text version without darkening the button gradient. */
  --hc-amber-text: #fbbf24;

  --hc-ring: 0 0 0 3px rgba(245, 158, 11, 0.26);
  --hc-hex: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);

  /* The honeycomb tile from landing.css, same geometry, so a settings panel and
     the marketing page share a surface treatment and not only a colour. */
  --hc-comb: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='96' viewBox='0 0 56 96'%3E%3Cg fill='none' stroke='%23f59e0b' stroke-opacity='0.06' stroke-width='1'%3E%3Cpath d='M28 1 L54 16 L54 46 L28 61 L2 46 L2 16 Z'/%3E%3Cpath d='M0 49 L26 64 L26 94 L0 109 L-26 94 L-26 64 Z'/%3E%3Cpath d='M56 49 L82 64 L82 94 L56 109 L30 94 L30 64 Z'/%3E%3C/g%3E%3C/svg%3E");

  --hc-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a3a3ab' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hc-chev-lit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23fbbf24' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* Hexagon inside a hexagon, drawn wherever the markup hardcodes an emoji. */
  --hc-hexmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='58' viewBox='0 0 52 58'%3E%3Cpath d='M26 2 L48 14.5 L48 43.5 L26 56 L4 43.5 L4 14.5 Z' fill='%23f59e0b' fill-opacity='0.05' stroke='%23f59e0b' stroke-opacity='0.42' stroke-width='1.5'/%3E%3Cpath d='M26 17 L34.7 22 L34.7 32 L26 37 L17.3 32 L17.3 22 Z' fill='%23f59e0b' fill-opacity='0.32'/%3E%3C/svg%3E");
}

/* ── Contrast repair for the content area ───────────────────────────────────
   app.js writes color:var(--text-muted) and color:var(--text-dim) inline in
   roughly 150 places, so no class selector in this file can reach that text.
   Rebinding the two tokens on the containers fixes every one of them at once,
   with no !important sweep.

   Measured against the real composited card surface, rgb(38,35,29) at its
   lightest (the amber page glow read through the translucent panel):
     shipped --text-muted #777    = 3.63:1  fails
     shipped --text-dim   #444    = 1.66:1  fails
     new     --text-muted #a3a3ab = 6.2:1   passes
     new     --text-dim   #9a9aa2 = 5.6:1   passes
   The sidebar is a sibling of .main, so the rail keeps the old values and does
   not move. Modals, the command palette and toasts are appended to <body>, so
   they are listed separately or they would keep the failing greys. */
.main,
.modal-overlay,
.cmdk-overlay,
#toast-container {
  --text-muted: #a3a3ab;
  --text-dim: #9a9aa2;
}

/* ── The panel ──────────────────────────────────────────────────────────────
   --hc-pad is declared here so the header band, the toggle rows and the tables
   can cancel exactly the padding that is in force, including the mobile value.
   backdrop-filter is dropped: it cost a compositing layer per card, made the
   surface impossible to measure honestly, and .stat-card never had it, so the
   two finally match. */
.card {
  --hc-pad: 24px;
  position: relative;
  padding: var(--hc-pad);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: var(--radius-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(245, 158, 11, 0.05), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.014) 130px, rgba(255, 255, 255, 0.008)),
    rgba(20, 20, 20, 0.74);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 18px 42px -20px rgba(0, 0, 0, 0.7);
}

/* Most cards carry an inline margin-bottom, which still wins. This is only for
   the handful that carry none and would otherwise butt against the next card.
   Adjacent margins collapse, so nothing double-spaces. */
#content > .card { margin-bottom: 20px; }

/* ── Header band ────────────────────────────────────────────────────────────
   The title stops floating and becomes the top of the panel: recessed, ruled,
   carrying the comb. :first-child so a mid-card title is never pulled out of
   the flow. :not([style*="padding"]) skips the three cards that set their own
   padding, where a -24px bleed would hang past the edge; those get the same
   rule inset instead. The !important on margin is needed because 33 card titles
   carry an inline margin-bottom. */
.card:not([style*="padding"]) > .card-title:first-child,
.card:not([style*="padding"]) > .card-header:first-child,
.card:not([style*="padding"]) > h3:first-child {
  margin: calc(var(--hc-pad) * -1) calc(var(--hc-pad) * -1) 10px !important;
  padding: 13px var(--hc-pad) 12px;
  border-bottom: 1px solid var(--hc-line);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  background:
    var(--hc-comb),
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.3));
}

/* Cards with their own padding get the rule but not the bleed. */
.card[style*="padding"] > .card-title:first-child,
.card[style*="padding"] > .card-header:first-child {
  padding-bottom: 11px;
  margin-bottom: 12px !important;
  border-bottom: 1px solid var(--hc-line);
}

.card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  /* column-gap, not a margin on the marker: five card titles hold a nested PRO
     or Enterprise badge, and flex would otherwise eat the space before it. */
  column-gap: 9px;
  row-gap: 5px;
  min-width: 0;
  font-family: var(--font);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.012em;
  color: var(--hc-title);
}

/* The logo hexagon replaces the generic amber bar. */
.card-title::before,
.card:not([style*="padding"]) > h3:first-child::before {
  content: '';
  display: block;
  width: 9px;
  height: 10px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 0;
  background: linear-gradient(150deg, var(--hc-amber-lit), var(--hc-amber));
  clip-path: var(--hc-hex);
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  box-shadow: none;
  vertical-align: baseline;
}

/* Ten cards open on a bare <h3> instead of a card title. Same band, same mark,
   so pages do not come out half banded and half plain. */
.card:not([style*="padding"]) > h3:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 9px;
  row-gap: 5px;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--hc-title);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header > .card-title { flex: 1 1 auto; }
.card-header > *:not(.card-title) { flex-shrink: 0; }

/* A card title further down a card is a subsection, not a header. */
.card > .card-title:not(:first-child) {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--hc-line-soft);
}

/* ── The settings row ───────────────────────────────────────────────────────
   A form row and a toggle row were two visually unrelated species inside the
   same card. They are now the same object with a different control on the
   right: a title, a description under it, a hairline beneath. That is what
   makes 25 pages feel designed rather than assembled, and it costs no markup. */
.toggle-info .toggle-name,
.form-label {
  display: block;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  letter-spacing: -0.006em;
  text-transform: none;
  color: var(--hc-title);
  margin-bottom: 0;
}

.form-label { margin-bottom: 7px; }

.toggle-info .toggle-desc,
.form-hint {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--hc-desc);
  margin-top: 3px;
  max-width: 62ch;
}

.form-hint { margin-top: 7px; }
.form-hint a { color: var(--hc-amber); }
.toggle-info { min-width: 0; }

.form-group { margin-bottom: 18px; }

/* Rows are separated by hairlines rather than by whitespace, so a card of eight
   settings reads as a list instead of a wall. Scoped to direct children of a
   card, so form-groups inside modals, builder cards and the split-pane preview
   keep their own rhythm. */
.card > .form-group {
  padding: 15px 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--hc-line-soft);
}

.card > .form-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.card > .card-title:first-child + .form-group,
.card > .card-header:first-child + .form-group,
.card > h3:first-child + .form-group { padding-top: 4px; }

/* ── Toggle rows ────────────────────────────────────────────────────────────
   The dominant element on the moderation, logging and settings pages: 25 rows
   in All Modules alone. Rows answer to the cursor now, and a row whose setting
   is on carries a lit amber rail, so state is legible down the left edge in one
   scan instead of by reading every switch on the far right. */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hc-line-soft);
}

.toggle-row:last-child { border-bottom: none; }

.card > .toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding-block: 13px;
  transition: background var(--transition);
}

/* The bleed is skipped for rows that carry an inline padding of their own (the
   milestone history list), where a negative side margin with no matching
   padding would push their text outside the panel. */
.card > .toggle-row:not([style*="padding"]) {
  margin-inline: calc(var(--hc-pad) * -1);
  padding-inline: var(--hc-pad);
}

.card > .toggle-row:hover { background: rgba(255, 255, 255, 0.03); }

.card > .toggle-row:has(.toggle input:checked) {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.055), rgba(245, 158, 11, 0.012) 45%, transparent 75%);
}

.card > .toggle-row:has(.toggle input:checked):hover {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.085), rgba(245, 158, 11, 0.02) 45%, transparent 78%);
}

/* Drawn only when the row is on, so the rows that hold no switch at all (the
   milestone history entries) never grow a stray marker. */
.card > .toggle-row:has(.toggle input:checked)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--hc-amber-lit), var(--hc-amber));
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.55);
}

/* A switch that reveals sub-settings keeps its group together: no hairline
   between the switch and the panel it opens. The display test matters, because
   adjacency does not care whether the panel is visible: five of the six automod
   filters default to off, and without this test five dividers would vanish from
   the one page this layer is aimed at. Both spellings are checked, the
   server-rendered "display:none" and the "display: none" the browser writes
   back after the JS sets it. */
.card > .toggle-row:has(+ div:not([class]):not([style*="display:none"]):not([style*="display: none"])) {
  border-bottom-color: transparent;
}

/* ── Revealed sub-settings ──────────────────────────────────────────────────
   Every conditional panel in the product is a classless div carrying only an id
   and an inline style. Indenting them behind an amber rail is the second level
   of structure the cards always had and never showed. padding-left needs
   !important because the markup sets the padding shorthand inline. */
.card > .toggle-row + div:not([class]) {
  margin: 2px 0 6px 4px;
  padding-left: 20px !important;
  border-left: 2px solid var(--hc-amber-edge);
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.045), transparent 62%);
}

.card > .toggle-row + div:not([class]) .form-group {
  padding: 9px 0;
  margin-bottom: 0;
  border-bottom: none;
}

.card > .toggle-row + div:not([class]) .form-group:first-child { padding-top: 2px; }
.card > .toggle-row + div:not([class]) .form-group:last-child { padding-bottom: 2px; }

/* Two fields side by side. */
.input-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }

.input-row .form-group {
  flex: 1 1 170px;
  display: block;
  padding: 0;
  margin-bottom: 0;
  border-bottom: none;
}

/* ── Two-column settings row ────────────────────────────────────────────────
   The one change that stops these pages reading as a form. A label sitting on
   top of its input is what a template does; a description column beside a
   control column is what a settings surface does. Grid auto-placement handles
   every shape the markup produces: a colour swatch row, variable chips or a
   nested input-row all land in the control column under the control above them,
   with no markup change.

   Scoped to form-groups that are a direct child of a card or of a reveal panel,
   which keeps it away from modals, the 340px live preview rail, the builder
   cards and the flex pairs inside the automod panels. Where :has() is not
   supported the block simply does not apply and the stacked layout renders,
   which is a valid state rather than a broken one. */
@media (min-width: 1000px) {
  .card > .form-group:has(> .form-label),
  .card > div:not([class]):not([style*="flex"]) > .form-group:has(> .form-label) {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 30rem);
    column-gap: 2rem;
    row-gap: 8px;
    align-items: start;
  }

  .card > .form-group:has(> .form-label) > *,
  .card > div:not([class]):not([style*="flex"]) > .form-group:has(> .form-label) > * {
    grid-column: 2;
    min-width: 0;
  }

  .card > .form-group:has(> .form-label) > .form-label,
  .card > div:not([class]):not([style*="flex"]) > .form-group:has(> .form-label) > .form-label {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0;
    padding-top: 8px;
  }

  .card > .form-group:has(> .form-label) > .form-hint,
  .card > div:not([class]):not([style*="flex"]) > .form-group:has(> .form-label) > .form-hint {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
    padding-right: 14px;
  }
}

/* ── The module switch in the page header ───────────────────────────────────
   The most consequential control on each of the 25 pages looked like the least:
   a grey word next to a switch. It is now a pill that states the module's state
   in the brand colour. The !important declarations cancel the inline
   border:none;padding:0 the markup writes on these seven rows. */
.page-header .toggle-row {
  padding: 6px 8px 6px 14px !important;
  border: 1px solid var(--hc-line) !important;
  border-radius: 999px;
  background: var(--hc-raised);
  transition: border-color var(--transition), background var(--transition);
}

.page-header .toggle-row .module-name {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--hc-meta);
  transition: color var(--transition);
}

.page-header .toggle-row:has(input:checked) {
  border-color: var(--hc-amber-edge) !important;
  background: var(--hc-amber-wash);
}

.page-header .toggle-row:has(input:checked) .module-name { color: var(--hc-amber-lit); }

/* ── Fields ─────────────────────────────────────────────────────────────────
   Wells cut into the panel rather than flat boxes laid on top of it. That
   difference in plane is most of what reads as depth. */
.input,
.select,
.textarea,
.tag-input-wrap {
  width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 9px 12px;
  border: 1px solid var(--hc-field-line);
  border-radius: 9px;
  background-color: var(--hc-field);
  background-image: linear-gradient(180deg, var(--hc-field), var(--hc-field-top));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
  outline: none;
  appearance: none;
}

/* background-COLOR in every state, never the background shorthand: the
   shorthand resets background-image and would wipe the select chevron. */
.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled),
.tag-input-wrap:hover { border-color: var(--hc-field-line-hi); }

.input:focus,
.select:focus,
.textarea:focus,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.tag-input-wrap:focus-within {
  border-color: var(--hc-amber);
  background-color: #17130c;
  box-shadow: var(--hc-ring), inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.input::placeholder,
.textarea::placeholder,
.tag-input-field::placeholder { color: var(--text-dim); }

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background-image: none;
  background-color: rgba(255, 255, 255, 0.02);
}

/* 20 selects in app.js carry class="input" instead of class="select". They
   inherit appearance:none and were rendering with no chevron at all. */
.select,
select.input {
  padding-right: 34px;
  cursor: pointer;
  background-image: var(--hc-chev), linear-gradient(180deg, var(--hc-field), var(--hc-field-top));
  background-repeat: no-repeat, repeat;
  background-position: right 12px center, 0 0;
  background-size: 12px 8px, auto;
}

.select:focus,
select.input:focus {
  background-image: var(--hc-chev-lit), linear-gradient(180deg, var(--hc-field), var(--hc-field-top));
}

/* A multi-select has no single value, so it must not claim a chevron. */
.select[multiple] {
  padding-right: 12px;
  cursor: default;
  background-image: linear-gradient(180deg, var(--hc-field), var(--hc-field-top));
}

.select[multiple] option { padding: 5px 8px; border-radius: 5px; }

.select option,
select.input option { background: #16161a; color: var(--text); }

.select-search-input {
  min-width: 150px;
  margin-bottom: 6px;
}

.select-search-empty {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 6px;
}

.select-search-empty[hidden] { display: none; }

/* Eight textareas in app.js carry class="input" rather than class="textarea". */
.textarea,
textarea.input {
  resize: vertical;
  min-height: 100px;
  line-height: 1.55;
  padding-right: 12px;
  cursor: auto;
  background-image: linear-gradient(180deg, var(--hc-field), var(--hc-field-top));
}

input[type="number"].input {
  font-family: var(--font);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

input[type="number"].input::-webkit-inner-spin-button,
input[type="number"].input::-webkit-outer-spin-button { opacity: 0.6; }

input[type="color"].color-input {
  width: 46px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--hc-field-line);
  border-radius: 9px;
  background: var(--hc-field);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="color"].color-input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].color-input::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type="color"].color-input:hover { border-color: var(--hc-field-line-hi); }

input[type="color"].color-input:focus-visible {
  border-color: var(--hc-amber);
  box-shadow: var(--hc-ring);
  outline: none;
}

/* ── The switch ─────────────────────────────────────────────────────────────
   It was --success green. landing.css already draws this dashboard with an
   amber switch and a #140d00 knob, so the live product was the half that
   disagreed with its own marketing. Geometry is unchanged (42x24 track, 18px
   knob, 18px travel) and focus is an outline rather than a box-shadow, so
   nothing shifts by a pixel.

   The checkbox is opacity:0;width:0, so before this there was no visible focus
   state at all on the most-used control in the product. */
.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #1e1e22, #26262b);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background var(--transition), box-shadow var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #85858e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  transition: transform var(--transition), background var(--transition);
}

.toggle input:checked + .toggle-track {
  background: linear-gradient(180deg, var(--hc-amber-lit), var(--hc-amber));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(245, 158, 11, 0.55),
    0 0 14px -2px rgba(245, 158, 11, 0.6);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--hc-ink);
}

.toggle:hover .toggle-track {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.toggle:hover input:checked + .toggle-track {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 0 0 1px rgba(245, 158, 11, 0.75),
    0 0 20px -2px rgba(245, 158, 11, 0.8);
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--hc-amber-lit);
  outline-offset: 3px;
}

.toggle input:disabled + .toggle-track { opacity: 0.4; cursor: not-allowed; }

/* ── Slider ─────────────────────────────────────────────────────────────────
   Was a 4px grey line with a dot on it, which is the browser default with a
   coat of paint. It now has real fill to the left of the thumb in both engines:
   on WebKit the spread of a very wide box-shadow is clipped by the track's own
   overflow, on Firefox ::-moz-range-progress does it directly. Fill is what
   makes it read as a value you are setting rather than a decoration. */
.slider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #0c0c0e, #141417);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  overflow: hidden;
  outline: none;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.slider:hover { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.16); }
.slider:focus-visible { outline: 2px solid var(--hc-amber-lit); outline-offset: 2px; }
.slider:disabled { opacity: 0.45; cursor: not-allowed; }

.slider::-webkit-slider-runnable-track {
  height: 20px;
  background: transparent;
  border-radius: 999px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #fffdf8, #e4dfd6);
  cursor: grab;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.6),
    -1000px 0 0 993px rgba(245, 158, 11, 0.85);
}

.slider:active::-webkit-slider-thumb { cursor: grabbing; }

.slider::-moz-range-track { height: 20px; background: transparent; border-radius: 999px; }

.slider::-moz-range-progress {
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.55), var(--hc-amber));
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #fffdf8, #e4dfd6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.6);
  cursor: grab;
}

.slider-wrap { display: flex; align-items: center; gap: 14px; }

.slider-value {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--hc-amber-text);
  min-width: 56px;
  text-align: center;
  padding: 5px 10px;
  border: 1px solid var(--hc-amber-edge);
  border-radius: 8px;
  background: var(--hc-amber-wash);
  flex-shrink: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────────
   The old hover dropped every button in the product to 85% opacity, which reads
   as receding at the exact moment the user committed to it. Each variant has
   its own hover now, and the primary is the marketing site's recipe verbatim. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), color var(--transition), transform 120ms ease;
}

.btn:hover { opacity: 1; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--hc-amber-lit); outline-offset: 2px; }

.btn:disabled,
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: saturate(0.4);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--hc-amber-lit), var(--hc-amber));
  color: var(--hc-ink);
  font-weight: 700;
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 20px -8px rgba(245, 158, 11, 0.75);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fcd34d, var(--hc-amber-lit));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 12px 30px -10px rgba(245, 158, 11, 0.85);
}

.btn-secondary {
  background: var(--hc-raised);
  color: var(--text);
  border-color: #35353d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover { background: var(--hc-raised-hi); border-color: #4a4a53; }

.btn-ghost {
  background: transparent;
  color: var(--hc-meta);
  border-color: var(--hc-line);
}

.btn-ghost:hover {
  color: var(--hc-amber-lit);
  border-color: var(--hc-amber-edge);
  background: var(--hc-amber-wash);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.13);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.34);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fecaca;
}

.btn-danger:focus-visible { outline-color: #f87171; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 3px 9px; font-size: 11.5px; border-radius: 7px; gap: 5px; }

/* The row-delete control in every table and every escalation row is a bare
   multiplication sign. Squared off it reads as an icon button. */
.table .btn-danger.btn-xs,
.escalation-row .btn-danger.btn-xs {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

/* ── Tables ─────────────────────────────────────────────────────────────────
   A bordered box floating inside a padded box is the tell of a component
   library. A table that is a direct child of a normal card now runs to the
   panel edges, and its outer cells are padded back to the card's own content
   margin so the columns still line up with the text above them. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hc-line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.card:not([style*="padding"]) > .table-wrap {
  margin-inline: calc(var(--hc-pad) * -1);
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.card:not([style*="padding"]) > .table-wrap:last-child {
  margin-bottom: calc(var(--hc-pad) * -1);
  border-bottom: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

.card:not([style*="padding"]) > .table-wrap .table th:first-child,
.card:not([style*="padding"]) > .table-wrap .table td:first-child { padding-left: var(--hc-pad); }
.card:not([style*="padding"]) > .table-wrap .table th:last-child,
.card:not([style*="padding"]) > .table-wrap .table td:last-child { padding-right: var(--hc-pad); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
  font-family: var(--font);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hc-desc);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.14));
  border-bottom: 1px solid var(--hc-line);
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text);
  border-bottom: 1px solid var(--hc-line-soft);
}

.table tbody tr {
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition);
}

.table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.016); }

.table tbody tr:hover {
  background: rgba(245, 158, 11, 0.055);
  box-shadow: inset 2px 0 0 var(--hc-amber);
}

/* Tabbing into a cell's own field lights the row the same way hovering does. */
.table tbody tr:focus-within {
  background: rgba(245, 158, 11, 0.075);
  box-shadow: inset 2px 0 0 var(--hc-amber-lit);
}

.table tbody tr:last-child td { border-bottom: none; }

/* Controls in a cell should not carry the full-size padding rhythm. */
.table td .input,
.table td .select { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.table td .select { padding-right: 28px; background-position: right 9px center, 0 0; }

/* ── Tags and chips ─────────────────────────────────────────────────────────*/
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  min-height: 42px;
  cursor: text;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 9px;
  background: var(--hc-raised-hi);
  border: 1px solid #3a3a42;
  border-radius: 7px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 12px;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background var(--transition), border-color var(--transition);
}

.tag:hover { background: rgba(255, 255, 255, 0.11); border-color: #4d4d57; }

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.tag-remove:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.tag-remove:focus-visible { outline: 2px solid var(--hc-amber-lit); outline-offset: 1px; color: var(--text); }

.tag-input-field {
  flex: 1;
  min-width: 120px;
  padding: 2px 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}

.variable-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.var-chip {
  padding: 3px 9px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 6px;
  background: var(--hc-amber-wash);
  color: var(--hc-amber-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 120ms ease;
}

.var-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--hc-amber);
  transform: translateY(-1px);
}

/* ── Badges ─────────────────────────────────────────────────────────────────
   Only -accent, -muted and -success are ever emitted, so only those three are
   defined. -accent is the one that marks a paid feature, so it gets the mark. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
}

.badge-accent {
  background: var(--hc-amber-wash);
  color: var(--hc-amber-text);
  border-color: var(--hc-amber-edge);
}

.badge-accent::before {
  content: '';
  width: 6px;
  height: 7px;
  flex-shrink: 0;
  background: currentColor;
  clip-path: var(--hc-hex);
}

.badge-success { background: rgba(34, 197, 94, 0.14); color: #4ade80; border-color: rgba(34, 197, 94, 0.32); }
.badge-muted { background: var(--hc-raised); color: #c2c2c9; border-color: var(--hc-line); }

/* ── Escalation ladder ──────────────────────────────────────────────────────
   The two fields inside these rows carry inline max-widths, which beat any rule
   written here, so only the container is styled. */
.escalation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid var(--hc-line);
  border-left: 2px solid var(--hc-amber-edge);
  border-radius: 9px;
  background: var(--hc-raised);
  transition: border-color var(--transition), background var(--transition);
}

.escalation-row:focus-within {
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--hc-amber-wash);
}

/* ── Tabs and section furniture ─────────────────────────────────────────────*/
.content .tab { color: var(--text-muted); }
.content .tab:hover { color: var(--text); }
.content .tab:focus-visible { outline: 2px solid var(--hc-amber-lit); outline-offset: -2px; border-radius: 7px 7px 0 0; }
.content .tab.active .tab-count { background: var(--hc-amber); color: var(--hc-ink); }

.content .preview-label {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 9px;
}

/* ── Danger zone ────────────────────────────────────────────────────────────*/
.danger-zone {
  padding: 20px 24px;
  margin-top: 24px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 150px at 0% 0%, rgba(239, 68, 68, 0.09), transparent 70%),
    rgba(255, 255, 255, 0.015);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.danger-zone-title {
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #fca5a5;
  margin-bottom: 8px;
}

/* ── Empty and error states ─────────────────────────────────────────────────
   21 empty states hardcode an emoji in the template strings. The identity is no
   emoji anywhere, and an emoji renders differently on every operating system,
   which is the fastest way to look like a template. app.js is out of scope, so
   the glyph is collapsed to nothing and the hexagon is drawn in its place. */
.empty-state {
  padding: 40px 24px;
  border: 1px dashed rgba(245, 158, 11, 0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.05));
  color: var(--hc-desc);
  text-align: center;
}

.empty-state-icon {
  display: block;
  width: 52px;
  height: 58px;
  margin: 0 auto 14px;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: var(--hc-hexmark) center / contain no-repeat;
}

.empty-state h3 {
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  color: var(--hc-title);
  margin-bottom: 7px;
}

.empty-state p { font-size: 13px; line-height: 1.55; max-width: 46ch; margin: 0 auto; }

.error-state { padding: 44px 24px; color: var(--hc-desc); text-align: center; }
.error-state h3 { font-family: var(--font); font-size: 15px; color: #fca5a5; margin-bottom: 8px; }

/* ── Modal ──────────────────────────────────────────────────────────────────*/
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 4, 6, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn 150ms ease;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012) 160px),
    #141416;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  animation: slideUp 200ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--hc-line);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--hc-raised-hi); color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--hc-amber-lit); outline-offset: 1px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Form rows inside a modal, a builder card, an entity card or the live preview
   rail stay compact and stacked: none of those hosts is wide enough for two
   columns, and none of them wants the settings-list hairlines. */
.modal .form-group,
.builder-body .form-group,
.preview-col .form-group,
.entity-card .form-group {
  display: block;
  padding: 0 0 14px;
  margin-bottom: 0;
  border-bottom: none;
}

.modal .form-group:last-child,
.builder-body .form-group:last-child,
.preview-col .form-group:last-child,
.entity-card .form-group:last-child { padding-bottom: 0; }

/* ── Down to 375px ──────────────────────────────────────────────────────────*/
@media (max-width: 768px) {
  .card { --hc-pad: 16px; }

  .card:not([style*="padding"]) > .card-title:first-child,
  .card:not([style*="padding"]) > .card-header:first-child,
  .card:not([style*="padding"]) > h3:first-child {
    padding: 12px var(--hc-pad) 11px;
    margin-bottom: 8px !important;
  }

  .card > .form-group { padding: 13px 0; }
  .card > .toggle-row { gap: 12px; padding-block: 13px; }

  .card > .toggle-row + div:not([class]) {
    margin-left: 2px;
    padding-left: 14px !important;
  }

  .page-header .toggle-row { padding: 5px 7px 5px 12px !important; }

  .table th,
  .table td { padding: 10px 12px; }

  .slider-wrap { gap: 10px; }
  .slider-value { min-width: 48px; padding: 4px 8px; }
  .btn { padding: 9px 14px; }
  .modal { padding: 20px; }
  .empty-state { padding: 30px 16px; }
  .empty-state-icon { width: 42px; height: 47px; }
}

@media (max-width: 430px) {
  .toggle-info .toggle-desc,
  .form-hint { font-size: 12px; max-width: none; }

  .card-header { align-items: flex-start; }
  .escalation-row { padding: 10px 12px; }

  /* The inline max-widths on these two fields have to be beaten, or the row
     cannot wrap sensibly on a phone. */
  .escalation-row .input,
  .escalation-row .select { max-width: none !important; flex: 1 1 90px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────────
   Everything above is state feedback, never information, so all of it can go.
   Transforms are neutralised as well as durations, otherwise a hover would
   still jump an element by a pixel with no transition to soften it. The vendor
   pseudo-element sits in its own rule on purpose: a top level selector list is
   not forgiving, so one unrecognised entry would drop the whole rule and
   silently void the setting. */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card > .toggle-row,
  .card-title::before,
  .toggle-track,
  .toggle-track::after,
  .input, .select, .textarea, .tag, .tag-remove, .tag-input-wrap,
  .slider, .btn, .var-chip, .table tbody tr, .modal-close,
  .escalation-row, .page-header .toggle-row, .page-header .toggle-row .module-name,
  input[type="color"].color-input {
    transition: none !important;
  }

  .slider::-webkit-slider-thumb { transition: none !important; }

  .btn:hover,
  .btn:active,
  .var-chip:hover,
  .stat-card:hover,
  .template-card:hover,
  .server-card:hover { transform: none !important; }

  /* Pre-existing keyframes that were never covered before. The spinner is left
     alone: it is the only animation carrying information the user cannot get
     anywhere else on the page. */
  .skeleton { animation: none !important; background: rgba(255, 255, 255, 0.05); }

  .toast,
  .modal,
  .modal-overlay,
  .cmdk-overlay,
  .cmdk-modal { animation: none !important; }

  .toast.hide { transition: opacity 1ms linear !important; transform: none; }
}

/* ── Light theme ────────────────────────────────────────────────────────────
   The same structure on light stock. Written as :root[data-theme="light"] so it
   outranks the older [data-theme="light"] rules further down the sheet, several
   of which set the background shorthand on fields and would otherwise wipe the
   select chevron.

   --hc-amber-lit is deliberately not remapped to a darker amber: it is the
   light stop of the primary button gradient and the on state of the switch, and
   darkening it there would drop #140d00 on the Save button below 4.5:1. Amber
   used as text points at --hc-amber-text instead, which is #97490a and measures
   6.0:1 on the white card. */
:root[data-theme="light"] {
  --hc-title: #16161a;
  --hc-desc: #5c5c64;
  --hc-meta: #4d4d55;
  --hc-line: rgba(0, 0, 0, 0.09);
  --hc-line-soft: rgba(0, 0, 0, 0.065);
  --hc-field: #ffffff;
  --hc-field-top: #faf9f5;
  --hc-field-line: #d8d5cd;
  --hc-field-line-hi: #b9b5aa;
  --hc-raised: rgba(0, 0, 0, 0.035);
  --hc-raised-hi: rgba(0, 0, 0, 0.07);
  --hc-amber-wash: rgba(245, 158, 11, 0.13);
  --hc-amber-edge: rgba(180, 83, 9, 0.38);
  --hc-amber-text: #97490a;
  --hc-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235c5c64' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --hc-chev-lit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2397490a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* #5c5c64 on the white card measures 6.6:1 and #6b6b73 measures 5.3:1. The
   shipped light values (#6b6b6b muted, #a8a8a8 dim) put dim text at 2.5:1. */
:root[data-theme="light"] .main,
:root[data-theme="light"] .modal-overlay,
:root[data-theme="light"] .cmdk-overlay,
:root[data-theme="light"] #toast-container {
  --text-muted: #5c5c64;
  --text-dim: #6b6b73;
}

:root[data-theme="light"] .card {
  background: linear-gradient(180deg, #ffffff, #fcfbf7);
  border-color: #e4e1da;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 28px -14px rgba(0, 0, 0, 0.14);
}

:root[data-theme="light"] .card:not([style*="padding"]) > .card-title:first-child,
:root[data-theme="light"] .card:not([style*="padding"]) > .card-header:first-child,
:root[data-theme="light"] .card:not([style*="padding"]) > h3:first-child {
  background: var(--hc-comb), linear-gradient(180deg, #faf8f3, #f4f2ea);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .textarea,
:root[data-theme="light"] .tag-input-wrap {
  color: #1a1a1a;
  background-color: var(--hc-field);
  background-image: linear-gradient(180deg, var(--hc-field-top), var(--hc-field));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .select,
:root[data-theme="light"] select.input {
  background-image: var(--hc-chev), linear-gradient(180deg, var(--hc-field-top), var(--hc-field));
}

:root[data-theme="light"] .select:focus,
:root[data-theme="light"] select.input:focus {
  background-image: var(--hc-chev-lit), linear-gradient(180deg, var(--hc-field-top), var(--hc-field));
}

:root[data-theme="light"] .input:focus,
:root[data-theme="light"] .textarea:focus,
:root[data-theme="light"] .select:focus,
:root[data-theme="light"] .tag-input-wrap:focus-within {
  background-color: #fffdf6;
  box-shadow: var(--hc-ring), inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .select option,
:root[data-theme="light"] select.input option { background: #ffffff; color: #1a1a1a; }

:root[data-theme="light"] .toggle-track {
  background: linear-gradient(180deg, #e6e3db, #d9d6cd);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .toggle-track::after { background: #ffffff; }
:root[data-theme="light"] .card > .toggle-row:hover { background: rgba(0, 0, 0, 0.025); }

:root[data-theme="light"] .card > .toggle-row:has(.toggle input:checked) {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.13), rgba(245, 158, 11, 0.03) 45%, transparent 75%);
}

:root[data-theme="light"] .card > .toggle-row + div:not([class]) {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.09), transparent 62%);
}

:root[data-theme="light"] .table-wrap { background: #ffffff; }

:root[data-theme="light"] .table th {
  color: #4b463f;
  background: linear-gradient(180deg, #f4f2ea, #faf9f5);
}

:root[data-theme="light"] .table td { color: #1a1a1a; }
:root[data-theme="light"] .table tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.02); }
:root[data-theme="light"] .table tbody tr:hover { background: rgba(245, 158, 11, 0.1); }

:root[data-theme="light"] .slider {
  background: linear-gradient(180deg, #e0ddd4, #ebe8e0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .slider::-webkit-slider-thumb {
  background: linear-gradient(180deg, #ffffff, #f1efe8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.25), -1000px 0 0 993px rgba(245, 158, 11, 0.9);
}

:root[data-theme="light"] .btn-secondary { background: #ffffff; border-color: #d8d5cd; color: #1a1a1a; }
:root[data-theme="light"] .btn-secondary:hover { background: #f4f2ea; }
:root[data-theme="light"] .btn-ghost { color: #4d4d55; border-color: #d8d5cd; }
:root[data-theme="light"] .btn-ghost:hover { color: var(--hc-amber-text); }
:root[data-theme="light"] .btn-danger { background: rgba(239, 68, 68, 0.09); color: #b91c1c; }
:root[data-theme="light"] .btn-danger:hover { background: rgba(239, 68, 68, 0.16); color: #991b1b; }

:root[data-theme="light"] .badge-success { color: #15803d; }
:root[data-theme="light"] .badge-muted { color: #4d4d55; }

:root[data-theme="light"] .tag { background: #f4f2ea; border-color: #dcd9d0; color: #1a1a1a; }
:root[data-theme="light"] .empty-state { background: linear-gradient(180deg, rgba(0, 0, 0, 0.022), rgba(0, 0, 0, 0.008)); }

:root[data-theme="light"] .modal {
  background: #ffffff;
  border-color: #e4e1da;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] .modal-overlay { background: rgba(30, 26, 18, 0.42); }

:root[data-theme="light"] .danger-zone {
  background: radial-gradient(420px 150px at 0% 0%, rgba(239, 68, 68, 0.07), transparent 70%), #fffdfd;
}

:root[data-theme="light"] .danger-zone-title { color: #b91c1c; }
/* ── Welcome card background upload ─────────────────────────────────────────── */
.cardbg-preview {
  /* Same ratio the card is drawn at, so what you see is what gets sent. */
  aspect-ratio: 1000 / 400;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(20, 20, 20, 0.9));
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 10px;
}

.cardbg-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Rendered card preview. The real PNG the bot produces, not a CSS mock, because a
   mock is exactly what let a clipped layout ship unnoticed. */
.cardlive { margin-bottom: 18px; }

.cardlive-frame {
  position: relative;
  aspect-ratio: 1000 / 400;
  width: 100%;
  max-width: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    repeating-conic-gradient(var(--bg-muted) 0% 25%, transparent 0% 50%) 0 0 / 18px 18px;
}

.cardlive-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: opacity 0.18s ease;
}

.cardlive-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.cardlive-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 620px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.cardlive-foot .btn { flex: 0 0 auto; }

@media (max-width: 560px) {
  .cardlive-foot { flex-direction: column; align-items: flex-start; }
}


.cardbg-empty {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.cardbg-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cardbg-status { font-size: 12px; color: var(--text-muted); }
.cardbg-status.good { color: var(--success); }
.cardbg-status.bad { color: var(--danger); }
.cardbg-status.muted { color: var(--text-muted); }

/* ── Import from another bot ─────────────────────────────────────────────────── */
.import-src {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.018);
  padding: 13px 14px;
  margin-bottom: 10px;
}

.import-src-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.import-src-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
}

.import-src-note { font-size: 11.5px; color: var(--text-muted); }
.import-src-note code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

/* The preview and result panel. Amber while it is a proposal, green once written,
   red on a refusal, so the state is readable without reading the sentence. */
.import-result {
  margin-top: 4px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-lit, rgba(245, 158, 11, 0.28));
  background: rgba(245, 158, 11, 0.06);
  font-size: 12.5px;
  line-height: 1.6;
}

.import-result.good { border-color: rgba(34, 197, 94, 0.32); background: rgba(34, 197, 94, 0.08); }
.import-result.bad { border-color: rgba(239, 68, 68, 0.32); background: rgba(239, 68, 68, 0.08); }
.import-result.warn { border-color: rgba(234, 179, 8, 0.32); background: rgba(234, 179, 8, 0.07); }

.import-note { color: var(--text-muted); font-size: 11.5px; margin-top: 6px; }

.import-samples {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.import-sample {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Import page ──────────────────────────────────────────────────────────────
   Three steps, and the source list is the first one because what you can do next
   depends entirely on which bot you are leaving. */
.imp-promise {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: var(--radius);
  background: rgba(34, 197, 94, 0.07);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.imp-promise b { color: var(--text); font-weight: 600; }

.imp-promise-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: #22c55e;
}

.imp-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.imp-step-n {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}

.imp-src-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
}

.imp-src {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.imp-src:hover { border-color: rgba(245, 158, 11, 0.45); transform: translateY(-1px); }

.imp-src.selected {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.09);
}

.imp-src-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.imp-src-name { font-size: 13.5px; font-weight: 600; color: var(--text); }

.imp-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* The method is the thing people need to know before clicking, so it is colour
   coded rather than buried in the description. */
.imp-tag-direct { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.imp-tag-key { background: rgba(59, 130, 246, 0.16); color: #7dabfa; }
.imp-tag-file { background: rgba(148, 163, 184, 0.16); color: var(--text-dim); }

.imp-src-blurb { font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }

.imp-src-kinds { display: flex; flex-wrap: wrap; gap: 5px; }

.imp-kind {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-dim);
}

.imp-kinds { display: flex; flex-wrap: wrap; gap: 10px; }

.imp-kind-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.imp-kind-opt:has(input:checked) {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.09);
}

.imp-kind-fixed {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.imp-kind-fixed span { font-size: 11.5px; color: var(--text-muted); }

.imp-how {
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 70ch;
}

.imp-how code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  font-size: 11.5px;
}

.imp-field { max-width: 560px; }

.imp-drop {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 26px 18px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.imp-drop:hover, .imp-drop.over {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.07);
}

.imp-drop svg { width: 26px; height: 26px; color: var(--text-dim); margin-bottom: 2px; }
.imp-drop.over svg { color: var(--accent); }
.imp-drop-main { font-size: 13px; color: var(--text); }
.imp-drop-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.imp-drop-sub { font-size: 11.5px; color: var(--text-muted); }

/* The pointer left behind on Leveling and Economy, where people used to find the
   import controls before they moved to their own page. */
.imp-pointer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Appearance page ─────────────────────────────────────────────────────────
   Control on the left, a Discord-shaped preview on the right, so the choice is
   visible rather than a hex value you have to imagine. */
.thm-list { display: grid; gap: 4px; }

.thm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 22px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.thm-row:last-child { border-bottom: 0; }

.thm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.thm-name { font-size: 13.5px; font-weight: 600; color: var(--text); }

.thm-default {
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.thm-desc {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 60ch;
}

.thm-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.thm-hex {
  width: 104px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  text-transform: lowercase;
}

/* Shaped like a Discord embed: the colour is the left bar, which is the only place
   an embed colour actually shows. A filled swatch would be misleading. */
.thm-embed {
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 10px 13px;
  background: var(--elevated);
}

.thm-embed-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.thm-embed-body { font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.thm-embed-foot { margin-top: 7px; font-size: 10.5px; color: var(--text-dim); }

.thm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.thm-status { font-size: 12px; color: var(--text-muted); }
.thm-status.good { color: #4ade80; }
.thm-status.bad { color: #f87171; }
.thm-status.muted { color: var(--text-dim); }

@media (max-width: 780px) {
  .thm-row { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Ticket analytics ────────────────────────────────────────────────────────
   The peak-hours strip is a heat scale rather than 24 bars: at dashboard width a
   24-bar chart is a picket fence, and what people want is to spot the dark patch. */
.ta-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.ta-ctl { display: grid; gap: 5px; }
.ta-ctl > span { font-size: 11.5px; color: var(--text-muted); }
.ta-ctl .select { min-width: 190px; }

.ta-plan {
  font-size: 11.5px;
  color: var(--text-dim);
  padding-bottom: 9px;
}

.ta-note {
  padding: 11px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius);
  background: rgba(234, 179, 8, 0.07);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.ta-sub {
  margin: 0 0 14px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 76ch;
}

.ta-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.ta-tile {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
}

.ta-tile.warn { border-color: rgba(234, 179, 8, 0.35); }
.ta-tile.bad { border-color: rgba(239, 68, 68, 0.4); }
.ta-tile-n { font-family: var(--font); font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.ta-tile-l { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }

.ta-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.ta-stat {
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
}

.ta-stat-label { font-size: 11.5px; color: var(--text-muted); }
.ta-stat-value { margin-top: 4px; font-family: var(--font); font-size: 23px; font-weight: 700; color: var(--text); }
.ta-stat-sub { margin-top: 3px; font-size: 11px; color: var(--text-dim); }
.ta-stat-hint { margin-top: 7px; font-size: 11px; line-height: 1.5; color: var(--text-muted); }

/* Hour strip */
.ta-hours {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  margin-bottom: 22px;
}

.ta-hour { display: grid; gap: 4px; }

.ta-hour-bar {
  display: block;
  height: 42px;
  border-radius: 3px;
  border: 1px solid var(--border);
  /* The intensity comes through as a custom property so one rule covers all 24. The
     flat fallback first, so a browser without color-mix shows a visible strip rather
     than 24 empty boxes. */
  background: var(--elevated);
  background: color-mix(in srgb, var(--accent) calc(var(--i) * 100%), transparent);
}

.ta-hour-tick { font-size: 9.5px; text-align: center; color: var(--text-dim); }

/* Weekday columns */
.ta-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
}

.ta-day { display: grid; gap: 5px; justify-items: center; }
.ta-day-track {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: flex-end;
  border-radius: 4px;
  background: var(--elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ta-day-fill { width: 100%; background: var(--accent); min-height: 2px; }
.ta-day-label { font-size: 11px; color: var(--text-muted); }
.ta-day-count { font-size: 11px; font-weight: 600; color: var(--text); }

/* Opened vs closed per day */
.ta-vols {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 130px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.ta-vol {
  flex: 1 1 0;
  min-width: 6px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.ta-vol-open, .ta-vol-closed {
  flex: 1 1 0;
  min-height: 1px;
  border-radius: 2px 2px 0 0;
}
.ta-vol-open { background: var(--accent); }
.ta-vol-closed { background: rgba(34, 197, 94, 0.75); }

.ta-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: baseline; }
.ta-key-open { background: var(--accent); }
.ta-key-closed { background: rgba(34, 197, 94, 0.75); }

/* Close-reason bars */
.ta-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr 40px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}
.ta-bar-label { color: var(--text-muted); }
.ta-bar-track { height: 8px; border-radius: 999px; background: var(--elevated); border: 1px solid var(--border); overflow: hidden; }
.ta-bar-fill { display: block; height: 100%; background: var(--accent); }
.ta-bar-value { text-align: right; font-weight: 600; color: var(--text); }

.ta-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 20px;
}

.ta-list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.8; color: var(--text-muted); }
.ta-empty { color: var(--text-dim); font-size: 12px; }
.ta-id { font-size: 10.5px; color: var(--text-dim); font-weight: 400; }

@media (max-width: 620px) {
  .ta-hours { grid-template-columns: repeat(12, 1fr); }
  .ta-bar-row { grid-template-columns: 1fr 40px; }
  .ta-bar-track { grid-column: 1 / -1; }
}

/* Escalation row controls. Named rather than styled by tag, because the row grew a
   third control and the old blanket .input rule squashed it. */
.esc-lead { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.escalation-row .esc-count { max-width: 72px; }
.escalation-row .esc-action { max-width: 168px; }
.escalation-row .esc-duration { max-width: 132px; }
.escalation-row .esc-duration[hidden] { display: none; }

@media (max-width: 560px) {
  .escalation-row .esc-action,
  .escalation-row .esc-duration { max-width: none; flex: 1 1 120px; }
}

.esc-empty, .esc-note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 70ch;
}

.esc-empty {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Health banner ───────────────────────────────────────────────────────────
   Sits above everything else on the overview, because a module that is on and
   cannot fire is the one thing worth interrupting for. */
.hb {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 15px 17px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.hb b { color: var(--text); font-weight: 600; }
.hb-body { flex: 1 1 auto; min-width: 0; }

.hb-icon { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; }

.hb-ok { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.06); }
.hb-ok .hb-icon { color: #22c55e; }

.hb-warn { border-color: rgba(234, 179, 8, 0.35); background: rgba(234, 179, 8, 0.07); }
.hb-warn .hb-icon { color: #eab308; }

.hb-bad { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.07); }
.hb-bad .hb-icon { color: #ef4444; }

.hb-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.hb-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.hb-text { flex: 1 1 auto; min-width: 0; }

.hb-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
}

.hb-blocked .hb-dot { background: #ef4444; }
.hb-degraded .hb-dot { background: #eab308; }

.hb-row .btn { flex: 0 0 auto; margin-top: -2px; }

/* A tile that is switched on but cannot work. The ring is deliberately not the same
   amber as an ordinary "on" tile, or the two read the same at a glance. */
.module-tile.issue-blocked {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.07);
}

.module-tile.issue-blocked .module-state { color: #f87171; }

.module-tile.issue-degraded {
  border-color: rgba(234, 179, 8, 0.5);
}

.module-tile.issue-degraded .module-state { color: #eab308; }

@media (max-width: 560px) {
  .hb-row { flex-wrap: wrap; }
  .hb-row .btn { margin-left: 15px; }
}

/* ── Verification and Temp Voice pages ───────────────────────────────────────
   Both modules shipped with no page at all, so these are the first styles they
   have had. Deliberately reuse the existing form and card language rather than
   inventing a third one. */
.vf-status {
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-muted);
  vertical-align: middle;
}
.vf-status.good { color: #4ade80; }
.vf-status.bad { color: #f87171; }
.vf-status.muted { color: var(--text-dim); }

.tv-list { display: grid; gap: 8px; margin-bottom: 16px; }

.tv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--elevated);
}

.tv-row-main { display: grid; gap: 2px; min-width: 0; }
.tv-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tv-row-meta { font-size: 11.5px; color: var(--text-muted); }

.tv-empty {
  padding: 12px 14px;
  margin: 0 0 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
}

.tv-add {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 620px) {
  .tv-add { align-items: stretch; }
  .tv-add .btn { width: 100%; }
  .tv-row { flex-direction: column; align-items: flex-start; }
}

/* ── Chip picker ─────────────────────────────────────────────────────────────
   A list you add to and remove from, used for the XP exclusions. A multi-select
   would have been less code and much worse: you cannot see at a glance what is
   excluded, and one stray click clears the lot. */
.pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--elevated);
}

.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  font-size: 12px;
  color: var(--text);
}

.pick-x {
  border: 0;
  background: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--text-muted);
}

.pick-x:hover { color: #f87171; }
.pick-empty { font-size: 12px; color: var(--text-dim); padding-left: 2px; }
.pick-add .select { max-width: 280px; }

/* When and how often an observed problem happened, next to what it was. Without the
   count a one-off reads the same as something failing every minute. */
.hb-when {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Report a bug. The scope block is the point of the page: it says what this box is
   for before anybody types, because a form that quietly refuses what you wrote after
   you have written it is worse than one that told you first. */
.bug-scope { display: grid; gap: 10px; }
.bug-scope-row { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: start; font-size: 13px; }
.bug-scope-yes, .bug-scope-no {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 5px; text-align: center;
}
.bug-scope-yes { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.bug-scope-no { background: rgba(239, 68, 68, 0.14); color: #f87171; }
.bug-observed { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.bug-observed li { margin-bottom: 6px; }
.bug-result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.bug-result-ok { background: rgba(34, 197, 94, 0.12); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.3); }
.bug-result-warn { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.bug-list { display: grid; gap: 10px; }
.bug-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.bug-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.bug-item-body { font-size: 13px; }
.bug-item-note { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.bug-area { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.bug-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.bug-new { background: rgba(88, 101, 242, 0.16); color: #a5b4fc; }
.bug-confirmed { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.bug-not_reproducible { background: rgba(107, 114, 128, 0.18); color: #9ca3af; }
.bug-fixed { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.bug-ignored { background: rgba(107, 114, 128, 0.18); color: #9ca3af; }

/* Rank names and seasons on the leveling page. A rank is a level and a name, so the
   row is two fields and a remove, not a card. */
.rank-row { display: grid; grid-template-columns: 100px 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.rank-row .rank-del { padding: 4px 10px; line-height: 1; }
@media (max-width: 560px) { .rank-row { grid-template-columns: 80px 1fr auto; } }

.season-list { display: grid; gap: 6px; }
.season-row { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.season-no { font-family: var(--mono, monospace); color: var(--text-dim); }
.season-state { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.season-state.running { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.season-state.closed { background: rgba(107, 114, 128, 0.18); color: #9ca3af; }
.season-count { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* The starter-set preview. A list of what will be created, grouped by where it lands,
   so pressing the button is not a leap. */
.starter-group { margin-bottom: 16px; }
.starter-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 6px; }
.starter-count { background: var(--surface-2, rgba(255,255,255,0.06)); border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.starter-group ul { margin: 0; padding-left: 18px; font-size: 13px; }
.starter-group li { margin-bottom: 6px; }
.starter-resp { display: block; color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.starter-edit { font-size: 11px; color: #fcd34d; background: rgba(245,158,11,0.14); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* The role picker. Chips for what is chosen with a visible remove, and a dropdown that
   only offers what is not chosen yet. It replaces a <select multiple>, where adding a
   second role meant knowing to hold Ctrl and removing the last one was undiscoverable. */
.role-picker { display: grid; gap: 6px; }
.role-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.role-picker-empty { font-size: 12px; color: var(--text-muted); }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 4px 3px 9px; font-size: 12px; line-height: 1.4;
}
.role-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip, var(--text-muted)); flex: none; }
.role-chip-x {
  border: 0; background: transparent; color: var(--text-muted);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px;
}
.role-chip-x:hover { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.role-chip-unknown { border-style: dashed; color: var(--text-muted); }
.role-picker-add { max-width: 260px; }
.role-picker-add:disabled { opacity: 0.55; cursor: not-allowed; }

/* Layout (Components V2) messages: the live preview and the block editor. */
.cv2-message { display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; color: var(--text); }
.cv2-message > * { min-width: 0; }
.cv2-text { overflow-wrap: anywhere; word-break: break-word; }
.cv2-h { font-weight: 700; line-height: 1.25; margin: 4px 0 2px; }
.cv2-h1 { font-size: 22px; }
.cv2-h2 { font-size: 18px; }
.cv2-h3 { font-size: 15px; }
.cv2-sub { font-size: 12px; color: var(--text-muted); }
.cv2-container { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow: hidden; min-width: 0; }
.cv2-container.cv2-accent { border-left: 4px solid var(--cv2-accent, #5865f2); }
.cv2-section { display: flex; gap: 12px; align-items: flex-start; }
.cv2-section-texts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cv2-accessory { flex: 0 0 auto; max-width: 45%; }
.cv2-accessory .cv2-media { width: 72px; height: 72px; }
.cv2-accessory .message-buttons { margin-top: 0 !important; }
.cv2-media { position: relative; overflow: hidden; border-radius: 8px; background: var(--elevated); min-width: 0; }
.cv2-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cv2-media-empty { display: flex; align-items: center; justify-content: center; min-height: 64px; height: 100%; box-sizing: border-box; padding: 8px; font-size: 12px; color: var(--text-dim); border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
.cv2-gallery { display: grid; gap: 4px; border-radius: 8px; overflow: hidden; }
.cv2-g1 { grid-template-columns: minmax(0, 1fr); }
.cv2-g1 .cv2-media img { height: auto; max-height: 320px; }
.cv2-gn { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cv2-gn .cv2-media { height: 140px; }
.cv2-g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 120px; }
.cv2-g3 .cv2-media:first-child { grid-row: span 2; }
.cv2-sep-small { padding: 4px 0; }
.cv2-sep-large { padding: 10px 0; }
.cv2-sep-line::before { content: ""; display: block; height: 1px; background: var(--text-dim); opacity: 0.4; }
.cv2-spoiler { position: relative; cursor: pointer; }
.cv2-spoiler:not(.cv2-open) > * { filter: blur(18px); pointer-events: none; user-select: none; }
.cv2-spoiler:not(.cv2-open)::after { content: "SPOILER"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.cv2-spoiler.cv2-open { cursor: auto; }

.cv2-mode { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.cv2-mode-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.cv2-block { padding: 10px; margin-bottom: 8px; min-width: 0; }
.cv2-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cv2-head-title { flex: 1; min-width: 90px; font-size: 13px; font-weight: 600; }
.cv2-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.cv2-children { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--border); }
.cv2-adders { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.cv2-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.cv2-sub-card { padding: 8px; margin: 6px 0; }
.cv2-block .input, .cv2-block .select, .cv2-block textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
.cv2-acc-button .embed-button-remove, .cv2-menu-body .embed-menu-remove { display: none; }
.cv2-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.cv2-only { display: none; }
.embed-mode-layout .cv2-only { display: block; }
.embed-mode-layout .embed-classic-only { display: none !important; }

/* Member roles */
.member-roles-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.member-roles-grid > .card { min-width: 0; }
.member-role-toolbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.member-role-toolbar > .form-group { flex: 1 1 150px; margin: 0; }
.member-role-list { display: grid; gap: 10px; margin-top: 14px; }
.member-role-row { border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-width: 0; }
.member-role-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.member-role-name { font-weight: 600; overflow-wrap: anywhere; }
.member-role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.member-role-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 12px; font-size: 12px; max-width: 100%; }
.member-role-chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0; }
.member-role-disabled { opacity: .55; }
.member-role-filter { max-height: 210px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.member-role-filter label { display: flex; gap: 8px; align-items: center; padding: 5px; font-size: 13px; }
.member-role-progress { height: 10px; background: var(--elevated); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.member-role-progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.member-role-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.member-role-table th, .member-role-table td { padding: 9px 7px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.member-role-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 768px) {
  .member-roles-grid { grid-template-columns: minmax(0, 1fr); }
  .member-role-toolbar { align-items: stretch; }
  .member-role-toolbar > .form-group, .member-role-toolbar > button { flex: 1 1 100%; width: 100%; }
  .member-role-table, .member-role-table tbody, .member-role-table tr, .member-role-table td { display: block; width: 100%; box-sizing: border-box; }
  .member-role-table thead { display: none; }
  .member-role-table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .member-role-table td { border: 0; padding: 4px 0; }
}
/* Log template editor */
.log-templates-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 760px) {
  .log-templates-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Honeycomb draft workspace */
.honeycomb-page { padding-bottom: 90px; }
.hc-workspace { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.hc-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.hc-toolbar .select { width: auto; max-width: 220px; }
.hc-tree, .hc-panel { min-width: 0; padding: 16px; }
.hc-row { display: flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 7px; padding: 5px 6px; min-height: 43px; flex-wrap: wrap; }
.hc-row:hover { background: var(--elevated); }
.hc-selected { border-color: var(--accent); background: rgba(245,158,11,.08); }
.hc-select { display: flex; align-items: center; text-align: left; gap: 9px; flex: 1; min-width: 100px; color: var(--text); background: none; border: 0; cursor: pointer; padding: 6px 0; overflow-wrap: anywhere; font: inherit; font-size: 13px; }
.hc-type { width: 16px; flex-shrink: 0; color: var(--text-muted); }
.hc-order { display: flex; gap: 3px; }
.hc-order .btn { padding: 3px 7px; }
.hc-locked { opacity: .55; }
.hc-deleted .hc-select { text-decoration: line-through; opacity: .6; }
.hc-children { margin-left: 20px; padding-left: 9px; border-left: 1px solid var(--border); }
.hc-section-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; margin: 12px 0; }
.hc-panel h3 { margin-bottom: 18px; overflow-wrap: anywhere; }
.hc-panel fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.hc-panel .form-group, .hc-modal .form-group { display: block; margin-top: 14px; }
.hc-panel .input, .hc-panel .select { width: 100%; }
.hc-panel textarea { min-height: 90px; resize: vertical; }
.hc-panel-empty { padding: 24px 8px; color: var(--text-muted); font-size: 13px; line-height: 1.8; }
.hc-check { display: flex; align-items: start; gap: 9px; font-size: 12px; margin: 10px 0; }
.hc-check input { accent-color: var(--accent); margin-top: 3px; }
.hc-permission-group { border-top: 1px solid var(--border); padding: 12px 0; margin-top: 12px; }
.hc-permission-group summary { cursor: pointer; font-size: 13px; }
.hc-draftbar { position: sticky; bottom: 12px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding: 12px 18px; border: 1px solid var(--accent); border-radius: 12px; background: var(--bg); box-shadow: 0 8px 30px #0006; }
.hc-draftbar small { flex-basis: 100%; color: var(--text-muted); }
.hc-warning { padding: 12px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.35); border-radius: 8px; font-size: 13px; margin: 10px 0; overflow-wrap: anywhere; }
.hc-mobile-hint { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hc-mobile-hint-close { flex: 0 0 auto; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 18px; line-height: 1; padding: 0; }
.hc-modal .modal { width: min(820px, calc(100vw - 24px)); max-width: 820px; }
.hc-modal #modal-body { max-height: 65vh; overflow-y: auto; }
.hc-modal [hidden] { display: none !important; }
.hc-diff-group h4 { margin: 18px 0 8px; }
.hc-diff-entry { padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; font-size: 13px; overflow-wrap: anywhere; }
.hc-diff-entry small { display: block; color: var(--text-muted); margin: 5px 0; }
.hc-diff-entry pre { font: 11px monospace; white-space: pre-wrap; max-height: 140px; overflow: auto; }
.hc-diff-entry del { color: #fb7185; }
.hc-diff-entry ins { color: #86efac; text-decoration: none; }
.hc-counts { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 20px; }
.hc-history-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.hc-history-row p { margin: 7px 0; font-size: 13px; color: var(--text-muted); }
.honeycomb-page progress { display: block; width: 100%; accent-color: var(--accent); margin-top: 14px; }
@media (max-width: 900px) {
  .hc-workspace { grid-template-columns: 1fr; }
  .hc-tree, .hc-panel { padding: 12px; }
  .hc-draftbar { bottom: 8px; padding: 10px; }
  .hc-row { gap: 4px; }
  .hc-children { margin-left: 8px; padding-left: 5px; }
}
@media (min-width: 769px) { .hc-mobile-hint { display: none; } }
.hc-colour-row { display: flex; align-items: center; gap: 8px; }
.hc-colour-row .color-input { flex: 0 0 44px; width: 44px; height: 36px; padding: 2px; cursor: pointer; }
.hc-colour-row .color-input[data-none="1"] { opacity: .45; }
.hc-colour-row .hc-colour-text { flex: 1; min-width: 0; font-family: monospace; }
.hc-perm-reason { color: var(--text-muted); font-size: 11px; margin-left: 4px; }
.hc-undo-list { list-style: none; padding: 0; margin: 12px 0; }
.hc-undo-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.hc-badge-warn { background: rgba(245,158,11,.14); color: var(--hc-amber-text, #fbbf24); border: 1px solid rgba(245,158,11,.4); }
.hc-conflict { border-left: 2px solid var(--accent); padding: 2px 0 2px 12px; margin: 12px 0; }
.hc-conflict p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.hc-deploy-hint { color: var(--text-muted); font-size: 12px; margin: 12px 0 0; }
.hc-deploy-hint:empty { display: none; }
.hc-warning ul { margin: 6px 0 6px 18px; padding: 0; }
.hc-modal .hc-deploy-hint { margin: 10px 0 0; }
.hc-error-code { color: var(--text-muted); font-size: 11px; margin-left: 6px; }
/* Honeycomb Permissions tab */
.hc-perms { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.hc-perms > * { min-width: 0; }
.hc-perm-bar { align-items: flex-end; }
.hc-perm-pick { display: block; flex: 1 1 260px; max-width: 420px; min-width: 0; }
.hc-perm-pick .select { width: 100%; max-width: none; }
.hc-perm-card, .hc-hints { min-width: 0; padding: 16px; }
.hc-grid-scroll { max-width: 100%; overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 8px; }
.hc-grid-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hc-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.hc-grid th, .hc-grid td { border-bottom: 1px solid var(--border); padding: 0; text-align: center; background: var(--surface); }
.hc-grid thead th { position: sticky; z-index: 2; }
.hc-grid thead tr:first-child th { top: 0; }
.hc-grid thead tr:nth-child(2) th { top: 29px; }
.hc-grid-group { padding: 6px 10px !important; border-left: 1px solid var(--border); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 600; text-align: left !important; white-space: nowrap; }
.hc-grid-perm { width: 40px; min-width: 40px; height: 150px; vertical-align: bottom; }
.hc-grid-perm span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 8px 0; font-weight: 500; color: var(--text); }
.hc-grid .hc-grid-name { position: sticky; left: 0; z-index: 3; min-width: 150px; max-width: 190px; padding: 8px 10px; text-align: left; border-right: 1px solid var(--border); }
.hc-grid thead .hc-grid-name { z-index: 4; vertical-align: bottom; }
.hc-grid-title { display: block; overflow-wrap: anywhere; font-weight: 500; }
.hc-grid-name .btn { margin-top: 4px; padding: 2px 8px; }
.hc-grid-empty { padding: 22px 14px !important; color: var(--text-muted); text-align: left !important; }
.hc-tri { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 3px 4px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--elevated); color: var(--text-muted); font: inherit; font-size: 14px; cursor: pointer; }
.hc-tri-allow { color: #86efac; border-color: rgba(34,197,94,.55); background: rgba(34,197,94,.14); }
.hc-tri-deny { color: #fb7185; border-color: rgba(239,68,68,.55); background: rgba(239,68,68,.14); }
.hc-tri:hover:not(:disabled) { border-color: var(--accent); }
.hc-tri:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hc-tri:disabled { opacity: .35; cursor: not-allowed; background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.07) 4px 5px); }
.hc-copy-targets { max-height: 260px; overflow-y: auto; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; }
.hc-copy-targets .hc-check { margin: 6px 0; font-size: 13px; }
.hc-copy-group { padding: 4px 0; border-top: 1px solid var(--border); }
.hc-copy-cat { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hc-copy-cat .hc-check, .hc-copy-catname { font-weight: 600; }
.hc-copy-catname { display: block; margin: 6px 0; font-size: 13px; color: var(--text-muted); }
.hc-copy-children { padding-left: 18px; }
.hc-perm-view { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.hc-grid-rows .hc-grid-name { min-width: 120px; max-width: 170px; }
.hc-grid-rows .hc-grid-permname { font-size: 13px; font-weight: 500; color: var(--text); white-space: normal; overflow-wrap: anywhere; }
.hc-grid-rows thead th { top: 0; }
.hc-grid-who { min-width: 76px; max-width: 120px; padding: 8px 6px !important; vertical-align: bottom; font-size: 12px; }
.hc-grid-who .btn { margin-top: 4px; padding: 0 6px; font-size: 11px; line-height: 18px; opacity: .75; }
.hc-grid-rows tbody .hc-grid-group { background: var(--elevated); }
.hc-perm-legend .hc-tri { width: 22px; height: 22px; margin: 0 2px 0 8px; font-size: 12px; cursor: default; vertical-align: middle; }
.hc-perm-why { border-left: 2px solid var(--accent); padding-left: 10px; overflow-wrap: anywhere; }
.hc-perm-actions { margin-bottom: 0; }
.hc-perm-actions .select { width: 220px; max-width: 100%; }
.hc-spacer { flex: 1 1 auto; }
.hc-hints h4 { margin: 0 0 8px; }
.hc-hint-list { margin: 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.hc-hint-list li { margin: 4px 0; }
#hc-copy-preview { margin-top: 14px; }
@media (max-width: 900px) {
  .hc-perm-card, .hc-hints { padding: 12px; }
  .hc-grid-scroll { max-height: 70vh; }
  .hc-perm-actions .select { flex: 1 1 100%; width: auto; }
}
