/* ═══════════════════════════════════════════════════════════════════
   GUMP — Main Stylesheet
   All colours, fonts, geometry and shadows are CSS custom properties.
   Theme files override these variables; this file is structure only.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Default variable set (overridden by theme CSS) ─────────────── */
:root {
  /* Backgrounds */
  --color-bg:          #111a0f;
  --color-surface:     #1a2318;
  --color-surface-2:   #223020;
  --color-surface-3:   #2a3a28;

  /* Borders */
  --color-border:      #2e3d2c;
  --color-border-subtle: #243022;

  /* Accent / interactive */
  --color-accent:      #4a7c59;
  --color-accent-hover:#5a9068;
  --color-accent-muted:#2a4a34;

  /* Text */
  --color-text:        #d4e6d4;
  --color-text-muted:  #8aaa8a;
  --color-text-faint:  #567056;
  --color-heading:     #e8f4e8;

  /* Semantic */
  --color-danger:      #c0392b;
  --color-danger-bg:   #2a1010;
  --color-success:     #27ae60;
  --color-success-bg:  #102018;
  --color-warning:     #d68910;
  --color-warning-bg:  #281e08;
  --color-info:        #2980b9;
  --color-info-bg:     #081828;

  /* Navbar */
  --color-nav-bg:      #0e1510;
  --color-nav-border:  #1e2e1c;
  --color-nav-text:    #8aaa8a;
  --color-nav-active:  #d4e6d4;

  /* Footer */
  --color-footer-bg:   #0e1510;

  /* Typography */
  --font-sans:         'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-heading:      var(--font-sans);
  --font-mono:         'Consolas', 'Courier New', monospace;
  --font-weight-heading: 700;
  --font-size-base:    16px;
  --line-height:       1.6;

  /* Geometry */
  --radius-sm:         2px;
  --radius:            4px;
  --radius-lg:         8px;
  --radius-pill:       999px;

  /* Shadows */
  --shadow-sm:         0 1px 3px rgba(0,0,0,0.4);
  --shadow:            0 2px 8px rgba(0,0,0,0.5);
  --shadow-lg:         0 8px 24px rgba(0,0,0,0.6);
  --shadow-inset:      inset 0 1px 3px rgba(0,0,0,0.3);

  /* Decorative */
  --border-accent:     2px solid var(--color-accent);
  --body-bg-image:     none;
  --card-header-bg:    var(--color-surface-2);
  --navbar-height:     60px;

  /* Contrast text (for use on coloured backgrounds) */
  --color-text-on-accent:  #fff;
  --color-text-on-warning: #000;

  /* Transitions */
  --transition:        0.2s ease;
  --transition-slow:   0.4s ease;
}

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

html { font-size: var(--font-size-base); scroll-behavior: smooth; scroll-padding-top: calc(var(--navbar-height) + 0.75rem); }

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  background-image: var(--body-bg-image);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: var(--line-height);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  color: var(--color-heading);
  line-height: 1.2;
}

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

img { max-width: 100%; display: block; }

ul { list-style: none; }

code, pre { font-family: var(--font-mono); }

/* ── Layout ──────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.page-header h1 { font-size: 1.75rem; overflow-wrap: break-word; word-break: break-word; }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  background-color: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--navbar-height);
  position: sticky;
  top: 0;
  z-index: 250;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.navbar-logo { height: 36px; width: auto; }

.navbar-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: var(--font-weight-heading);
  color: var(--color-nav-active);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.navbar-links li a,
.navbar-links li .btn-link {
  color: var(--color-nav-text);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.navbar-links li a:hover,
.navbar-links li .btn-link:hover {
  background: var(--color-accent-muted);
  color: var(--color-nav-active);
}

.navbar-links li a.active {
  background: var(--color-accent-muted);
  color: var(--color-nav-active);
  font-weight: 600;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--color-border);
}

.navbar-user span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  color: var(--color-text-muted);
  padding: 0.15rem;
  transition: color 0.15s;
}
.notif-bell:hover { color: var(--color-accent); }

.notif-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  background: var(--color-danger, #e74c3c);
  color: var(--color-text-on-accent);
  font-size: 0.58rem;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  pointer-events: none;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.4rem;
  cursor: pointer;
}

/* ── Flash / Alerts ──────────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: calc(var(--navbar-height) + 10px);
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem 0.9rem; /* extra bottom for progress bar */
  border-radius: var(--radius);
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.alert-success { background: var(--color-success-bg); border-color: var(--color-success); color: var(--color-text); }
.alert-danger  { background: var(--color-danger-bg);  border-color: var(--color-danger);  color: var(--color-text); }
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning); color: var(--color-text); }
.alert-info    { background: var(--color-info-bg);    border-color: var(--color-info);    color: var(--color-text); }
.alert-welcome {
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-2));
  border-color: var(--color-accent);
  border-left-width: 4px;
  color: var(--color-text);
  font-weight: 500;
}

@media (max-width: 540px) {
  .flash-container {
    right: 0.6rem;
    left: 0.6rem;
    max-width: none;
  }
}

.alert-close {
  background: none; border: none;
  color: var(--color-text-muted);
  cursor: pointer; font-size: 0.8rem; padding: 0; flex-shrink: 0;
}
.alert-close:hover { color: var(--color-text); }

.alert-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.3;
  transform-origin: left;
  animation: alert-shrink linear forwards;
}
@keyframes alert-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Back-to-top button ──────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 1.75rem;
  right: 1.5rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s, background 0.15s, color 0.15s;
  z-index: 400;
  box-shadow: var(--shadow);
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#back-to-top:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-on-accent);
}

/* ── Search palette (Ctrl+K) ─────────────────────────────────────── */
#search-palette {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 7rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
#search-palette.open {
  opacity: 1;
  pointer-events: auto;
}
.search-palette-box {
  width: 100%;
  max-width: 520px;
  margin: 0 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, var(--radius));
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  overflow: hidden;
  transform: scale(0.97) translateY(-6px);
  transition: transform 0.15s;
}
#search-palette.open .search-palette-box {
  transform: scale(1) translateY(0);
}
.search-palette-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.search-palette-row .search-icon {
  font-size: 0.95rem;
  opacity: 0.45;
  flex-shrink: 0;
}
#search-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--color-heading);
  min-width: 0;
}
.search-palette-hints {
  display: flex;
  gap: 1.25rem;
  padding: 0.45rem 1rem 0.5rem;
  font-size: 0.69rem;
  color: var(--color-text-muted);
}
.search-palette-hints kbd {
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  margin-right: 0.3em;
}

/* ── Character counter ───────────────────────────────────────────── */
.char-counter {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: 0.25rem;
  transition: color 0.2s;
}
.char-counter-warn { color: var(--color-warning); font-weight: 600; }

/* ── Profile copy button ─────────────────────────────────────────── */
.profile-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0 0.1rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.profile-copy-btn:hover { color: var(--color-accent); }
.profile-copy-btn--ok   { color: var(--color-success) !important; }

/* ── Relative timestamps ─────────────────────────────────────────── */
.rel-time {
  cursor: default;
  border-bottom: 1px dotted var(--color-border);
  text-decoration: none;
}

/* ── Settings unsaved changes banner ─────────────────────────────── */
#settings-unsaved-bar {
  display: none;
  position: sticky;
  top: calc(var(--navbar-height, 56px));
  z-index: 100;
  background: color-mix(in srgb, var(--color-warning) 12%, var(--color-surface));
  border-bottom: 2px solid var(--color-warning);
  padding: 0.5rem 1.25rem;
  font-size: 0.8rem;
  color: var(--color-text);
  text-align: center;
}
#settings-unsaved-bar.visible { display: block; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--card-header-bg);
  margin: -1.5rem -1.5rem 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: var(--font-weight-heading);
  color: var(--color-heading);
  margin-bottom: 0.2rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity var(--transition), background var(--transition), border-color var(--transition);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  min-width: 0;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.btn-danger  { background: var(--color-danger);  color: var(--color-text-on-accent);  border-color: var(--color-danger); }
.btn-warning { background: var(--color-warning); color: var(--color-text-on-warning); border-color: var(--color-warning); }
.btn-success { background: var(--color-success); color: var(--color-text-on-accent);  border-color: var(--color-success); }

.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); opacity: 1; }

.btn-sm  { padding: 0.3rem 0.75rem; font-size: 0.775rem; }
.btn-full { width: 100%; justify-content: center; margin-top: 0.75rem; }

.btn-link {
  background: none; border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-size: inherit;
  font-family: var(--font-sans);
  padding: 0;
}
.btn-link:hover { color: var(--color-text); }

/* ── Password strength widget ────────────────────────────────────── */
.pw-strength-wrap {
  margin-top: 0.5rem;
}

.pw-strength-bar-track {
  height: 4px;
  border-radius: 99px;
  background: var(--color-border);
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.pw-strength-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.25s ease, background 0.25s ease;
}

.pw-strength-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
}

.pw-reqs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.75rem;
}

.pw-req {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.pw-req.met { color: var(--color-success); }

.pw-req-icon {
  font-size: 0.7rem;
  font-weight: 900;
  width: 1em;
  text-align: center;
  flex-shrink: 0;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-heading);
}

.form-control {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font-sans);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}

/* ── Select — reset native OS chrome, add consistent chevron ─────── */
/* Theme-consistent select styling — applies to .form-control selects
   AND any bare <select> inside a form/filter-bar as a safety net.    */
select.form-control,
.media-filter-bar select,
.al-filters select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}
select.form-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}
/* Prevent double arrow in IE/Edge legacy */
select.form-control::-ms-expand { display: none; }

.form-control.is-invalid { border-color: var(--color-danger); }
.form-error { font-size: 0.8rem; color: var(--color-danger); }
.form-hint { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.2rem; }

.form-check { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-check input[type="checkbox"] { width: auto; accent-color: var(--color-accent); }

/* ── Auth pages ──────────────────────────────────────────────────── */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
}

.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-title { margin-bottom: 1.5rem; }

.auth-links {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ── Error pages ─────────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  text-align: center;
  gap: 1rem;
}

.error-code {
  font-size: 5rem;
  font-weight: 900;
  color: var(--color-accent);
  font-family: var(--font-heading);
  line-height: 1;
}

.error-message { font-size: 1.1rem; color: var(--color-text-muted); }

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  background: var(--color-footer-bg);
  border-top: 1px solid var(--color-nav-border);
  padding: 1.1rem 1.5rem;
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-social { display: flex; gap: 1rem; }
.footer-social a { color: var(--color-text-muted); text-decoration: none; }
.footer-social a:hover { color: var(--color-accent); }

.footer-credit {
  color: var(--color-text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.footer-credit:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* ── Placeholder / Coming soon ───────────────────────────────────── */
.placeholder-page {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--color-text-muted);
}

.placeholder-page h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th, td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

th {
  background: var(--color-surface-2);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-family: var(--font-heading);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(128,128,128,0.06); }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-heading);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-primary { background: var(--color-accent-muted); color: var(--color-accent); border: 1px solid var(--color-accent); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-muted   { background: var(--color-surface-2);  color: var(--color-text-muted); }
.badge-info    { background: color-mix(in srgb, var(--color-accent) 15%, transparent); color: var(--color-accent); }

/* ── Divider ─────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* ── Nav drawer (right-side slide-out) ───────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 299;
  animation: overlayFadeIn 0.2s ease;
}
.nav-overlay.open { display: block; }

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100dvh;   /* dynamic viewport height — handles mobile browser chrome */
  background: var(--color-nav-bg);
  border-left: 1px solid var(--color-nav-border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.nav-drawer.open { transform: translateX(0); }

/* Drawer header — user info + close button */
.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  min-height: 60px;
}

.nav-drawer-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.nav-drawer-username {
  font-weight: 700;
  color: var(--color-nav-active);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.nav-drawer-username:hover { color: var(--color-accent); }

.nav-drawer-bell {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nav-drawer-guest {
  font-weight: 600;
  color: var(--color-nav-active);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-drawer-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  margin-left: 0.5rem;
}
.nav-drawer-close:hover {
  color: var(--color-text);
  background: var(--color-accent-muted);
}

/* Drawer body — scrollable link list */
.nav-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0;
}

.nav-drawer-body a {
  display: block;
  padding: 0.7rem 1.25rem;
  color: var(--color-nav-text);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.nav-drawer-body a:hover {
  background: var(--color-accent-muted);
  color: var(--color-nav-active);
}

.nav-drawer-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0.4rem 1.25rem;
}

/* Drawer footer — logout / login */
.nav-drawer-foot {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.nav-drawer-logout {
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--font-sans);
}
.nav-drawer-logout:hover {
  background: var(--color-danger, #e74c3c);
  color: var(--color-text-on-accent);
  border-color: transparent;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .navbar-toggle { display: block; }
  .navbar-links  { display: none; }   /* drawer replaces the navbar links */
  .navbar-title  { max-width: 200px; }
}

/* ── Profile page ────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.5rem;
  flex-wrap: wrap;
}

/* Prevent theme card pseudo-elements from becoming flex items inside profile header */
.profile-header.card::before,
.profile-header.card::after {
  display: none !important;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-surface-2);
  border: 3px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.profile-avatar-placeholder {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--color-accent);
  line-height: 1;
}

.profile-identity { flex: 1; min-width: 0; }

/* ── Admin subnav ────────────────────────────────────────────────── */
.admin-subnav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  white-space: nowrap;
}

/* Mobile-only Enlistments shortcut — hidden on desktop */
.admin-subnav > a.mobile-admin-link { display: none; }

.admin-subnav > a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  text-decoration: none;
}

.admin-subnav > a:hover {
  color: var(--color-text);
  border-bottom-color: var(--color-border);
}

.admin-subnav > a.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.admin-subnav .subnav-badge {
  background: var(--color-danger);
  color: var(--color-text-on-accent);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
}

.subnav-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.subnav-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.subnav-group:hover .subnav-group-btn {
  color: var(--color-text);
  border-bottom-color: var(--color-border);
}

/* Navbar-context dropdown button — matches .navbar-links li a style */
.navbar-dropdown-btn {
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--color-nav-text);
  border-bottom: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.subnav-group:hover .navbar-dropdown-btn {
  background: var(--color-accent-muted);
  color: var(--color-nav-active);
  border-bottom: none;
}

.subnav-group-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.subnav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 170px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 200;
  padding: 0.25rem 0;
}

.subnav-group:hover .subnav-dropdown,
.subnav-group.subnav-open .subnav-dropdown {
  display: block;
}

.subnav-dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--color-text-muted);
  border-bottom: none;
}

.subnav-dropdown a:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.subnav-dropdown a.active {
  color: var(--color-accent);
  font-weight: 700;
}

/* ── Tablet (769px–1100px): fixed-position dropdown tile grid ──────
   JS repositions the dropdown as position:fixed; style it as a
   2-column tappable tile panel with min 44px touch targets.        */
@media (min-width: 769px) and (max-width: 1100px) {
  .subnav-group.subnav-open .subnav-dropdown {
    display: flex;
    flex-wrap: wrap;
    padding: 0.35rem;
    gap: 0.35rem;
    border-top: 2px solid var(--color-accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .subnav-group.subnav-open .subnav-dropdown a {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    background: var(--color-surface-2);
    border-radius: var(--radius-sm, 4px);
    border: 1px solid var(--color-border);
  }
  .subnav-group.subnav-open .subnav-dropdown a:hover,
  .subnav-group.subnav-open .subnav-dropdown a:active {
    background: var(--color-accent-muted);
    border-color: var(--color-accent);
    color: var(--color-accent);
  }
  .subnav-group.subnav-open .subnav-dropdown a.active {
    background: var(--color-accent-muted);
    border-color: var(--color-accent);
  }
}

/* ── Phone (≤768px): curated mobile admin nav ───────────────────────
   Only 4 links are shown: Dashboard, Enlistments, Broadcast, Audit Log.
   Everything else (groups, other direct links) is hidden.
   Links marked data-mobile or class mobile-admin-link are visible.   */
@media (max-width: 768px) {
  /* Hide every direct child of the subnav by default */
  .admin-subnav > * { display: none !important; }

  /* Show only the curated mobile links */
  .admin-subnav > a[data-mobile],
  .admin-subnav > a.mobile-admin-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    text-decoration: none;
  }
  .admin-subnav > a[data-mobile]:hover,
  .admin-subnav > a.mobile-admin-link:hover  {
    color: var(--color-text);
    border-bottom-color: var(--color-border);
  }
  .admin-subnav > a[data-mobile].active,
  .admin-subnav > a.mobile-admin-link.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
  }
}

/* ── Desktop-recommended nudge banner ───────────────────────────────
   Shown only on mobile for pages that are not mobile-friendly.       */
.admin-desktop-nudge {
  display: none;
}
@media (max-width: 768px) {
  .admin-desktop-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--color-warning-bg);
    border-bottom: 1px solid var(--color-warning);
    color: var(--color-warning);
    font-size: 0.8rem;
    line-height: 1.4;
  }
  .admin-desktop-nudge-text { flex: 1; }
  .admin-desktop-nudge-close {
    background: none;
    border: none;
    color: var(--color-warning);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    padding: 0.2rem;
    opacity: 0.7;
  }
  .admin-desktop-nudge-close:hover { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   ADMIN SIDEBAR LAYOUT
═══════════════════════════════════════════════════════════════════ */

/* Let admin layout break out of .main-content's max-width/padding */
.main-content:has(.admin-wrap) {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

/* Wrapper: sidebar + main side-by-side */
.admin-wrap {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - var(--navbar-height, 56px));
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.admin-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--navbar-height, 56px);
  height: calc(100vh - var(--navbar-height, 56px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  z-index: 80;
  transition: transform 0.25s ease;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* Sidebar header */
.asb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.asb-head-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
}
.asb-close {
  display: none; /* shown on mobile */
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem;
}
.asb-close:hover { color: var(--color-text); }

/* Sidebar nav */
.asb-nav {
  padding: 0.5rem 0 1rem;
  display: flex;
  flex-direction: column;
}

/* Group: collapsible section */
.asb-group {
  margin-top: 0.15rem;
}
.asb-group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem 0.3rem;
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
  text-align: left;
}
.asb-group-btn:hover {
  opacity: 1;
  color: var(--color-text);
}
.asb-group-arrow {
  font-size: 0.85rem;
  font-weight: 400;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
  opacity: 0.6;
}
.asb-group--open .asb-group-arrow {
  transform: rotate(90deg);
}
/* Collapsible links container */
.asb-group-links {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.22s ease;
}

/* Individual link */
.asb-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
  min-height: 32px;
  overflow: hidden;
}
.asb-link:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-left-color: var(--color-border);
}
.asb-link.active {
  color: var(--color-accent);
  font-weight: 700;
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface));
  border-left-color: var(--color-accent);
}
.asb-link--home {
  margin: 0.25rem 0;
  font-weight: 600;
}

/* Sidebar icon */
.asb-ico {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 1.1rem;
  text-align: center;
  opacity: 0.8;
}

/* Pending badge */
.asb-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: var(--color-text-on-accent);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  line-height: 1.5;
  flex-shrink: 0;
}

/* ── Main area ───────────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Mobile topbar (hidden on desktop) */
.asb-mobile-bar {
  display: none;
}

/* Overlay (mobile) */
.asb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
}
.asb-overlay.asb--open {
  display: block;
  opacity: 1;
}

/* ── Main content body ───────────────────────────────────────────── */
.admin-body {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* ── Mobile / tablet (<= 960px) ─────────────────────────────────── */
@media (max-width: 960px) {
  .admin-wrap {
    display: block;
    min-height: unset;
  }

  /* Sidebar: off-screen by default, slides in */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    z-index: 300;
    box-shadow: 4px 0 20px rgba(0,0,0,0.35);
  }
  .admin-sidebar.asb--open {
    transform: translateX(0);
  }

  /* Show close button in sidebar on mobile */
  .asb-close { display: block; }

  /* Mobile topbar */
  .asb-mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: var(--navbar-height, 56px);
    z-index: 200;
  }

  .asb-toggle {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
  }
  .asb-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
  }

  .asb-mobile-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-body {
    padding: 1.25rem 1rem;
  }
}

/* ── Extra narrow ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .admin-body { padding: 1rem 0.75rem; }
}

/* ── Markdown toolbar ────────────────────────────────────────────── */
.md-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem 0.4rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.md-toolbar-btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.md-toolbar-btn:hover {
  color: var(--color-text);
}

[data-md-toolbar] textarea {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ═══════════════════════════════════════════════════════════════════
   Media Gallery
   ═══════════════════════════════════════════════════════════════════ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.media-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}
.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.media-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}
.media-card:hover img {
  transform: scale(1.04);
}
.media-embed-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 1.5rem;
}
.media-card-body {
  padding: 0.75rem;
  flex: 1;
}
.media-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-heading);
  margin-bottom: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.media-embed-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
}
.media-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.media-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.media-filter-bar form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════
   Document Repository
   ═══════════════════════════════════════════════════════════════════ */

.doc-paper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 2rem 2.5rem;
  box-shadow: var(--shadow);
}

.doc-header-block {
  padding: 1.25rem 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}

.doc-section {
  margin-bottom: 1.75rem;
}

.doc-section-heading {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading, 700);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-heading);
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.85rem;
  background: var(--color-surface-2, rgba(128,128,128,0.08));
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.doc-type-card {
  transition: transform var(--transition), box-shadow var(--transition);
}
.doc-type-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.doc-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.doc-field-value {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.doc-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.65em;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.doc-status-draft      { background: var(--color-surface-3, #e8e8e8); color: var(--color-text-muted); }
.doc-status-submitted  { background: var(--color-warning-bg, #fff3cd); color: var(--color-warning, #856404); }
.doc-status-approved   { background: var(--color-success-bg, #d1e7dd); color: var(--color-success, #155724); }
.doc-status-rejected   { background: var(--color-danger-bg, #f8d7da);  color: var(--color-danger, #842029); }
.doc-status-superseded { background: var(--color-surface-3, #e8e8e8); color: var(--color-text-faint, #aaa); }
.doc-status-archived   { background: var(--color-surface-2, #f0f0f0); color: var(--color-text-faint, #aaa); }

.item-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.item-list-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 0.3rem 0.5rem;
}
.item-list-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--color-border-subtle, rgba(0,0,0,0.06));
  color: var(--color-text);
}

/* ── Table scroll wrap ───────────────────────────────────────────── */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.table-scroll-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--color-surface) 90%);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}
.table-scroll-wrap.scrolled-end::after {
  opacity: 0;
}

/* ── Mobile nav & layout fixes ───────────────────────────────────── */
@media (max-width: 768px) {
  /* ── Navbar ── */
  .navbar-title { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .navbar-user  { flex-wrap: nowrap; gap: 0.35rem; }
  .navbar-links.open { z-index: 301; }

  /* ── Admin subnav — sticky + scrolls horizontally ── */
  .admin-subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 0.5rem;
    -webkit-overflow-scrolling: touch;
    /* Sticky so it stays accessible while scrolling the dashboard */
    position: sticky;
    top: var(--navbar-height, 60px);
    z-index: 90;
  }
  .admin-subnav::-webkit-scrollbar { display: none; }
  .admin-subnav > a,
  .subnav-group-btn { font-size: 0.72rem; padding: 0.55rem 0.6rem; }

  /* ── Admin body ── */
  .admin-body { padding: 1rem 0.75rem; }
  /* Remove all padding from main-content on admin pages — sidebar layout handles spacing */
  .main-content:has(.admin-wrap) { padding: 0; max-width: 100%; margin: 0; }
  .main-content { padding: 1rem 0.75rem; }

  /* ── Page headers ── */
  .page-header h1 { font-size: 1.4rem; }

  /* ── Tables — allow horizontal scroll ── */
  .table-scroll-wrap { -webkit-overflow-scrolling: touch; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.45rem 0.6rem; }

  /* ── Cards ── */
  .card-body { padding: 0.85rem; }
  .card-header { padding: 0.6rem 0.85rem; }

  /* ── Admin dashboard ── */
  .activity-ts-wrap { display: none; }
  .activity-dot { display: none; }
  .activity-item { padding: 0.5rem 0.75rem; }

  /* ── Stat cards ── */
  .stat-value { font-size: 1.8rem; }

  /* ── Buttons in tight spaces ── */
  .btn-sm { padding: 0.25rem 0.55rem; font-size: 0.75rem; }

  /* ── Admin dashboard: touch-friendly quick links & side items ── */
  .quick-link  { min-height: 44px; padding: 0.6rem 0.9rem; }
  .side-item   { min-height: 44px; padding: 0.55rem 0.9rem; }
  .side-panel-head { padding: 0.6rem 0.9rem; }

  .stat-card  { padding: 1rem; }

  /* Activity feed: more compact items, still legible */
  .activity-action { font-size: 0.78rem; }

  /* ── Edit profile two-panel ── */
  .ep-layout { grid-template-columns: 1fr !important; }
  .ep-field-grid { grid-template-columns: 1fr !important; }

  /* ── Member dashboard ── */
  .dash-grid { grid-template-columns: 1fr !important; }
  .dash-card-wide { grid-column: 1 !important; }
  .dash-status-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Notifications ── */
  .notif-item { flex-wrap: wrap; }

  /* ── Broadcast / settings two-col grids ── */
  .gi-pricing { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 1.2rem; }
  .stat-value { font-size: 1.5rem; }
  .dash-status-grid { grid-template-columns: 1fr !important; }
  .gi-pricing { grid-template-columns: 1fr !important; }
}

/* ── Admin form grids — collapse all inline grid-template-columns ── */
/* Targets every div with an inline grid-template-columns style     */
/* inside .admin-body at tablet/phone widths.                        */
@media (max-width: 640px) {
  .admin-body [style*="grid-template-columns"],
  .main-content [style*="grid-template-columns"]:not([class*="gi-"]) {
    grid-template-columns: 1fr !important;
  }

  /* Override radio buttons — allow 2-col wrap instead of stretching */
  .override-radios { flex-wrap: wrap; }

  /* Broadcast: keep target/category side-by-side on tablet */
  /* (handled by 1fr rule above when below 640px) */

  /* Ensure filter bars wrap gracefully */
  .al-filters { flex-wrap: wrap; }
  .al-filter-group { min-width: calc(50% - 0.6rem); flex: 1 1 calc(50% - 0.6rem); }
  .al-filter-actions { width: 100%; justify-content: flex-end; }

  /* Roles: permissions grid — collapse minmax(260px) to full-width */
  .perm-grid { grid-template-columns: 1fr !important; }
}

/* ── Utility: generic empty-state block ──────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}
.empty-state-icon    { font-size: 2rem; margin-bottom: 0.75rem; }
.empty-state-title   { font-weight: 600; margin-bottom: 0.4rem; color: var(--color-text); }
.empty-state-body    { font-size: 0.875rem; }

/* ── Navbar search ───────────────────────────────────────────────── */
.navbar-search { display: flex; align-items: center; margin-left: 0.25rem; }
.navbar-search-input {
  height: 30px;
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  width: 150px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
}
.navbar-search-btn { padding: 0.25rem 0.5rem; font-size: 0.85rem; }

@media (max-width: 1100px) {
  .navbar-search { display: none; }
}

/* ── Night Vision mode (Easter egg) ─────────────────────────────── */

/* Smooth transition when toggling */
body {
  transition: filter 1.2s ease, background-color 1.2s ease;
}
body.nightvision {
  background-color: #0c140c;
}
/* Apply filter to content elements only — NOT to body itself.
   Putting filter on body would make body the containing block for
   position:fixed children (nav-drawer, overlays), breaking their
   viewport-relative positioning and causing the drawer to slide in. */
body.nightvision .navbar,
body.nightvision .main-content,
body.nightvision .footer,
body.nightvision .admin-subnav {
  filter: saturate(0.2) brightness(0.9) contrast(1.1);
}
/* Scanline overlay */
body.nightvision::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgba(0, 30, 0, 0.12) 2px,
      rgba(0, 30, 0, 0.12) 4px
    );
  mix-blend-mode: multiply;
}
/* Green tint overlay */
body.nightvision::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99998;
  pointer-events: none;
  background: rgba(0, 40, 0, 0.10);
  mix-blend-mode: color;
}
body.nightvision,
body.nightvision .navbar,
body.nightvision .footer,
body.nightvision .card,
body.nightvision .nav-drawer,
body.nightvision .admin-subnav,
body.nightvision .main-content {
  background-color: #111a11 !important;
  color: #8cd08c !important;
}
body.nightvision .navbar,
body.nightvision .footer {
  background-color: #0c140c !important;
}
body.nightvision .card {
  border-color: #1e3a1e !important;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.04) !important;
}
body.nightvision a,
body.nightvision .btn-link,
body.nightvision .navbar-title {
  color: #55dd55 !important;
}
body.nightvision a:hover {
  color: #77ff77 !important;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.3);
}
body.nightvision .btn-primary {
  background: #143014 !important;
  border-color: #1e5a1e !important;
  color: #77ff77 !important;
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.1) !important;
}
body.nightvision .btn-primary:hover {
  background: #1a4a1a !important;
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.2) !important;
}
body.nightvision .btn-ghost {
  color: #55bb55 !important;
  border-color: #1a3a1a !important;
}
body.nightvision .btn-ghost:hover {
  background: rgba(0, 255, 0, 0.06) !important;
}
body.nightvision h1, body.nightvision h2,
body.nightvision h3, body.nightvision h4 {
  color: #99ee99 !important;
}
body.nightvision p,
body.nightvision span,
body.nightvision li,
body.nightvision td,
body.nightvision th,
body.nightvision label,
body.nightvision .alert {
  color: #7ec47e !important;
}
body.nightvision .form-control,
body.nightvision select,
body.nightvision textarea {
  background: #0e1a0e !important;
  border-color: #1e3a1e !important;
  color: #8cd08c !important;
}
body.nightvision .form-control:focus,
body.nightvision select:focus,
body.nightvision textarea:focus {
  border-color: #2a6a2a !important;
  box-shadow: 0 0 0 2px rgba(0, 255, 0, 0.1) !important;
}
body.nightvision .badge,
body.nightvision .notif-badge {
  background: #143014 !important;
  color: #77ff77 !important;
}
body.nightvision * {
  text-shadow: 0 0 4px rgba(0, 255, 0, 0.15);
}
body.nightvision img {
  filter: grayscale(0.6) brightness(0.8) sepia(0.35) hue-rotate(70deg) contrast(1.05);
}
body.nightvision .table-scroll-wrap table,
body.nightvision table {
  border-color: #152415 !important;
}
body.nightvision tr {
  border-color: #152415 !important;
}
body.nightvision th {
  background-color: #132013 !important;
}
body.nightvision .subnav-dropdown,
body.nightvision .navbar-dropdown-btn {
  color: #7ec47e !important;
}
body.nightvision .footer-credit,
body.nightvision .footer-social a {
  color: #5aaa5a !important;
}

/* Night Vision activation overlay — gradual fade-in/out */
.nv-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.nv-overlay.nv-on {
  background: radial-gradient(ellipse at center, rgba(0, 30, 0, 0.7) 0%, rgba(0, 15, 0, 0.9) 100%);
  animation: nv-fade-in 2s ease forwards;
}
.nv-overlay.nv-off {
  background: radial-gradient(ellipse at center, rgba(0, 30, 0, 0.5) 0%, rgba(0, 15, 0, 0.7) 100%);
  animation: nv-fade-out 1.8s ease forwards;
}
.nv-overlay-text {
  font-family: var(--font-mono, monospace);
  font-size: 1.2rem;
  font-weight: 700;
  color: #33ff33;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(0, 255, 0, 0.6), 0 0 30px rgba(0, 255, 0, 0.3);
  opacity: 0;
  animation: nv-text-pulse 2s ease 0.3s forwards;
}
@keyframes nv-fade-in {
  0%   { opacity: 0; }
  25%  { opacity: 0.8; }
  70%  { opacity: 0.6; }
  100% { opacity: 0; }
}
@keyframes nv-fade-out {
  0%   { opacity: 0; }
  20%  { opacity: 0.6; }
  60%  { opacity: 0.4; }
  100% { opacity: 0; }
}
@keyframes nv-text-pulse {
  0%   { opacity: 0; transform: scale(0.95); }
  20%  { opacity: 1; transform: scale(1); }
  70%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}

/* ── Secret medals (profile) ─────────────────────────────────────── */
.profile-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.secret-medals-col {
  display: flex;
  gap: 0.3rem;
  width: 0;
  overflow: visible;
  white-space: nowrap;
}
.secret-medal {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background: color-mix(in srgb, var(--color-surface-2) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  border-radius: 3px;
  font-size: 0.68rem;
  font-family: var(--font-mono, monospace);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: default;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.secret-medal:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.secret-medal-icon {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ── Golden Profile (terminal ARG reward) ───────────────────────── */
.profile-bg-golden {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #0d0d0d url('/static/img/topo-bg.jpg') center / cover no-repeat;
  filter: sepia(1) hue-rotate(-10deg) saturate(0.35) brightness(0.35);
}
.profile-golden .profile-header.card {
  border-top: 3px solid #c9a84c !important;
  background:
    linear-gradient(135deg, rgba(201, 168, 76, 0.1) 0%, transparent 40%),
    linear-gradient(180deg, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    #1a1a1a !important;
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(201, 168, 76, 0.15),
    inset 0 1px 0 rgba(201, 168, 76, 0.08) !important;
}
.profile-golden .profile-avatar {
  border-color: #c9a84c !important;
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.25);
}
.profile-golden .profile-name {
  color: #dfc06b !important;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
}
.profile-golden .profile-body .card {
  background: #1a1a1a !important;
  border-color: rgba(201, 168, 76, 0.12) !important;
  border-top: 2px solid rgba(201, 168, 76, 0.2) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
.profile-golden .section-title {
  color: #c9a84c !important;
}
.profile-golden .profile-actions .btn {
  border-color: rgba(201, 168, 76, 0.25) !important;
  color: #c9a84c !important;
}
.profile-golden .profile-actions .btn:hover {
  background: rgba(201, 168, 76, 0.08) !important;
  border-color: #c9a84c !important;
}
.profile-golden .rank-badge {
  color: #dfc06b !important;
}
.profile-golden .rank-abbr {
  background: rgba(201, 168, 76, 0.15) !important;
  color: #c9a84c !important;
  border-color: rgba(201, 168, 76, 0.3) !important;
}
.profile-golden .badge {
  background: rgba(201, 168, 76, 0.1) !important;
  color: #c9a84c !important;
  border: 1px solid rgba(201, 168, 76, 0.2) !important;
}
.profile-golden a:not(.btn) {
  color: #c9a84c !important;
}
.profile-golden a:not(.btn):hover {
  color: #dfc06b !important;
}
.profile-golden .secret-medals-col .secret-medal {
  background: rgba(201, 168, 76, 0.08) !important;
  border-color: rgba(201, 168, 76, 0.25) !important;
  color: #c9a84c !important;
}
.profile-golden .secret-medals-col .secret-medal:hover {
  border-color: #c9a84c !important;
  color: #dfc06b !important;
}
.profile-golden .profile-copy-btn {
  color: #c9a84c !important;
}
.profile-golden .ribbon-cell {
  box-shadow: 0 0 4px rgba(201, 168, 76, 0.15);
}
.profile-golden details summary {
  color: #c9a84c !important;
}
.profile-golden .form-control,
.profile-golden select,
.profile-golden textarea {
  background: #141414 !important;
  border-color: rgba(201, 168, 76, 0.15) !important;
  color: #d0c090 !important;
}
.profile-golden code {
  background: rgba(201, 168, 76, 0.08) !important;
  color: #c9a84c !important;
}
/* Gold shimmer on header — subtle animated shine */
.profile-golden .profile-header.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(201, 168, 76, 0.04) 45%,
    rgba(201, 168, 76, 0.08) 50%,
    rgba(201, 168, 76, 0.04) 55%,
    transparent 70%
  );
  animation: golden-shimmer 8s ease-in-out infinite;
  pointer-events: none;
}
.profile-golden .profile-header.card {
  position: relative;
  overflow: hidden;
}
@keyframes golden-shimmer {
  0%   { left: -100%; }
  40%  { left: 200%; }
  100% { left: 200%; }
}

/* ── Authorization codes ticker (footer) ────────────────────────── */
.auth-ticker {
  text-align: center;
  font-family: var(--font-mono, monospace);
  font-size: 0.55rem;
  color: var(--color-text-faint);
  opacity: 0;
  padding: 0.2rem 0 0.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 3s ease;
  user-select: none;
}
.auth-ticker.visible { opacity: 0.25; }

/* ── Footer easter egg click target ─────────────────────────────── */
.footer-easter {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 28px;
  height: 28px;
  z-index: 10;
  cursor: default;
}

/* ── SOS helicopter fly-by ──────────────────────────────────────── */
.sos-helicopter {
  position: fixed;
  top: 25%;
  left: 110vw;
  z-index: 99999;
  pointer-events: none;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 1.15;
  color: var(--color-text-muted);
  white-space: pre;
  animation: heli-fly 5s linear forwards;
}
@keyframes heli-fly {
  0%   { left: 110vw; opacity: 0; }
  5%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { left: -220px; opacity: 0; }
}
.sos-notification {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99998;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  color: var(--color-accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  animation: sos-msg 4s ease 1.5s forwards;
}
@keyframes sos-msg {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Terminal overlay (Easter egg) ──────────────────────────────── */
.gump-terminal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #0a0e0a;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono, 'Courier New', monospace);
  color: #33dd33;
}
.gump-terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #060906;
  border-bottom: 1px solid #1a3a1a;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.gump-terminal-title { color: #44aa44; }
.gump-terminal-close {
  background: none;
  border: 1px solid #1a3a1a;
  color: #44aa44;
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gump-terminal-close:hover {
  background: #1a3a1a;
  color: #88ff88;
}
.gump-terminal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.gump-terminal-body .t-line {
  margin: 0;
}
.gump-terminal-body .t-system {
  color: #227722;
}
.gump-terminal-body .t-accent {
  color: #88ff88;
}
.gump-terminal-body .t-warn {
  color: #ccaa33;
}
.gump-terminal-body .t-error {
  color: #cc4444;
}
.gump-terminal-body .t-highlight {
  color: #44ffaa;
  text-shadow: 0 0 6px rgba(0, 255, 100, 0.3);
}
.gump-terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #060906;
  border-top: 1px solid #1a3a1a;
  gap: 0.5rem;
}
.gump-terminal-prompt {
  color: #44aa44;
  font-size: 0.82rem;
  white-space: nowrap;
}
#gump-terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #33dd33;
  font-family: inherit;
  font-size: 0.82rem;
  caret-color: #33dd33;
}

/* ── Empty-state placeholder ────────────────────────────────────── */
.pd-empty { color: var(--color-text-muted); font-size: 0.875rem; font-style: italic; padding: 0.75rem 0; }

/* ── Mobile roster / filter bar polish ──────────────────────────── */
@media (max-width: 480px) {
  /* Filter bars that use inline flex — force selects full-width */
  form[method="GET"] .form-group { flex: 1 1 100% !important; min-width: 0 !important; }
  form[method="GET"] select.form-control,
  form[method="GET"] input.form-control { width: 100%; }
  form[method="GET"] .btn { width: 100%; }
}

/* ── ORBAT tree panel touch targets ────────────────────────────── */
@media (max-width: 768px) {
  .mtree-item { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
  .mgmt-tree-head { padding: 0.75rem 0.85rem; }
}

@media print {
  .navbar, .nav-drawer, .nav-overlay,
  .footer, .admin-subnav, .alert,
  .doc-actions-bar { display: none !important; }
  .doc-paper {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 100%;
  }
  .btn { display: none !important; }
}

/* ── Shared custom colour picker ──────────────────────────────── */
/* The picker JS is inlined in each template that uses it.        */
/* These classes are shared so every page gets the widget for     */
/* free without duplicating the stylesheet.                        */

/* Hide native OS picker — value is still submitted via the DOM   */
.colour-picker { display: none !important; }

/* Trigger swatch button */
.colour-trigger {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition, 0.15s), transform 0.1s;
  background-clip: padding-box;
}
.colour-trigger:hover { border-color: var(--color-accent); transform: scale(1.06); }
.colour-trigger:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Popup panel */
.colour-popup {
  display: none;
  position: absolute;
  z-index: 300;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 8px);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.35));
  padding: 0.85rem;
  width: 400px;
  margin-top: 4px;
}
.colour-popup.open { display: block; }

.colour-popup-body { display: flex; gap: 0.75rem; align-items: stretch; }

/* Left column — preset swatches */
.colour-presets-col {
  flex: 0 0 190px;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.colour-popup-group {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-muted);
  margin: 0.6rem 0 0.3rem;
}
.colour-popup-group:first-child { margin-top: 0; }

.colour-preset-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.colour-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  padding: 0;
}
.colour-preset:hover  { transform: scale(1.2); box-shadow: 0 0 0 2px var(--color-accent); }
.colour-preset.selected { box-shadow: 0 0 0 2px var(--color-accent); transform: scale(1.1); }

/* Divider */
.colour-popup-divider {
  width: 1px;
  background: var(--color-border);
  align-self: stretch;
  flex-shrink: 0;
}

/* Right column — hue ring + SV square */
.colour-wheel-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.colour-wheel-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-muted);
  align-self: flex-start;
}

.colour-wheel-canvas {
  cursor: crosshair;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}

.colour-sv-canvas {
  cursor: crosshair;
  border-radius: var(--radius, 4px);
  border: 1px solid var(--color-border);
  display: block;
  flex-shrink: 0;
}

/* Bottom hex row */
.colour-popup-hex-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
  align-items: center;
}
.colour-popup-hex-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  height: auto;
}
.colour-popup-apply {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

/* Shared text-hex input style */
.colour-hex { font-family: var(--font-mono); font-size: 0.875rem; }

/* Relative container so popup positions correctly */
.colour-field { position: relative; }

.colour-input-row { display: flex; align-items: center; gap: 0.6rem; }
