/* =========================================================
   FAQ Chat Interno — Design system
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg:            #ffffff;
  --canvas:        #f6f7fb;
  --canvas-2:      #eef0f6;

  /* Sidebar (dark) */
  --sidebar-bg:    #0b1220;
  --sidebar-text:  #cbd5e1;
  --sidebar-active-bg: rgba(99,102,241,0.18);
  --sidebar-active-text: #ffffff;
  --sidebar-hover-bg: rgba(255,255,255,0.05);
  --sidebar-border: rgba(255,255,255,0.07);

  /* Text */
  --text:          #0b1220;
  --text-muted:    #64748b;
  --text-dim:      #94a3b8;
  --text-soft:     #475569;

  /* Borders */
  --border:        #e6e9ef;
  --border-strong: #d1d5db;

  /* Accent — Indigo */
  --primary:       #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft:  #eef2ff;
  --primary-text:  #3730a3;

  /* Semantic */
  --success:       #10b981;
  --success-soft:  #d1fae5;
  --success-text:  #065f46;

  --warning:       #f59e0b;
  --warning-soft:  #fef3c7;
  --warning-text:  #92400e;

  --danger:        #ef4444;
  --danger-soft:   #fee2e2;
  --danger-text:   #991b1b;

  --purple-soft:   #ede9fe;
  --purple-text:   #5b21b6;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows — softer, more refined */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 4px 12px rgba(15,23,42,0.05), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-md: 0 8px 20px rgba(15,23,42,0.06), 0 3px 6px rgba(15,23,42,0.04);
  --shadow-lg: 0 20px 40px rgba(15,23,42,0.10), 0 6px 12px rgba(15,23,42,0.04);

  --ring: 0 0 0 3px rgba(79,70,229,0.18);

  /* Layout */
  --sidebar-w-collapsed: 64px;
  --sidebar-w-expanded:  264px;
  --sidebar-transition: width .25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
h1, h2, h3, h4 { letter-spacing: -0.02em; }
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* =========================================================
   LOGIN
   ========================================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99,102,241,0.10) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(139,92,246,0.10) 0%, transparent 50%),
    var(--canvas);
}
.login-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}
.login-card .logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 22px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.30);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.login-card .sub { margin: 0 0 28px; color: var(--text-muted); font-size: 14px; }
.login-card label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}
.login-card .field { margin-bottom: 14px; }
.login-card input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 14px;
  background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring);
}
.login-card button.submit {
  margin-top: 8px;
  width: 100%; background: var(--primary); color: #fff; border: 0;
  padding: 11px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: background .15s;
}
.login-card button.submit:hover { background: var(--primary-hover); }
.error-box {
  background: var(--danger-soft); color: var(--danger-text);
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid #fecaca;
}

/* =========================================================
   APP SHELL (sidebar + main)
   ========================================================= */
.shell {
  display: block;
  min-height: 100vh;
}

/* Sidebar — collapsed rail by default, expands on hover */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w-collapsed);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(0,0,0,0.1);
  z-index: 40;
  overflow: hidden;
  white-space: nowrap;
  transition: var(--sidebar-transition), box-shadow .25s;
}
.sidebar:hover {
  width: var(--sidebar-w-expanded);
  box-shadow: var(--shadow-lg);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 68px;
}
.sidebar .brand .logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.sidebar .brand-text {
  display: flex; flex-direction: column;
  opacity: 0;
  transition: opacity .15s linear;
}
.sidebar:hover .brand-text { opacity: 1; transition-delay: .12s; }
.sidebar .brand-text .title {
  color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2;
}
.sidebar .brand-text .subtitle {
  color: var(--text-dim); font-size: 11px; line-height: 1.2;
}
.sidebar .nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 0;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar .nav-section {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  color: var(--text-dim);
  padding: 14px 18px 6px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .15s linear;
}
.sidebar:hover .nav-section { opacity: 1; transition-delay: .12s; }
.sidebar:not(:hover) .nav-section {
  height: 12px;
  padding: 6px 0;
  font-size: 0;
  margin: 0;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px 9px 22px;
  margin: 0 8px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  text-align: left; font-size: 13.5px;
  transition: background .12s, color .12s;
  position: relative;
  min-height: 38px;
}
.sidebar .nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}
.sidebar .nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}
.sidebar .nav-item .icon {
  width: 18px; height: 18px; flex-shrink: 0;
  opacity: 0.8;
}
.sidebar .nav-item.active .icon { opacity: 1; }
.sidebar .nav-item .label {
  opacity: 0;
  transition: opacity .15s linear;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar:hover .nav-item .label { opacity: 1; transition-delay: .12s; }
.sidebar .nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  transition: all .2s;
}
/* When sidebar is collapsed, badge becomes a small red dot on the icon */
.sidebar:not(:hover) .nav-item .badge {
  position: absolute;
  top: 4px;
  right: 12px;
  padding: 0;
  width: 9px; height: 9px;
  font-size: 0;
  line-height: 0;
  box-shadow: 0 0 0 2px var(--sidebar-bg);
}
.sidebar .nav-item .badge:empty,
.sidebar .nav-item .badge[hidden] { display: none; }

.sidebar .footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 12px 16px;
  min-height: 60px;
}
.sidebar .user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 0;
  border-radius: var(--radius);
}
.sidebar .user-card .uinfo,
.sidebar .user-card form {
  opacity: 0;
  transition: opacity .15s linear;
}
.sidebar:hover .user-card .uinfo,
.sidebar:hover .user-card form { opacity: 1; transition-delay: .12s; }
.sidebar .user-card .avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.sidebar .user-card .uinfo { flex: 1; min-width: 0; }
.sidebar .user-card .uname {
  color: #fff; font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar .user-card .urole {
  color: var(--text-dim); font-size: 11px;
  text-transform: capitalize;
}
.sidebar .user-card form { display: inline; }
.sidebar .logout-btn {
  background: transparent; border: 0;
  color: var(--text-dim); padding: 6px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
}
.sidebar .logout-btn:hover { background: var(--sidebar-hover-bg); color: #fff; }
.sidebar .logout-btn .icon { width: 16px; height: 16px; }

/* Main area takes the remaining width — collapsed rail width as left margin.
   When the sidebar is hovered, main shifts right so its content isn't covered. */
.main {
  margin-left: var(--sidebar-w-collapsed);
  min-width: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.shell:has(.sidebar:hover) .main {
  margin-left: var(--sidebar-w-expanded);
}

/* Mobile sidebar toggle */
.mobile-bar {
  display: none;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.mobile-bar button {
  background: transparent; border: 0;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.mobile-bar button:hover { background: var(--canvas); }
.mobile-bar .mobile-title {
  font-weight: 600; font-size: 15px;
}

@media (max-width: 800px) {
  /* On mobile, sidebar slides off-screen — no hover-expand, no margin push */
  .main,
  .shell:has(.sidebar:hover) .main { margin-left: 0; }
  .sidebar {
    width: var(--sidebar-w-expanded);
    transform: translateX(-100%);
    transition: transform .2s, width 0s;
    z-index: 50;
  }
  .sidebar:hover { width: var(--sidebar-w-expanded); box-shadow: none; }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  /* Reset the collapsed visual overrides — mobile is always expanded when open */
  .sidebar .brand-text,
  .sidebar .nav-section,
  .sidebar .nav-item .label,
  .sidebar .user-card .uinfo,
  .sidebar .user-card form { opacity: 1; }
  .sidebar:not(:hover) .nav-section {
    height: auto;
    padding: 14px 18px 6px;
    font-size: 10.5px;
    margin: 0;
  }
  .sidebar:not(:hover) .nav-item .badge {
    position: static;
    padding: 1px 7px;
    width: auto; height: auto;
    font-size: 11px; line-height: 1.4;
    box-shadow: none;
  }
  .mobile-bar { display: flex; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 45;
  }
  .sidebar-backdrop.show { display: block; }
}
.page-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 22px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.page-header h1 {
  margin: 0; font-size: 20px; font-weight: 600;
}
.page-header .h-sub {
  color: var(--text-muted); font-size: 13.5px; margin-top: 3px;
}
.page-header .h-actions { display: flex; gap: 8px; align-items: center; }
.page-content {
  flex: 1; overflow: auto;
  padding: 28px 32px;
}
.page-content.narrow {
  max-width: 880px;
  width: 100%; margin: 0 auto;
}

/* =========================================================
   CHAT
   ========================================================= */
.chat-shell {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.msg { display: flex; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg.bot, .msg.admin, .msg.pending { justify-content: flex-start; }
.bubble-group { max-width: 78%; }
.bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  white-space: pre-wrap; word-break: break-word;
  line-height: 1.55;
  font-size: 14px;
}
.msg.user .bubble {
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.bot .bubble {
  background: var(--primary-soft); color: var(--primary-text);
  border-bottom-left-radius: 4px;
  border: 1px solid #dbeafe;
}
.msg.admin .bubble {
  background: var(--bg); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.msg.pending .bubble {
  background: var(--warning-soft); color: var(--warning-text);
  border-bottom-left-radius: 4px;
  border: 1px solid #fde68a;
}
.meta {
  font-size: 11px; color: var(--text-muted);
  margin: 6px 4px 0;
}
.msg.user .meta { text-align: right; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; padding: 2px 7px;
  border-radius: 999px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.tag.ai      { background: var(--success-soft);  color: var(--success-text); }
.tag.pending { background: var(--warning-soft); color: var(--warning-text); }
.tag.admin   { background: var(--purple-soft);  color: var(--purple-text); }
.tag .dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: currentColor;
}
.feedback-row {
  display: flex; gap: 6px; align-items: center;
  margin-top: 8px;
}
.feedback-row .lbl { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
.feedback-row button {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; color: var(--text);
  transition: background .12s, border-color .12s;
}
.feedback-row button:hover { background: var(--canvas); border-color: var(--border-strong); }
.feedback-row .done {
  color: var(--text-muted); font-size: 11px;
  display: flex; align-items: center; gap: 4px;
}

.composer-wrap {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 28px 16px;
}
.composer {
  max-width: 900px; margin: 0 auto;
  display: flex; gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 12px;
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.composer textarea {
  flex: 1; resize: none; border: 0;
  padding: 8px 4px; min-height: 28px; max-height: 200px;
  background: transparent; outline: none;
  font-size: 14px; line-height: 1.5;
}
.composer button.send {
  background: var(--primary); color: #fff; border: 0;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  align-self: flex-end;
  transition: background .15s;
}
.composer button.send:hover:not(:disabled) { background: var(--primary-hover); }
.composer button.send:disabled { background: #93c5fd; cursor: not-allowed; }
.composer button.send .icon { width: 18px; height: 18px; }
.composer-hint {
  max-width: 900px; margin: 6px auto 0;
  text-align: center; color: var(--text-muted); font-size: 11px;
}

/* Empty state */
.empty-state {
  text-align: center; color: var(--text-muted);
  padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center;
}
.empty-state .ill {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-state h2 { color: var(--text); margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.empty-state p { margin: 0; }

/* =========================================================
   ADMIN
   ========================================================= */

/* Stats row */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.stat:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}
.stat .label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500;
}
.stat .value {
  font-size: 28px; font-weight: 600; margin-top: 6px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.stat .value small { font-size: 14px; color: var(--text-dim); font-weight: 400; margin-left: 2px; }
.stat .icon-bg {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.stat .icon-bg.blue   { background: var(--primary-soft); color: var(--primary); }
.stat .icon-bg.green  { background: var(--success-soft); color: var(--success); }
.stat .icon-bg.amber  { background: var(--warning-soft); color: var(--warning); }
.stat .icon-bg.purple { background: var(--purple-soft); color: var(--purple-text); }
.stat .icon-bg .icon { width: 18px; height: 18px; }

/* Cards */
.card {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}
.card .card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card h3 { margin: 0; font-size: 15.5px; font-weight: 600; }

/* Question item */
.question-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color .12s, box-shadow .12s;
  box-shadow: var(--shadow-xs);
}
.question-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.question-item .qhead {
  display: flex; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
  font-size: 12px; color: var(--text-muted);
}
.question-item .qhead .who {
  display: flex; align-items: center; gap: 8px;
}
.question-item .qhead .who-avatar {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff; font-weight: 600; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.question-item .qtext {
  font-weight: 500; font-size: 15px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}
.question-item .qid { color: var(--text-dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.suggestion {
  background: linear-gradient(135deg, var(--primary-soft), #f5f3ff);
  border: 1px solid #e0e7ff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.suggestion .stitle {
  font-size: 11px; color: var(--primary-text);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.suggestion .stitle .icon { width: 14px; height: 14px; }
.suggestion .sq { font-style: italic; color: var(--text-muted); font-size: 12.5px; margin-bottom: 6px; }
.suggestion .sa { color: var(--text); font-size: 13.5px; line-height: 1.55; }
.score-pill {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px; font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.answer-form textarea {
  width: 100%; min-height: 96px; padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius); resize: vertical;
  font-size: 14px; line-height: 1.55;
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.answer-form textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring);
}
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.row label.check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.row .spacer { flex: 1; }

/* Buttons */
.btn {
  background: var(--primary); color: #fff; border: 1px solid var(--primary);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  white-space: nowrap;
}
.btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .icon { width: 15px; height: 15px; }
.btn.secondary {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn.secondary:hover { background: var(--canvas); border-color: var(--text-muted); }
.btn.ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent;
  box-shadow: none;
}
.btn.ghost:hover { background: var(--canvas-2); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #dc2626; border-color: #dc2626; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.icon-only { padding: 7px; }
.btn.icon-only.sm { padding: 5px; }

/* Knowledge item */
.kb-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color .12s, box-shadow .12s;
  box-shadow: var(--shadow-xs);
}
.kb-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kb-item .kq { font-weight: 500; margin-bottom: 6px; color: var(--text); font-size: 14.5px; }
.kb-item .ka { color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.kb-item .kfoot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-dim);
}
.kb-item .kbadges { display: flex; gap: 6px; flex-wrap: wrap; }
.kbadge {
  background: var(--canvas-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* User item */
.user-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
  transition: border-color .12s, box-shadow .12s;
  box-shadow: var(--shadow-xs);
}
.user-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.user-item .ui-left { display: flex; align-items: center; gap: 14px; }
.user-item .ui-avatar {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(99,102,241,0.25);
}
.user-item .uname { font-weight: 500; color: var(--text); font-size: 14.5px; }
.user-item .uhandle { font-size: 12.5px; color: var(--text-muted); }
.user-item .urole {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--canvas-2); color: var(--text-muted);
  font-weight: 500; text-transform: capitalize;
}
.user-item .urole.admin {
  background: var(--warning-soft); color: var(--warning-text);
}

/* Search */
.search-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.search-input {
  flex: 1; position: relative;
}
.search-input input {
  width: 100%; padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search-input input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring);
}
.search-input .search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}

/* Sections (tabs replaced by sidebar) */
.tabs-section { display: none; }
.tabs-section.active { display: block; }

/* Modals */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal h3 { margin: 0 0 18px; font-size: 17px; font-weight: 600; }
.modal label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin: 10px 0 6px;
}
.modal input, .modal textarea, .modal select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.modal input:focus, .modal textarea:focus, .modal select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring);
}
.modal textarea { min-height: 90px; resize: vertical; }
.modal .actions {
  margin-top: 20px;
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Misc */
.rate-bar {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 18px;
}
.rate-bar .rl {
  flex: 1;
  height: 8px;
  background: var(--canvas-2);
  border-radius: 999px; overflow: hidden;
  position: relative;
}
.rate-bar .rl .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6, #ec4899);
  transition: width .4s ease;
  border-radius: 999px;
}
.rate-bar .rate-text {
  font-size: 13.5px; color: var(--text-muted);
}
.rate-bar .rate-text strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* =========================================================
   TOASTS
   ========================================================= */
.toasts {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  max-width: 380px;
  pointer-events: auto;
  animation: toast-in .25s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 13.5px;
}
.toast .icon {
  width: 18px; height: 18px; flex-shrink: 0;
}
.toast.success .icon { color: var(--success); }
.toast.error   .icon { color: var(--danger); }
.toast.info    .icon { color: var(--primary); }
.toast.fade-out { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =========================================================
   EMPTY STATE polish
   ========================================================= */
.empty-state .ill {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-soft), #f5f3ff);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 8px 16px rgba(99,102,241,0.10);
}
