/* ============================================================
   ADM SEKOLAH — Global Styles v2
   ============================================================ */

:root {
  --bg: #0a0c10;
  --bg-card: #111318;
  --bg-hover: #181c24;
  --bg-input: #0e1117;
  --border: #1e2433;
  --border-light: #252d3d;
  --text: #e8eaf0;
  --text-secondary: #9aa3b8;
  --text-muted: #5a6480;
  --accent: #4f8ef7;
  --accent-soft: #4f8ef714;
  --accent-hover: #6aa0ff;
  --purple: #a855f7;
  --purple-soft: #a855f714;
  --green: #22c55e;
  --green-soft: #22c55e14;
  --amber: #f59e0b;
  --amber-soft: #f59e0b14;
  --red: #f43f5e;
  --red-soft: #f43f5e14;
  --cyan: #06b6d4;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 60px;
  --header-h: 0px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px #00000040;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-hover: #1d4ed8;
  --purple: #9333ea;
  --purple-soft: #f3e8ff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --cyan: #0891b2;
  --shadow: 0 4px 24px #0000000a;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
#sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  flex-shrink: 0;
}
.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px #4f8ef730;
}
#logo-text { white-space: nowrap; overflow: hidden; }
.logo-title { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: 0.3px; }
.logo-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.quota-badge {
  margin: 0 16px 16px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.quota-badge:hover {
  background: rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.nav-section { margin-bottom: 6px; }
.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
#sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* ===== MAIN CONTENT ===== */
#main-content {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
#main-content.sidebar-open { margin-left: var(--sidebar-w); }
#main-content.sidebar-closed { margin-left: var(--sidebar-w-collapsed); }

#page-content {
  flex: 1;
  overflow-y: auto;
}

/* ===== PAGE ===== */
.page {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}
.page-header {
  margin-bottom: 22px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.page-header p { font-size: 13px; color: var(--text-secondary); }

/* ===== HERO ===== */
.hero-gradient {
  background: linear-gradient(135deg, #4f8ef715 0%, #a855f715 50%, #06b6d415 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}
.hero-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, #4f8ef708 100%);
}
.hero-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.hero-subtitle { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.hero-illustration {
  position: absolute;
  right: 0;
  bottom: -5px;
  width: 50%;
  max-width: 400px;
  height: 100%;
  max-height: 160px;
  z-index: 0;
  opacity: 0.9;
  pointer-events: none;
}
@media (max-width: 768px) {
  .hero-illustration { opacity: 0.3; width: 70%; right: -10%; }
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change.neutral { color: var(--text-muted); }

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}
.quick-action-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.quick-action-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== TWO COL ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ===== CARD ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ===== DOC LIST ===== */
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.doc-item:hover { border-color: var(--border-light); }
.doc-info { flex: 1; overflow: hidden; }
.doc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.doc-actions { display: flex; gap: 5px; flex-shrink: 0; }
@media (max-width: 640px) {
  .doc-item { flex-direction: column; align-items: flex-start; }
  .doc-actions { width: 100%; justify-content: flex-end; }
}

.doc-filters::-webkit-scrollbar { display: none; }
.doc-filters { scrollbar-width: none; }

/* ===== FILTER CHIPS ===== */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ===== CATEGORY GRID ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
}
.category-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.category-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}
.category-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}
.category-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.category-count {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== TEMPLATE GRID ===== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px #4f8ef720;
}
.template-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.template-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.template-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.template-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ===== SEARCH BAR ===== */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px !important; }
.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  z-index: 1;
  pointer-events: none;
}

/* ===== FILE BADGES ===== */
.file-badge {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.file-badge.word { background: #1e40af22; color: #60a5fa; border: 1px solid #1e40af40; }
.file-badge.excel, .file-badge.xlsx { background: #14532d22; color: #4ade80; border: 1px solid #14532d40; }
.file-badge.pdf { background: #7f1d1d22; color: #f87171; border: 1px solid #7f1d1d40; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 9px;
}
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }

.model-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4f8ef722, #a855f722);
  border: 1px solid #4f8ef740;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  color: var(--accent);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px #4f8ef740;
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--text-muted); background: #1e2433; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f43f5e30;
}
.btn-danger:hover:not(:disabled) { background: #f43f5e25; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
  width: 100%;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #4f8ef718;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-select { appearance: none; -webkit-appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 10px; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 5px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 10px;
  transition: width 0.3s;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: #00000090;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px #00000080;
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 820px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== CHAT ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; align-self: flex-end; }
.msg.assistant { align-self: flex-start; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  margin-top: 2px;
}
.msg.user .msg-avatar { background: var(--accent-soft); border-color: #4f8ef730; }
.msg.assistant .msg-avatar { background: var(--purple-soft); border-color: #a855f730; }

.msg-bubble {
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 15px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  transition: border-color var(--transition);
}
.chat-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4f8ef718; }
.chat-textarea::placeholder { color: var(--text-muted); }

/* ===== NOTIFICATION ===== */
#notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px #00000060;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 9999;
  max-width: 380px;
  pointer-events: none;
}
#notification.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
#notification.success { border-color: #22c55e40; }
#notification.error { border-color: #f43f5e40; }
#notification.warning { border-color: #f59e0b40; }
#notification.info { border-color: #4f8ef740; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }

/* ===== SPINNER ===== */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
  background: #00000090;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px #00000080;
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 820px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== CHAT ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; align-self: flex-end; }
.msg.assistant { align-self: flex-start; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  margin-top: 2px;
}
.msg.user .msg-avatar { background: var(--accent-soft); border-color: #4f8ef730; }
.msg.assistant .msg-avatar { background: var(--purple-soft); border-color: #a855f730; }

.msg-bubble {
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 15px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  transition: border-color var(--transition);
}
.chat-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4f8ef718; }
.chat-textarea::placeholder { color: var(--text-muted); }

/* ===== NOTIFICATION ===== */
#notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px #00000060;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 9999;
  max-width: 380px;
  pointer-events: none;
}
#notification.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
#notification.success { border-color: #22c55e40; }
#notification.error { border-color: #f43f5e40; }
#notification.warning { border-color: #f59e0b40; }
#notification.info { border-color: #4f8ef740; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }

/* ===== SPINNER ===== */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; z-index: 1000; position: fixed; height: 100vh; }
  #sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.5); }
  #main-content { margin-left: 0 !important; padding-top: 60px; }
  .page { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .template-grid { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .hero-gradient { padding: 20px; }
  .modal { max-width: 98vw; margin: 8px; }
  .two-col { grid-template-columns: 1fr; }
  .chat-messages { padding: 14px; }
  
  .mobile-topbar { display: flex !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .template-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 16px; }
  .filter-chips { display: none; }
  
  .doc-item {
    align-items: flex-start;
  }
  .doc-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Custom Signature Table Styling */
table.ttd-table, .markdown-content table.ttd-table { border: none !important; margin: 2rem 0; width: 100%; text-align: center; }
table.ttd-table th, table.ttd-table td, .markdown-content table.ttd-table th, .markdown-content table.ttd-table td { border: none !important; text-align: center; vertical-align: top; padding: 1rem 0.5rem; background: transparent; }

/* Mobile Menu UI */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
}
.mobile-menu-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 8px;
  cursor: pointer;
}
.mobile-topbar-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}
.mobile-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-screen.hidden {
  display: none !important;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.login-header {
  text-align: center;
  margin-bottom: 24px;
}
.login-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}
.login-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-header p {
  color: var(--text-muted);
  font-size: 14px;
}
.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.login-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

@media (max-width: 768px) {
  .model-badge {
    display: none !important;
  }
}
