@import url('https://fonts.googleapis.com/css2?family=Antonio:wght@400;700&family=Share+Tech+Mono&display=swap');

@font-face {
  font-family: 'teletext2';
  src: url('../fonts/teletext2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'teletext4';
  src: url('../fonts/teletext4.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --black:      #000000;
  --lcars-1:    #ff9900;
  --lcars-2:    #ff6600;
  --lcars-3:    #cc6699;
  --lcars-4:    #9999ff;
  --lcars-5:    #cc99cc;
  --lcars-6:    #ffcc99;
  --lcars-7:    #6666cc;
  --lcars-red:  #ff3300;
  --lcars-blue: #9999cc;
  --lcars-tan:  #ffcc66;
  --text:       #ff9900;
  --text-dim:   #996633;
  --text-dark:  #000000;
  --font-lcars: 'Antonio', 'Arial Narrow', sans-serif;
  --font-mono:  'Share Tech Mono', 'Courier New', monospace;
}

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

html, body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-lcars);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  letter-spacing: 0.04em;
}

/* ── Header ─────────────────────────────────────────────────── */

.site-header {
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 72px;
}

.header-inner {
  display: flex;
  align-items: stretch;
  height: 72px;
  position: relative;
}

.header-elbow {
  width: 192px;
  background: var(--lcars-1);
  border-radius: 0 0 0 40px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.header-bar {
  flex: 1;
  background: var(--lcars-1);
  height: 40px;
  align-self: flex-start;
  margin-left: 10px;
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.logo {
  font-family: var(--font-lcars);
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  align-self: flex-end;
  text-align: right;
  padding: 4px 10px 6px;
  line-height: 1.15;
}

.logo-registry {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.7;
  font-weight: 400;
}

.logo-bracket { display: none; }

.site-nav {
  position: absolute;
  right: 20px;
  top: 5px;
  display: flex;
  gap: 8px;
}

.nav-link {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: var(--black);
  background: var(--lcars-5);
  padding: 5px 20px;
  border-radius: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.12s;
}
.nav-link:hover   { background: var(--lcars-6); }
.nav-link.active  { background: var(--lcars-1); }

.header-status {
  position: absolute;
  right: 20px;
  bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Page layout ─────────────────────────────────────────────── */

.page-body {
  display: flex;
  min-height: calc(100vh - 72px);
}

.lcars-sidebar {
  width: 192px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow: hidden;
}

.lcars-sidebar-block {
  height: 60px;
  margin-right: 10px;
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 6px 10px;
  font-family: var(--font-lcars);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  flex-shrink: 0;
}
.lcars-sidebar-block.b1 { background: var(--lcars-1);    height: 80px; }
.lcars-sidebar-block.b2 { background: var(--lcars-3);    height: 100px; }
.lcars-sidebar-block.b3 { background: var(--lcars-7);    height: 50px; }
.lcars-sidebar-block.b4 { background: var(--lcars-5);    height: 120px; }
.lcars-sidebar-block.b5 { background: var(--lcars-tan);  height: 60px; }
.lcars-sidebar-block.b6 { background: var(--lcars-2);    height: 140px; }
.lcars-sidebar-block.b7 { background: var(--lcars-4);    flex: 1; }
.lcars-sidebar-gap { height: 10px; flex-shrink: 0; }

.site-main {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}

.view { display: none; }
.view.active { display: block; }

/* ── Toolbar ─────────────────────────────────────────────────── */

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--lcars-1);
  padding-bottom: 10px;
}

.view-title {
  font-family: var(--font-lcars);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--lcars-1);
  text-transform: uppercase;
}

.service-selector-wrap { display: flex; gap: 10px; align-items: center; }

.service-selector {
  background: var(--black);
  border: 2px solid var(--lcars-3);
  color: var(--lcars-3);
  padding: 6px 16px;
  border-radius: 16px;
  font-family: var(--font-lcars);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  min-width: 240px;
  text-transform: uppercase;
}
.service-selector:focus { outline: none; border-color: var(--lcars-1); color: var(--lcars-1); }

.service-actions { display: flex; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 20px;
  border: none;
  border-radius: 14px;
  background: var(--lcars-blue);
  color: var(--black);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.1s;
}
.btn:hover  { filter: brightness(1.2); }
.btn:active { filter: brightness(0.85); transform: scale(0.98); }

.btn-sm { font-size: 11px; padding: 4px 12px; border-radius: 10px; }

.btn-primary { background: var(--lcars-1); }
.btn-success { background: var(--lcars-2); }
.btn-danger  { background: var(--lcars-red); }
.btn-warn    { background: var(--lcars-tan); }

.btn-icon {
  background: none;
  border: none;
  color: var(--lcars-3);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 8px;
  font-family: var(--font-lcars);
  font-weight: 700;
  transition: color 0.1s;
}
.btn-icon:hover { color: var(--lcars-1); }

/* ── Cards ───────────────────────────────────────────────────── */

.card {
  background: var(--black);
  border: 2px solid var(--lcars-3);
  border-left: 8px solid var(--lcars-3);
  border-radius: 0 18px 18px 0;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 2px solid var(--lcars-3);
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  background: var(--lcars-3);
}

/* ── Forms ───────────────────────────────────────────────────── */

.form-card { margin-bottom: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  padding: 18px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.inline { flex-direction: row; align-items: center; gap: 10px; }

label {
  font-family: var(--font-lcars);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lcars-5);
  white-space: nowrap;
}

input[type=text], input[type=number], select, textarea {
  background: var(--black);
  border: 2px solid var(--lcars-7);
  color: var(--lcars-6);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 12px;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--lcars-1); color: var(--text); }
input.error { border-color: var(--lcars-red); }

.inline-input { min-width: 90px; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 2px solid var(--lcars-3);
  background: #08000a;
}

.form-error {
  padding: 8px 18px;
  color: var(--lcars-red);
  font-family: var(--font-mono);
  font-size: 12px;
  border-top: 2px solid var(--lcars-red);
}

/* ── Sources list ────────────────────────────────────────────── */

.sources-list { display: flex; flex-direction: column; gap: 14px; }

.source-card { border-color: var(--lcars-1); border-left-color: var(--lcars-1); }

.source-card-head {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.source-preview-wrap {
  flex-shrink: 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  cursor: pointer;
  background: #03000a;
  border-right: 2px solid var(--lcars-1);
  border-radius: 0;
  transition: background 0.15s;
  text-decoration: none;
}
.source-preview-wrap:hover { background: #08001a; }
.source-preview-wrap:hover .source-preview-label { color: var(--lcars-1); }

.source-preview-placeholder {
  flex-shrink: 0;
  width: 12px;
  background: var(--lcars-7);
  border-radius: 0;
}

.source-preview-canvas {
  width: 88px;
  height: 66px;
  display: block;
  image-rendering: pixelated;
  border-radius: 2px;
  background: #000;
}

.source-preview-label {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--lcars-7);
  text-transform: uppercase;
  transition: color 0.15s;
}

.source-card-info {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
}

.source-name {
  font-family: var(--font-lcars);
  font-size: 22px;
  font-weight: 700;
  color: var(--lcars-1);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.source-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-meta {
  font-family: var(--font-lcars);
  font-size: 15px;
  color: var(--lcars-5);
  letter-spacing: 0.04em;
}
.source-meta strong { color: var(--lcars-6); font-weight: 700; }

.source-card-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start; padding: 12px 14px 12px 0; }

.badge {
  font-family: var(--font-lcars);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--black);
}
.badge-git      { background: var(--lcars-2); }
.badge-svn      { background: var(--lcars-tan); }
.badge-url      { background: var(--lcars-4); }
.badge-local    { background: var(--lcars-blue); }
.badge-template { background: var(--lcars-3); }
.badge-live     { background: var(--lcars-2); }
.badge-error    { background: var(--lcars-red); }

.sync-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-red);
  padding: 6px 18px;
  background: #150000;
  border-top: 2px solid var(--lcars-red);
}

.thumb-strip {
  display: flex;
  gap: 8px;
  padding: 0 18px 16px;
  overflow-x: auto;
  flex-wrap: wrap;
}

.page-thumb {
  width: 72px;
  aspect-ratio: 4/3;
  background: #060008;
  border: 2px solid var(--lcars-7);
  border-radius: 4px;
  cursor: pointer;
  padding: 10px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.1s;
}
.page-thumb:hover { border-color: var(--lcars-1); }

.page-thumb-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
}

.page-thumb-template::after {
  content: 'T';
  position: absolute;
  top: 2px;
  right: 3px;
  font-family: var(--font-lcars);
  font-size: 9px;
  font-weight: 700;
  color: var(--lcars-3);
}

.thumb-line       { height: 2px; border-radius: 1px; background: #1a0a2a; }
.thumb-line.hl    { background: var(--lcars-2); opacity: 0.85; }
.thumb-line.hd    { background: var(--lcars-tan); opacity: 0.85; }
.thumb-line.hb    { background: var(--lcars-4); opacity: 0.75; }
.thumb-line.hm    { background: var(--lcars-blue); opacity: 0.6; }
.thumb-overflow {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  align-self: flex-end;
  margin-top: auto;
  padding: 2px;
}

/* ── Service meta bar ────────────────────────────────────────── */

.service-meta-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  flex-wrap: wrap;
}

/* ── Section headers ─────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
  gap: 12px;
}

.section-title {
  font-family: var(--font-lcars);
  font-size: 24px;
  font-weight: 700;
  color: var(--lcars-5);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.section-header-actions { display: flex; gap: 8px; align-items: center; }

.conflict-badge {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 14px;
  background: var(--lcars-tan);
  color: var(--black);
  border-radius: 12px;
}

/* ── Mappings table ──────────────────────────────────────────── */

.mappings-card { padding: 0; border-color: var(--lcars-4); border-left-color: var(--lcars-4); }

.mapping-row {
  border-bottom: 1px solid #0a0a2a;
  padding: 12px 16px;
}
.mapping-row:last-child { border-bottom: none; }
.mapping-row.has-conflict { background: #120800; }

.mapping-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

/* Labelled field group */
.mf-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mf-label {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.mf-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--lcars-7);
  letter-spacing: 0.05em;
  text-transform: none;
}

.mf-group select,
.mf-group input[type="text"] {
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #03000a;
  border: 1px solid var(--lcars-7);
  color: var(--lcars-6);
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.15s;
}
.mf-group select { background: #03000a; min-width: 130px; }
.mf-group input[type="text"] { width: 110px; }
.mf-group input[type="text"]:focus { border-color: var(--lcars-1); }
.mf-group input[type="text"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Live validation colour */
.mf-hex-input.hex-valid   { border-color: var(--lcars-2) !important; }
.mf-hex-input.hex-invalid { border-color: var(--lcars-red) !important; }

.col-arrow {
  text-align: center;
  color: var(--lcars-5);
  font-family: var(--font-lcars);
  font-size: 22px;
  font-weight: 700;
  padding-bottom: 4px;
  align-self: flex-end;
}

/* Dest field + options stacked */
.mf-dest-group { min-width: 140px; }

.dest-options {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.dest-option-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-6);
  cursor: pointer;
  white-space: nowrap;
}
.dest-option-label input[type=checkbox] {
  accent-color: var(--lcars-1);
  width: 12px; height: 12px;
  flex-shrink: 0;
}

/* Options column */
.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mode-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-6);
  cursor: pointer;
  white-space: nowrap;
}
.mode-check input[type=checkbox] {
  accent-color: var(--lcars-1);
  width: 12px; height: 12px;
  flex-shrink: 0;
}

.mf-status-group { justify-content: flex-end; }

.mapping-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin-left: auto;
  padding-bottom: 2px;
}

/* ── Preview ─────────────────────────────────────────────────── */

.preview-stats {
  font-family: var(--font-lcars);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lcars-5);
  text-transform: uppercase;
}

.page-jump { width: 130px; font-size: 12px; padding: 5px 10px; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  padding: 10px 0;
}

.preview-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: #060008;
  border: 2px solid var(--lcars-7);
  border-radius: 4px;
  cursor: pointer;
  padding: 12px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  transition: border-color 0.1s;
}
.preview-thumb:hover   { border-color: var(--lcars-1); }
.preview-thumb.conflict { border-color: var(--lcars-tan); }
.preview-thumb.is-template { border-color: var(--lcars-3); }

.preview-thumb-num { position: absolute; top: 2px; left: 4px; font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); }
.preview-thumb-src { position: absolute; top: 2px; right: 4px; font-family: var(--font-mono); font-size: 8px; color: #330033; }

.page-detail-card { margin-top: 18px; border-color: var(--lcars-2); border-left-color: var(--lcars-2); }
.page-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--lcars-2);
  border-bottom: 2px solid var(--lcars-2);
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
}

.tti-content {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
  background: #04000a;
  padding: 18px;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.65;
  max-height: 420px;
  overflow-y: auto;
}

/* ── Source groups ───────────────────────────────────────────── */

.source-group {
  border: 2px solid var(--lcars-3);
  border-left: 8px solid var(--lcars-3);
  border-radius: 0 18px 18px 0;
  overflow: hidden;
  margin-bottom: 0;
}

.source-group-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--lcars-3);
}

.source-group-name {
  font-family: var(--font-lcars);
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.source-group-count {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.source-group-header .btn { margin-left: auto; }

.source-group-body .card {
  border: none;
  border-bottom: 1px solid #2a0030;
  border-radius: 0;
  border-left: none;
  margin-bottom: 0;
}
.source-group-body .card:last-child { border-bottom: none; }

/* ── Utility ─────────────────────────────────────────────────── */

.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--lcars-7);
  border-top-color: var(--lcars-1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--lcars-7); border-radius: 3px; }

/* ── Page browser (file-explorer layout) ─────────────────────── */

#view-browser {
}

.browser-layout {
  display: flex;
  flex-direction: row;
  gap: 0;
  height: calc(100vh - 160px);
  min-height: 400px;
  border: 2px solid var(--lcars-4);
  border-left: 8px solid var(--lcars-4);
  border-radius: 0 18px 18px 0;
  overflow: hidden;
}

.browser-sidebar {
  width: 140px;
  flex-shrink: 0;
  background: #03000a;
  border-right: 2px solid var(--lcars-7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.browser-sidebar-header {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  background: var(--lcars-4);
  padding: 7px 12px;
  flex-shrink: 0;
}

.browser-page-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.tree-item {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
  padding: 4px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid transparent;
  transition: background 0.08s, border-color 0.08s;
  white-space: nowrap;
}
.tree-item:hover { background: #0a0020; }
.tree-item.active {
  background: #0a0030;
  border-left-color: var(--lcars-1);
  color: var(--lcars-1);
}
.tree-item-badge {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  color: var(--black);
  background: var(--lcars-3);
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.tree-item-badge.tmpl { background: var(--lcars-7); }

.browser-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--black);
}

.browser-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

.browser-thumb {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.browser-thumb-canvas-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  background: #050010;
  border: 2px solid var(--lcars-7);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.1s;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}
.browser-thumb-canvas-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(102,102,204,0.06) 4px,
    rgba(102,102,204,0.06) 8px
  );
  pointer-events: none;
}
.browser-thumb:hover .browser-thumb-canvas-wrap { border-color: var(--lcars-1); }
.browser-thumb.active .browser-thumb-canvas-wrap {
  border-color: var(--lcars-1);
  box-shadow: 0 0 0 2px var(--lcars-1);
}

.browser-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.browser-thumb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browser-thumb.active .browser-thumb-label { color: var(--lcars-1); }

.browser-thumb-loading {
  width: 100%;
  aspect-ratio: 4/3;
  background: #050010;
  border: 2px solid var(--lcars-7);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-lcars);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Detail modal overlay ───────────────────────────────────────────────────── */

.browser-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.browser-detail-modal.hidden { display: none; }

.browser-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 0;
}

.browser-detail-modal-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: #08001a;
  border: 2px solid var(--lcars-1);
  border-radius: 0 18px 18px 0;
  border-left: 8px solid var(--lcars-1);
  width: min(92vw, 960px);
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
}

.browser-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--lcars-1);
  flex-shrink: 0;
  gap: 12px;
}

.browser-detail-title {
  font-family: var(--font-lcars);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  display: block;
}

.browser-detail-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(0,0,0,0.55);
  display: block;
  margin-top: 2px;
}

.browser-detail-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.browser-canvas-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #000;
  border-right: 2px solid var(--lcars-7);
  padding: 8px;
}

.browser-canvas {
  image-rendering: pixelated;
  display: block;
  max-height: calc(88vh - 140px);
  width: auto;
  height: auto;
}

.browser-detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.browser-detail-nav {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--lcars-7);
  background: #05000f;
  flex-shrink: 0;
  align-items: center;
}
.browser-detail-nav-sep {
  width: 1px;
  height: 20px;
  background: var(--lcars-7);
  margin: 0 4px;
}

.browser-subpage-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--lcars-7);
  flex-shrink: 0;
}

.subpage-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border: 2px solid var(--lcars-7);
  border-radius: 8px;
  background: transparent;
  color: var(--lcars-4);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.subpage-btn:hover { background: #0a0020; border-color: var(--lcars-4); }
.subpage-btn.active { background: var(--lcars-4); color: var(--black); border-color: var(--lcars-4); }

.browser-tti-raw {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-6);
  padding: 10px 14px;
  overflow: auto;
  flex: 1;
  white-space: pre;
  line-height: 1.5;
  background: #03000a;
}

/* ── New service form / field feedback ───────────────────────────────────────*/

.label-hint {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

.field-feedback {
  font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 4px;
  min-height: 16px;
  color: var(--text-dim);
}
.field-feedback.ok  { color: var(--lcars-2); }
.field-feedback.err { color: var(--lcars-red); }

.form-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255,51,0,.12);
  border-left: 3px solid var(--lcars-red);
  border-radius: 0 6px 6px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-red);
}

/* ── Service status badge ─────────────────────────────────────────────────── */

.svc-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 6px;
}
.svc-status.live { color: var(--lcars-2); }

/* ── Auth header ─────────────────────────────────────────────────────────────*/

.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
}

.auth-nickname {
  color: var(--lcars-1);
  font-weight: 700;
}

.auth-badge {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  color: var(--black);
  background: var(--lcars-3);
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.05em;
}

#header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
}

/* ── Auth modal ──────────────────────────────────────────────────────────────*/

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal.hidden { display: none; }

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 0;
}

.auth-modal-inner {
  position: relative;
  z-index: 1;
  width: min(92vw, 440px);
  background: #08001a;
  border: 2px solid var(--lcars-3);
  border-left: 8px solid var(--lcars-3);
  border-radius: 0 18px 18px 0;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--lcars-3);
}

.auth-modal-title {
  font-family: var(--font-lcars);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
}

.auth-modal-body {
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-modal-footer {
  padding: 12px 20px 20px;
  display: flex;
  justify-content: flex-end;
}

.auth-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin: 0 0 8px;
  line-height: 1.5;
}

.auth-keygen-section {
  background: rgba(153,153,255,0.07);
  border-left: 3px solid var(--lcars-4);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-pubkey-display {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--lcars-4);
  word-break: break-all;
  min-height: 14px;
}

.auth-modal-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-red);
  min-height: 16px;
}

/* ── Users view ──────────────────────────────────────────────────────────────*/

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 700px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--card-bg);
  border-left: 6px solid var(--lcars-4);
  border-radius: 0 12px 12px 0;
}

.user-nick {
  font-family: var(--font-lcars);
  font-size: 16px;
  font-weight: 700;
  color: var(--lcars-1);
  flex: 1;
  letter-spacing: 0.05em;
}

.user-badge {
  font-family: var(--font-lcars);
  font-size: 10px;
  font-weight: 700;
  color: var(--black);
  background: var(--lcars-7);
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.05em;
}
.user-badge.admin { background: var(--lcars-3); }

.user-created {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.user-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Welcome sidebar button ──────────────────────────────────────────────────*/

.sidebar-welcome-btn {
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.sidebar-welcome-btn:hover {
  filter: brightness(1.15);
  transform: translateX(-3px);
}
.sidebar-welcome-btn:active { transform: translateX(-1px); }

/* ── Welcome view ────────────────────────────────────────────────────────────*/

#view-welcome {
  padding: 0;
}

.welcome-outer {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 48px;
}

.welcome-header-block {
  background: linear-gradient(135deg, #0a0020 0%, #02000a 100%);
  border-left: 8px solid var(--lcars-1);
  border-bottom: 3px solid var(--lcars-1);
  padding: 32px 36px 28px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.welcome-header-block::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,153,0,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-stardate {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.welcome-title {
  font-family: var(--font-lcars);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lcars-1);
  line-height: 1;
  margin-bottom: 10px;
}

.welcome-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-6);
  letter-spacing: 0.2em;
}

.welcome-ship-name {
  font-family: var(--font-lcars);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lcars-6);
  margin-bottom: 6px;
  line-height: 1;
}

.welcome-registry {
  color: var(--lcars-tan);
  font-size: 20px;
  letter-spacing: 0.22em;
}

/* ── Sections ────────────────────────────────────────────────────────────────*/

.welcome-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome-section {
  display: flex;
  gap: 0;
}

.welcome-section-bar {
  width: 8px;
  flex-shrink: 0;
  border-radius: 4px 0 0 4px;
  margin-right: 20px;
}
.welcome-section-bar.b2 { background: var(--lcars-3); }
.welcome-section-bar.b3 { background: var(--lcars-7); }
.welcome-section-bar.b4 { background: var(--lcars-5); }
.welcome-section-bar.b5 { background: var(--lcars-tan); }
.welcome-section-bar.b6 { background: var(--lcars-2); }

.welcome-section-content {
  flex: 1;
  min-width: 0;
  padding: 4px 0 4px;
}

.welcome-section-title {
  font-family: var(--font-lcars);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lcars-1);
  margin-bottom: 12px;
}

.welcome-section-content p {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--lcars-6);
  line-height: 1.7;
  margin-bottom: 10px;
}
.welcome-section-content p em {
  color: var(--lcars-1);
  font-style: normal;
}
.welcome-section-content p:last-child { margin-bottom: 0; }

/* ── Rank table ──────────────────────────────────────────────────────────────*/

.rank-table {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rank-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 0 10px 10px 0;
  border-left: 4px solid rgba(255,255,255,0.08);
}

.rank-pip-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  width: 80px;
  justify-content: flex-end;
}

.rank-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  display: inline-block;
  flex-shrink: 0;
}
.rank-pip.ensign    { border-color: var(--lcars-7);   background: transparent; }
.rank-pip.lieutenant { border-color: var(--lcars-4);  background: var(--lcars-4); }
.rank-pip.commander { border-color: var(--lcars-3);   background: var(--lcars-3); }
.rank-pip.captain   { border-color: var(--lcars-1);   background: var(--lcars-1); }
.rank-pip.captain-gold { background: var(--lcars-tan); border-color: var(--lcars-tan); }

.rank-name {
  font-family: var(--font-lcars);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lcars-1);
  flex-shrink: 0;
  width: 110px;
  padding-top: 1px;
}

.rank-desc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
  line-height: 1.6;
}

/* ── Steps ───────────────────────────────────────────────────────────────────*/

.welcome-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.welcome-steps li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-num {
  font-family: var(--font-lcars);
  font-size: 22px;
  font-weight: 700;
  color: var(--lcars-5);
  flex-shrink: 0;
  width: 36px;
  line-height: 1.2;
}

.welcome-steps li > div {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
  line-height: 1.7;
}
.welcome-steps li > div strong {
  color: var(--lcars-1);
  font-weight: 700;
}
.welcome-steps li > div em {
  color: var(--lcars-tan);
  font-style: normal;
}

/* ── Footer ──────────────────────────────────────────────────────────────────*/

.welcome-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 0;
  border-top: 2px solid var(--lcars-7);
  margin-top: 8px;
  flex-wrap: wrap;
}

.welcome-footer-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ── Communicator sidebar button ─────────────────────────────────────────────*/

.sidebar-comm-btn {
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.sidebar-comm-btn:hover  { filter: brightness(1.15); transform: translateX(-3px); }
.sidebar-comm-btn:active { transform: translateX(-1px); }

/* ── Communicator view ───────────────────────────────────────────────────────*/

.comm-subtitle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  align-self: center;
}

/* Compose box */
.comm-compose {
  margin-bottom: 24px;
}

.comm-compose-inner {
  background: #080018;
  border: 2px solid var(--lcars-2);
  border-left: 6px solid var(--lcars-2);
  border-radius: 0 12px 12px 0;
  padding: 14px 16px;
}

.comm-textarea {
  width: 100%;
  background: #03000a;
  border: 1px solid var(--lcars-7);
  border-radius: 6px;
  color: var(--lcars-6);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  min-height: 70px;
}
.comm-textarea:focus { border-color: var(--lcars-2); }
.comm-textarea::placeholder { color: var(--text-dim); }

.comm-compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.comm-charcount {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.comm-login-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
  padding: 10px 14px;
  border-left: 4px solid var(--lcars-7);
}

/* Message feed */
.comm-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}

.comm-loading,
.comm-empty,
.comm-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 20px 0;
  letter-spacing: 0.05em;
}
.comm-error { color: var(--lcars-red); }

/* Individual message */
.comm-message {
  background: #06001a;
  border-left: 5px solid var(--lcars-4);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  transition: border-color 0.1s;
}
.comm-message:hover { border-left-color: var(--lcars-1); }

/* comm-message-header, comm-nick, comm-date defined in rank/shirt section below */

.comm-message-body {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--lcars-6);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.comm-message-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.comm-llap-btn {
  background: transparent;
  border: 1px solid var(--lcars-7);
  border-radius: 20px;
  padding: 3px 12px 3px 8px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  font-family: var(--font-mono);
  line-height: 1;
}
.comm-llap-btn:hover:not(:disabled) {
  border-color: var(--lcars-5);
  background: rgba(204,153,204,0.1);
  color: var(--lcars-5);
}
.comm-llap-btn.llapped {
  border-color: var(--lcars-5);
  background: rgba(204,153,204,0.15);
  color: var(--lcars-5);
}
.comm-llap-btn:disabled { opacity: 0.4; cursor: default; }

.comm-llap-count {
  font-size: 11px;
  min-width: 8px;
}

.comm-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
  margin-left: auto;
}
.comm-delete-btn:hover { color: var(--lcars-red); background: rgba(255,51,0,0.1); }

/* ── Shirt colour swatches (registration modal) ──────────────────────────────*/

.auth-shirt-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-shirt-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shirt-options {
  display: flex;
  gap: 10px;
}

.shirt-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.shirt-option input[type="radio"] {
  display: none;
}

.shirt-swatch {
  display: block;
  width: 64px;
  padding: 8px 0 6px;
  text-align: center;
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.6;
  color: #000;
}
.shirt-option input:checked + .shirt-swatch {
  border-color: #fff;
  opacity: 1;
}
.shirt-swatch.gold { background: #e8a020; }
.shirt-swatch.blue { background: #4466cc; color: #fff; }
.shirt-swatch.red  { background: #cc2211; color: #fff; }

/* ── Shirt colour dots (messages & user list) ────────────────────────────────*/

.comm-shirt-dot,
.user-shirt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.shirt-gold { background: #e8a020; }
.shirt-blue { background: #4466cc; }
.shirt-red  { background: #cc2211; }

/* ── Rank label and pips in messages ─────────────────────────────────────────*/

.comm-message-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.comm-rank {
  font-family: var(--font-lcars);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.comm-nick {
  font-family: var(--font-lcars);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lcars-1);
}

.comm-pips {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

/* Make pips slightly smaller in messages */
.comm-pips .rank-pip {
  width: 10px;
  height: 10px;
}

.comm-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-left: auto;
}

/* ── Shirt colour selector in users admin view ───────────────────────────────*/

.user-pips {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}
.user-pips .rank-pip {
  width: 10px;
  height: 10px;
}

.user-shirt-dot {
  flex-shrink: 0;
}

.user-shirt-select {
  background: #08001a;
  border: 1px solid var(--lcars-7);
  border-radius: 6px;
  color: var(--lcars-6);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
}
.user-shirt-select:focus { border-color: var(--lcars-1); }

/* ── Key management in auth modal ────────────────────────────────────────────*/

.auth-key-warn {
  background: rgba(255,51,0,0.12);
  border-left: 3px solid var(--lcars-red);
  border-radius: 0 6px 6px 0;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lcars-6);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-key-warn strong { color: var(--lcars-red); }

.btn-link {
  background: none;
  border: none;
  color: var(--lcars-4);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--lcars-1); }

/* ── Profile panel ───────────────────────────────────────────────────────────*/

.auth-nickname-btn {
  background: none;
  border: none;
  font-family: var(--font-lcars);
  font-size: inherit;
  font-weight: 700;
  color: var(--lcars-1);
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}
.auth-nickname-btn:hover { text-decoration-color: var(--lcars-1); }

.profile-panel {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 1500;
  width: min(92vw, 360px);
}
.profile-panel.hidden { display: none; }

.profile-panel-inner {
  background: #08001a;
  border: 2px solid var(--lcars-1);
  border-left: 8px solid var(--lcars-1);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--lcars-1);
}

.profile-panel-title {
  font-family: var(--font-lcars);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
}

.profile-panel-body {
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-panel-footer {
  padding: 10px 18px 16px;
  display: flex;
  justify-content: flex-end;
}

/* ── Clickable sidebar nav blocks (Sources, Builder) ─────────────────────────*/

.sidebar-nav-btn {
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.sidebar-nav-btn:hover  { filter: brightness(1.15); transform: translateX(-3px); }
.sidebar-nav-btn:active { transform: translateX(-1px); }

.auth-stored-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--lcars-4);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ── Alert level colours ─────────────────────────────────────────────────────*/

:root {
  --cond-green:  #00cc44;
  --cond-blue:   #3399ff;
  --cond-yellow: #ffcc00;
  --cond-red:    #ff2200;
}

/* ── Header alert indicator ──────────────────────────────────────────────────*/

/* header-bar flex/padding merged into main rule above */

.header-alert {
  font-family: var(--font-lcars);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 14px;
  border-radius: 12px;
  color: #000;
  transition: background 0.4s;
}

.header-alert.cond-green  { background: var(--cond-green);  color: #000; }
.header-alert.cond-blue   { background: var(--cond-blue);   color: #000; }
.header-alert.cond-yellow { background: var(--cond-yellow); color: #000; }
.header-alert.cond-red    { background: var(--cond-red);    color: #fff; }

@keyframes red-flash {
  0%, 100% { background: var(--cond-red);    opacity: 1; }
  50%       { background: #660000;           opacity: 0.7; }
}
.header-alert.cond-red { animation: red-flash 1s ease-in-out infinite; }

/* ── Status view ─────────────────────────────────────────────────────────────*/

.status-edit-panel {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}
.status-edit-panel.hidden { display: none; }

.status-alert-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-alert-opt input[type="radio"] { display: none; }

.status-alert-btn {
  display: block;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-lcars);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.5;
  color: #000;
}
.status-alert-opt input:checked + .status-alert-btn { border-color: #fff; opacity: 1; }

.status-alert-btn.cond-green  { background: var(--cond-green); }
.status-alert-btn.cond-blue   { background: var(--cond-blue);  }
.status-alert-btn.cond-yellow { background: var(--cond-yellow); }
.status-alert-btn.cond-red    { background: var(--cond-red);    color: #fff; }

.status-message-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Status display (all users) ──────────────────────────────────────────────*/

.status-display {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-condition-banner {
  border-radius: 0 14px 14px 0;
  border-left: 8px solid rgba(0,0,0,0.2);
  padding: 18px 28px;
  transition: background 0.4s;
}
.status-condition-banner.cond-green  { background: var(--cond-green);  }
.status-condition-banner.cond-blue   { background: var(--cond-blue);   }
.status-condition-banner.cond-yellow { background: var(--cond-yellow); }
.status-condition-banner.cond-red    { background: var(--cond-red);    }

@keyframes banner-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}
.status-condition-banner.cond-red { animation: banner-flash 1s ease-in-out infinite; }

.status-condition-label {
  font-family: var(--font-lcars);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #000;
}
.status-condition-banner.cond-red .status-condition-label { color: #fff; }

.status-message-display {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--lcars-6);
  line-height: 1.7;
  white-space: pre-wrap;
  padding: 14px 18px;
  background: rgba(255,255,255,0.04);
  border-left: 4px solid var(--lcars-7);
  border-radius: 0 8px 8px 0;
  min-height: 60px;
}
.status-message-display:empty::before {
  content: 'No status message. All systems nominal.';
  color: var(--text-dim);
  font-style: italic;
}

/* ── Browser teletext icon ───────────────────────────────────────────────────*/

.browser-teletext-icon {
  color: var(--lcars-1);
  flex-shrink: 0;
  opacity: 0.9;
}

/* ── Exclusions field in mapping row ─────────────────────────────────────────*/

.mf-exclusions-group { flex: 1.5; }
.mf-exclusions-input { width: 100%; }

/* ── Add source to service dialog ────────────────────────────────────────────*/

.add-source-dialog {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-source-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 0;
}

.add-source-dialog-inner {
  position: relative;
  z-index: 1;
  background: #08001a;
  border: 2px solid var(--lcars-1);
  border-left: 8px solid var(--lcars-1);
  border-radius: 0 18px 18px 0;
  padding: 24px 28px;
  width: min(92vw, 480px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
}

.add-source-dialog-title {
  font-family: var(--font-lcars);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lcars-1);
}

.add-source-dialog-desc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--lcars-6);
}

.add-source-dialog-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.add-source-dialog-options .btn {
  flex: 1;
  min-width: 160px;
  text-align: left;
  padding: 12px 14px;
  line-height: 1.5;
}

.add-source-dialog-options small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
  font-weight: 400;
}

.add-source-dialog-cancel {
  align-self: flex-start;
  color: var(--text-dim);
}

/* ── Assembled / virtual service source ─────────────────────────────────────*/

.badge-service { background: var(--lcars-2); }

.source-card-assembled {
  border-left-color: var(--lcars-2);
  opacity: 0.92;
}

.source-assembled-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--lcars-2);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
