/* Unicast — application stylesheet v2 */

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

:root {
  /* ── Sidebar ─────────────────────────────────────────── */
  --sidebar-bg:              #0f172a;
  --sidebar-text:            #94a3b8;
  --sidebar-text-hover:      #e2e8f0;
  --sidebar-text-active:     #f1f5f9;
  --sidebar-border:          rgba(255,255,255,.07);
  --sidebar-item-hover:      rgba(255,255,255,.06);
  --sidebar-item-active-bg:  rgba(14,165,233,.13);
  --sidebar-item-active-bar: #0ea5e9;
  --sidebar-width:           220px;

  /* ── Page ────────────────────────────────────────────── */
  --bg:              #f1f5f9;
  --surface:         #ffffff;
  --border:          #e2e8f0;
  --border-subtle:   rgba(148,163,184,.18);

  /* ── Ink (text hierarchy) ───────────────────────────── */
  --ink:   #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;

  /* ── Brand / accent ─────────────────────────────────── */
  --sky:        #0ea5e9;
  --sky-hover:  #0284c7;
  --sky-subtle: #e0f2fe;
  --sky-text:   #0369a1;

  /* ── Semantic ────────────────────────────────────────── */
  --green:        #16a34a;
  --green-subtle: #dcfce7;
  --green-text:   #166534;
  --red:          #dc2626;
  --red-subtle:   #fee2e2;
  --red-text:     #991b1b;
  --amber:        #d97706;
  --amber-subtle: #fef3c7;
  --amber-text:   #92400e;
  --blue:         #2563eb;
  --blue-subtle:  #dbeafe;
  --blue-text:    #1e40af;

  /* ── Radius ──────────────────────────────────────────── */
  --r-xs: 3px;
  --r-sm: 5px;
  --r:    8px;
  --r-lg: 12px;

  /* ── Shadows ─────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ──────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 1.1rem 1rem 1rem;
  text-decoration: none;
  color: #f1f5f9;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.015em;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-mark {
  width: 26px;
  height: 26px;
  background: var(--sky);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: .625rem .75rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.sidebar-group-label {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: .875rem .5rem .3rem;
  user-select: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .42rem .625rem;
  border-radius: var(--r-xs);
  text-decoration: none;
  font-size: .845rem;
  font-weight: 450;
  color: var(--sidebar-text);
  transition: background .1s, color .1s;
  border-left: 2px solid transparent;
  margin-left: -2px;
}

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

.nav-link.active {
  background: var(--sidebar-item-active-bg);
  border-left-color: var(--sidebar-item-active-bar);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.nav-icon {
  font-size: .875rem;
  width: 17px;
  text-align: center;
  flex-shrink: 0;
  opacity: .75;
}

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

/* ── Sidebar footer (user row) ──────────────────────────── */
.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.avatar-link { text-decoration: none; }

.avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(14,165,233,.2);
  border: 1px solid rgba(14,165,233,.35);
  color: #7dd3fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-name {
  flex: 1;
  font-size: .78rem;
  color: var(--sidebar-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: .78rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: var(--r-xs);
  transition: color .1s, background .1s;
  flex-shrink: 0;
}
.btn-logout:hover {
  color: #fca5a5;
  background: rgba(220,38,38,.12);
}

/* ── App body (right of sidebar) ───────────────────────── */
.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.has-sidebar .app-body {
  margin-left: var(--sidebar-width);
}

.app-main {
  padding: 2rem 2.5rem;
  max-width: 1060px;
  width: 100%;
  flex: 1;
  margin-inline: auto;
}

.app-footer {
  padding: .875rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--ink-4);
}
.app-footer a { color: var(--ink-4); text-decoration: none; }
.app-footer a:hover { color: var(--ink-3); }

/* ── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--ink);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .42rem .9rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: .845rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .1s, border-color .1s, box-shadow .1s;
  line-height: 1.45;
  white-space: nowrap;
}

.btn-primary {
  background: var(--sky);
  color: #fff;
  border-color: var(--sky);
}
.btn-primary:hover {
  background: var(--sky-hover);
  border-color: var(--sky-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--ink-3);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.btn-link {
  background: none;
  border: none;
  color: var(--sky);
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
}
.btn-link:hover { color: var(--sky-hover); }

.btn-sm {
  padding: .28rem .6rem;
  font-size: .78rem;
}

.btn-full { width: 100%; justify-content: center; }

.btn-copy {
  padding: .18rem .48rem;
  font-size: .73rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--ink-3);
  transition: background .1s, color .1s;
}
.btn-copy:hover { background: var(--bg); color: var(--ink); }

.btn-oauth {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  width: 100%;
  justify-content: center;
  margin-bottom: .5rem;
}
.btn-oauth:hover { background: var(--bg); }
.oauth-icon { font-weight: 700; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .3rem;
  color: var(--ink-2);
  letter-spacing: .01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .875rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink-4); }

.settings-form { max-width: 480px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem;
  border-radius: var(--r-sm);
  margin-bottom: 1.25rem;
  font-size: .845rem;
  border: 1px solid;
  border-left-width: 3px;
}

.alert-error {
  background: var(--red-subtle);
  color: var(--red-text);
  border-color: #fca5a5;
  border-left-color: var(--red);
}

.alert-success {
  background: var(--green-subtle);
  color: var(--green-text);
  border-color: #86efac;
  border-left-color: var(--green);
}

/* ── Auth ────────────────────────────────────────────────── */
.auth-container {
  min-height: calc(100vh - 3rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 .2rem;
  letter-spacing: -.025em;
}

.auth-subtitle {
  font-size: .845rem;
  color: var(--ink-3);
  margin: 0 0 1.5rem;
}

.auth-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--ink-3);
  margin-top: 1.25rem;
}
.auth-footer a { color: var(--sky); }

.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--ink-4);
  font-size: .75rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Tables ─────────────────────────────────────────────── */
.message-list,
table.settings-table,
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.5rem;
  display: table;
}

/* Override display: table for overflow: hidden to work with border-radius */
.message-list,
.settings-table {
  display: block;
  overflow: hidden;
}

table th,
.message-list th,
.settings-table th {
  background: #f8fafc;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .065em;
  color: var(--ink-3);
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table td,
.message-list td,
.settings-table td {
  padding: .72rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .875rem;
  vertical-align: middle;
}

table tr:last-child td,
.message-list tr:last-child td,
.settings-table tr:last-child td { border-bottom: none; }

table tr:hover td,
.message-list tr:hover td,
.settings-table tr:hover td { background: #fafbfd; }

table td a { color: var(--ink); text-decoration: none; }
table td a:hover { color: var(--sky); }

/* ── Status badges ──────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .52rem;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .025em;
}

.status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-queued     { background: var(--amber-subtle); color: var(--amber-text); }
.status-routing    { background: var(--blue-subtle);  color: var(--blue-text); }
.status-in_progress { background: var(--blue-subtle); color: var(--blue-text); }
.status-delivered  { background: var(--green-subtle); color: var(--green-text); }
.status-failed     { background: var(--red-subtle);   color: var(--red-text); }

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: .5rem; margin-top: 1rem; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 1.5rem;
}
.empty-state p { margin: 0; font-size: .875rem; }

/* ── Dashboard ──────────────────────────────────────────── */
.dashboard-hero { margin-bottom: 1.75rem; }
.dashboard-hero h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0 0 .25rem;
}
.dashboard-hero p { color: var(--ink-3); font-size: .875rem; margin: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xs);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: .3rem;
}

.stat-card .stat-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

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

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  transition: border-color .12s, box-shadow .12s;
  box-shadow: var(--shadow-xs);
}

.dashboard-card:hover {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,.08);
}

.card-icon {
  width: 38px;
  height: 38px;
  background: var(--sky-subtle);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  color: var(--sky-text);
}

.card-body h2 { font-size: .875rem; font-weight: 600; margin: 0 0 .2rem; }
.card-body p  { margin: 0; font-size: .78rem; color: var(--ink-3); }

/* ── Settings ────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.settings-section h2 {
  margin: 0 0 1rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
}

.settings-nav {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.settings-nav a {
  padding: .32rem .7rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-3);
  border: 1px solid var(--border);
  transition: all .1s;
}

.settings-nav a:hover,
.settings-nav a.active {
  background: var(--sky);
  border-color: var(--sky);
  color: #fff;
}

/* ── Message view ─────────────────────────────────────────── */
.message-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.message-meta {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .8rem;
  color: var(--ink-3);
}

.message-body-frame {
  width: 100%;
  height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

/* ── API key / monospace values ─────────────────────────── */
.api-key-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  padding: .48rem .75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font-size: .8rem;
  margin: .75rem 0;
}

.api-key-box code {
  flex: 1;
  word-break: break-all;
  font-family: "Menlo", "Consolas", "Monaco", monospace;
  color: var(--ink-2);
}

code.copyable {
  font-family: "Menlo", "Consolas", "Monaco", monospace;
  font-size: .8rem;
  background: var(--bg);
  padding: .18rem .42rem;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  color: var(--ink-2);
}

/* ── Admin nav ──────────────────────────────────────────── */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.75rem;
}

/* ── Help panel ─────────────────────────────────────────── */
.help-panel {
  position: fixed;
  right: -340px;
  top: 0;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  transition: right .22s ease;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}
.help-panel.open { right: 0; }

.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.help-panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.help-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--ink-3);
  padding: .2rem .4rem;
  border-radius: var(--r-xs);
}
.help-panel-close:hover { background: var(--bg); color: var(--ink); }

.help-toggle-btn,
.help-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--sky);
  color: #fff;
  border: none;
  border-radius: 9999px;
  width: 38px;
  height: 38px;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(14,165,233,.4);
  z-index: 50;
  transition: background .1s, box-shadow .1s;
}
.help-toggle-btn:hover,
.help-btn:hover {
  background: var(--sky-hover);
  box-shadow: 0 4px 12px rgba(14,165,233,.4);
}

/* ── Invite / copyable links ────────────────────────────── */
.invite-link-details { display: inline-block; position: relative; }
.invite-link-details summary { cursor: pointer; list-style: none; }
.invite-link-details summary::-webkit-details-marker { display: none; }

.invite-link-box {
  position: absolute;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .6rem;
  margin-top: .25rem;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.invite-link-input {
  width: 340px;
  font-family: "Menlo", "Consolas", monospace;
  font-size: .78rem;
  padding: .3rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink-2);
}

/* ── Inline config form ─────────────────────────────────── */
.inline-form { display: flex; gap: .5rem; align-items: center; }

.input-sm {
  padding: .3rem .5rem;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  width: 220px;
  color: var(--ink);
}

/* ── Help authoring layout ──────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Left sidebar */
.help-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  position: sticky;
  top: 1.5rem;
}

.help-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.help-sidebar-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.help-article-list {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}

.help-article-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .6rem .85rem;
  text-decoration: none;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border-subtle);
  transition: background .1s;
}
.help-article-item:hover { background: var(--bg); }
.help-article-item.active {
  background: var(--sky-subtle);
  border-left: 3px solid var(--sky);
  padding-left: calc(.85rem - 3px);
}
.help-article-item.active .hai-title { color: var(--sky-text); font-weight: 600; }

.hai-title {
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hai-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
}

.hai-key {
  font-family: "Menlo", "Consolas", monospace;
  font-size: .7rem;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 0 .25rem;
}

.hai-no-key {
  color: var(--ink-4);
  font-style: italic;
}

/* Status dot (small, beside context key) */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.status-published { background: var(--green); }
.status-dot.status-draft     { background: var(--amber); }
.status-dot.status-archived  { background: var(--ink-4); }

/* New article collapsible */
.help-new-article {
  border-top: 1px solid var(--border);
}
.help-new-trigger {
  display: block;
  padding: .65rem .85rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  background: var(--bg);
  user-select: none;
}
.help-new-trigger::-webkit-details-marker { display: none; }
.help-new-trigger:hover { color: var(--sky); }

.help-new-form {
  padding: .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.help-new-form .form-group {
  margin-bottom: 0;
}

/* Right: editor area */
.help-editor {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.help-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.help-editor-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.help-lang-switcher select {
  padding: .3rem .5rem;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.help-lang-switcher select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.help-empty-editor {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--r);
  padding: 2.5rem;
  text-align: center;
  color: var(--ink-3);
}

/* Context key reference table */
.help-context-ref {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
}

.help-ref-heading {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 .3rem;
}

.help-ref-intro {
  font-size: .82rem;
  color: var(--ink-3);
  margin: 0 0 1rem;
}

.help-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.help-ref-table th {
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  padding: .4rem .6rem;
  border-bottom: 1px solid var(--border);
}
.help-ref-table td {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--ink-2);
  vertical-align: middle;
}
.help-ref-table tr:last-child td { border-bottom: none; }
.help-ref-table td:first-child code {
  font-family: "Menlo", "Consolas", monospace;
  font-size: .75rem;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: .1rem .35rem;
}

/* alert-info variant */
.alert-info {
  background: var(--blue-subtle);
  color: var(--blue-text);
  border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--r-sm);
  padding: .6rem .9rem;
  font-size: .875rem;
}

/* ghost button variant */
.btn-ghost {
  background: transparent;
  color: var(--ink-3);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg);
  color: var(--ink);
}

/* form-actions split */
.form-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-top: .5rem;
}
.form-actions-left {
  display: flex;
  gap: .5rem;
  align-items: center;
}

/* sr-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
