/* ── Extracom Design System ─────────────────────────────────────── */
:root {
  --green:       #D7FB4F;
  --green-dim:   #B8D940;
  --dark:        #111510;
  --surface:     #1C2418;
  --surface2:    #242E20;
  --border:      #3D4A3F;
  --text:        #F6F9F0;
  --text-muted:  #8A9B8C;
  --red:         #FF5E5E;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w:   272px;
  --radius:      8px;
  --radius-lg:   12px;
  --transition:  .15s ease;
}

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

html, body {
  height: 100%;
  background: var(--dark);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ──────────────────────────────────────────────────────── */
.login-view {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  overflow: hidden;
}

.login-bg-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: .6;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-logo { display: flex; justify-content: center; }

.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -16px;
}

.login-view form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition);
}
.field-group input:focus { border-color: var(--green); }
.field-group input::placeholder { color: var(--text-muted); }

.login-error {
  background: rgba(255,94,94,.12);
  border: 1px solid rgba(255,94,94,.4);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  padding: 8px 12px;
}

.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green);
  color: var(--dark);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}
.btn-login:hover { background: var(--green-dim); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

/* ── App shell ──────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition);
}

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

.sidebar-logo { display: flex; align-items: center; }

.sidebar-header-actions {
  display: flex; align-items: center; gap: 4px;
}

.sidebar-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.nav-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}
.nav-tab:hover:not(.active) { color: var(--text); }

.badge {
  background: var(--green);
  color: var(--dark);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

.tab-panel {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Sessions list ──────────────────────────────────────────────── */
.sessions-list, .queue-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.session-item:hover { background: var(--surface2); }
.session-item.active { background: var(--surface2); }

.session-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}
.session-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.session-dot.stale  { background: #F5A623; }

.session-info { flex: 1; min-width: 0; }
.session-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.session-pending {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: rgba(215,251,79,.1);
  border-radius: 10px;
  padding: 1px 7px;
}

/* Queue list items */
.queue-item {
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.queue-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.queue-item-session {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}
.queue-item-status {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.queue-item-text {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Role chips ─────────────────────────────────────────────────── */
.role-section {
  border-top: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
}
.role-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.role-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.role-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-align: left;
}
.role-chip.active {
  background: rgba(215,251,79,.12);
  border-color: var(--green);
  color: var(--green);
}
.role-chip:hover:not(.active) { border-color: var(--text-muted); color: var(--text); }
.role-chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.role-chip-loading { font-size: 12px; color: var(--text-muted); }

/* ── Icon button ────────────────────────────────────────────────── */
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }

/* SSE indicator */
.sse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s, box-shadow .3s;
}
.sse-dot.online { background: var(--green); box-shadow: 0 0 5px var(--green); }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Mobile overlay ─────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 40;
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.mobile-logo { display: flex; align-items: center; }

/* ── Main ───────────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dark);
}

.view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Welcome ────────────────────────────────────────────────────── */
.welcome-view {
  align-items: center;
  justify-content: center;
}
.welcome-inner {
  text-align: center;
  max-width: 360px;
  padding: 24px;
}
.welcome-x {
  display: flex; justify-content: center;
  margin-bottom: 20px;
  opacity: .3;
}
.welcome-x svg { width: 80px; height: 80px; }
.welcome-inner h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.welcome-inner p { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.welcome-inner .hint { margin-top: 16px; font-size: 12px; }
.welcome-inner code {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 11px;
  color: var(--green);
  margin-top: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ── Detail view ────────────────────────────────────────────────── */
.detail-view { overflow: hidden; }

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.back-btn { display: none; }

.detail-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.session-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.session-status-dot.online { background: var(--green); box-shadow: 0 0 5px var(--green); }
.session-status-dot.stale  { background: #F5A623; }

.detail-last-seen {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Message list ───────────────────────────────────────────────── */
.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message.outgoing { align-self: flex-end; align-items: flex-end; }
.message.incoming { align-self: flex-start; align-items: flex-start; }

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.outgoing .message-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-right-radius: 3px;
  border-left: 2px solid var(--green);
}

.message.incoming .message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
}

.message-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-status {
  font-size: 10px;
  font-weight: 600;
}
.message-status.pending   { color: var(--text-muted); }
.message-status.confirmed { color: #F5A623; }
.message-status.delivered { color: var(--green); }
.message-status.failed    { color: var(--red); }

/* ── Input bar ──────────────────────────────────────────────────── */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.mic-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.mic-btn:hover { background: var(--border); }
.mic-btn.recording {
  background: rgba(215,251,79,.15);
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(215,251,79,.15);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(215,251,79,.15); }
  50%       { box-shadow: 0 0 0 6px rgba(215,251,79,.05); }
}

.text-input-wrap { flex: 1; }

.text-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--transition);
}
.text-input:focus { border-color: var(--green); }
.text-input::placeholder { color: var(--text-muted); }

.enhance-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.enhance-btn:hover { background: rgba(215,251,79,.1); border-color: var(--green); color: var(--green); }

.send-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: var(--green);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--dark);
  font-weight: 700;
  transition: background var(--transition), transform var(--transition);
}
.send-btn:hover { background: var(--green-dim); }
.send-btn:active { transform: scale(.95); }

/* ── Modals ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-confirm  { max-width: 680px; }
.modal-settings { max-width: 520px; }

.modal-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-session-label {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

.confirm-raw {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
}
.confirm-raw-label {
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* AI enhance sections preview */
.enhance-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.enhance-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.enhance-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.enhance-section-body {
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 80px;
  overflow-y: auto;
}
.enhance-section:first-child { grid-column: 1 / -1; }

.confirm-textarea {
  width: 100%;
  min-height: 140px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color var(--transition);
}
.confirm-textarea:focus { border-color: var(--green); }

.settings-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.settings-textarea:focus { border-color: var(--green); }

.modal-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.modal-actions-right { display: flex; align-items: center; gap: 8px; }

.session-keys-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 8px;
}
.key-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
}
.key-row-name { font-weight: 500; font-size: 13px; flex: 1; }
.key-row-val  { font-size: 12px; color: var(--text-muted); font-family: monospace; flex: 2; word-break: break-all; }
.key-row-del  { color: var(--text-muted); font-size: 16px; cursor: pointer; background: none; border: none; }
.key-row-del:hover { color: var(--red); }

.key-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.key-add-row input {
  flex: 1; min-width: 100px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
}
.key-add-row input:focus { border-color: var(--green); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-primary  { background: var(--green); color: var(--dark); border-color: var(--green); }
.btn-primary:hover { background: var(--green-dim); border-color: var(--green-dim); }

.btn-execute  { background: var(--green); color: var(--dark); }
.btn-execute:hover { background: var(--green-dim); }
.btn-execute:disabled { opacity: .6; cursor: not-allowed; }

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

.btn-sm { padding: 7px 12px; font-size: 12px; }

kbd {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font);
  font-size: 10px;
  padding: 1px 4px;
  color: var(--text-muted);
}

/* ── Field label ────────────────────────────────────────────────── */
.field-label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text);
}
.field-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }

.section-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-top: 4px;
  display: flex; align-items: baseline; gap: 8px;
}

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

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  min-width: 220px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: toast-in .2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }

  .sidebar-overlay { z-index: 45; }

  .mobile-header { display: flex; }

  .back-btn { display: flex; }

  #app { flex-direction: column; }

  #main { height: 100vh; }

  .enhance-sections { grid-template-columns: 1fr; }

  .modal { padding: 20px 16px; }

  .modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .modal-actions-right { justify-content: flex-end; }
}

/* ── Admin pagina ───────────────────────────────────────────── */
.admin-view {
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 28px 32px;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-page-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

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

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

.admin-table th.col-perm {
  text-align: center;
  white-space: normal;
  line-height: 1.3;
  min-width: 76px;
  font-size: 10px;
}

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

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: rgba(255,255,255,.03); }

.admin-table td.col-perm { text-align: center; }
.admin-table td.col-user { font-weight: 500; }
.admin-table td.col-actions { text-align: right; white-space: nowrap; }

.perm-check {
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}
.perm-check:disabled { cursor: default; opacity: .45; }

.role-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.role-badge.superadmin {
  background: rgba(215,251,79,.12);
  color: var(--green);
  border: 1px solid rgba(215,251,79,.25);
}
.role-badge.user {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.admin-del-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.admin-del-btn:hover { color: var(--red); border-color: var(--red); background: rgba(255,94,94,.08); }

.admin-pw-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius);
  margin-right: 6px;
  transition: color var(--transition), border-color var(--transition);
}
.admin-pw-btn:hover { color: var(--text); border-color: var(--text-muted); }

.admin-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.admin-add-form h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.admin-add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-add-row input,
.admin-add-row select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  min-width: 0;
}
.admin-add-row input:focus,
.admin-add-row select:focus { outline: none; border-color: var(--green); }
.admin-add-row input[type="text"] { flex: 1; min-width: 140px; }
.admin-add-row input[type="password"] { flex: 1; min-width: 160px; }

.admin-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .admin-view { padding: 16px; }
  .admin-add-row { flex-direction: column; align-items: stretch; }
}

/* ── Role bar in sessie ──────────────────────────────────────────── */
.role-bar { padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.role-bar-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Beheer nav ─────────────────────────────────────────────────── */
.beheer-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.beheer-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: none; border: none; color: var(--text); font-size: 13px; font-family: var(--font); cursor: pointer; text-align: left; width: 100%; transition: background var(--transition); }
.beheer-item:hover { background: var(--surface2); }
.beheer-item.active { background: var(--surface2); color: var(--green); }

/* ── New session btn in sidebar ─────────────────────────────────── */
.new-session-btn { display: flex; align-items: center; gap: 8px; width: calc(100% - 24px); margin: 8px 12px 4px; padding: 8px 14px; background: rgba(215,251,79,.08); border: 1px solid rgba(215,251,79,.2); border-radius: var(--radius); color: var(--green); font-size: 13px; font-family: var(--font); font-weight: 500; cursor: pointer; transition: background var(--transition); }
.new-session-btn:hover { background: rgba(215,251,79,.15); }

/* ── Beheer views ───────────────────────────────────────────────── */
.beheer-view { padding: 28px 32px; overflow: auto; }
.beheer-view h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.beheer-view .view-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.beheer-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin-top: 20px; }
.beheer-form h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row input, .form-row select, .form-row textarea { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; font-family: var(--font); flex: 1; min-width: 0; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--green); }

/* ── Roles beheer ───────────────────────────────────────────────── */
.roles-grid { display: grid; gap: 16px; }
.role-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; }
.role-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.role-card-name { font-weight: 600; font-size: 14px; flex: 1; }
.role-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.role-card-prompt { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 12px; font-family: monospace; padding: 10px; resize: vertical; min-height: 80px; }
.role-card-prompt:focus { outline: none; border-color: var(--green); }
.role-card-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Transcript collapse ────────────────────────────────────────── */
.message-transcript { margin-top: 4px; }
.transcript-toggle { background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 2px 0; display: flex; align-items: center; gap: 4px; }
.transcript-toggle:hover { color: var(--text); }
.transcript-body { margin-top: 6px; background: var(--surface2); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: flex-start; }
.transcript-body.hidden { display: none; }
.transcript-text { flex: 1; }
.copy-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 0; color: var(--text-muted); flex-shrink: 0; }
.copy-btn:hover { color: var(--text); }

/* ── New session form ───────────────────────────────────────────── */
.new-session-view { padding: 28px 32px; overflow: auto; }
.new-session-view h2 { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.ns-form { max-width: 540px; display: flex; flex-direction: column; gap: 16px; }
.ns-field { display: flex; flex-direction: column; gap: 6px; }
.ns-field label { font-size: 13px; font-weight: 500; }
.ns-field input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; font-family: var(--font); }
.ns-field input:focus { outline: none; border-color: var(--green); }
.ns-hint { font-size: 11px; color: var(--text-muted); }
.access-radios { display: flex; flex-direction: column; gap: 8px; }
.access-radio { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.access-radio input { accent-color: var(--green); }
.ns-user-list { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface2); border-radius: var(--radius); border: 1px solid var(--border); }
.ns-user-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ns-user-check input { accent-color: var(--green); }
.config-block { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin: 16px 0; }
.config-block pre { font-size: 12px; font-family: monospace; color: var(--green); white-space: pre-wrap; margin-bottom: 10px; }
.ns-result { background: var(--surface); border: 1px solid rgba(215,251,79,.3); border-radius: var(--radius-lg); padding: 20px 24px; max-width: 540px; }
.ns-result h3 { color: var(--green); margin-bottom: 12px; }
.ns-warning { font-size: 12px; color: var(--red); margin-top: 12px; padding: 10px; background: rgba(255,94,94,.08); border-radius: var(--radius); border: 1px solid rgba(255,94,94,.2); }

/* ── Sessions beheer tabel ──────────────────────────────────────── */
.sessions-mgmt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sessions-mgmt-table th { background: var(--surface2); color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.sessions-mgmt-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.sessions-mgmt-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.sessions-mgmt-table tbody tr:last-child td { border-bottom: none; }

/* ── Help page ──────────────────────────────────────────────────── */
.help-content { max-width: 720px; }
.help-content h3 { font-size: 15px; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
.help-content h3:first-child { margin-top: 0; }
.help-content p { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.help-content ul { font-size: 13px; color: var(--text-muted); padding-left: 20px; line-height: 1.9; }
.help-content li strong { color: var(--text); }
.help-content .help-tip { background: rgba(215,251,79,.06); border: 1px solid rgba(215,251,79,.15); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: var(--text-muted); margin: 12px 0; }

/* ── Uitlog modal ───────────────────────────────────────────────── */
#backdrop-logout .modal { max-width: 380px; }
#backdrop-logout p { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* ── Session view ───────────────────────────────────────────────── */
.session-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.session-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.session-title { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 500; font-size: 14px; }

/* ── Mobile responsive additions ────────────────────────────────── */
@media (max-width: 640px) {
  .beheer-view, .new-session-view { padding: 16px; }
  .role-bar { padding: 8px 16px; }
}
