/* ═══════════════════════════════════════════════════════════════
   KuB DISPO DASHBOARD — Premium Dark UI
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base: #0b0d14;
  --bg-surface: #111420;
  --bg-elevated: #171b28;
  --bg-card: #1c2133;
  --bg-card-hover: #212640;
  --bg-glass: rgba(28, 33, 51, 0.7);
  --bg-glass-hover: rgba(34, 40, 62, 0.85);

  --accent-primary: #6c63ff;
  --accent-primary-glow: rgba(108, 99, 255, 0.3);
  --accent-primary-soft: rgba(108, 99, 255, 0.15);
  --accent-secondary: #00d4aa;
  --accent-secondary-glow: rgba(0, 212, 170, 0.25);

  --danger: #ff4d6d;
  --danger-glow: rgba(255, 77, 109, 0.25);
  --danger-soft: rgba(255, 77, 109, 0.12);
  --success: #00d4aa;
  --success-glow: rgba(0, 212, 170, 0.25);
  --success-soft: rgba(0, 212, 170, 0.12);
  --warning: #ffc94d;
  --warning-glow: rgba(255, 201, 77, 0.25);
  --warning-soft: rgba(255, 201, 77, 0.1);

  --text-primary: #e8eaf6;
  --text-secondary: #9198b8;
  --text-muted: #5d6585;
  --text-on-accent: #ffffff;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(108, 99, 255, 0.4);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { height: 100%; font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 1000;
  overflow: hidden;
}

.login-bg-decoration {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(108,99,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(0,212,170,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 50% 50%, rgba(108,99,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: var(--space-2xl);
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(108,99,255,0.08);
  animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--accent-primary-glow);
}

.login-logo-icon svg {
  width: 30px;
  height: 30px;
  color: white;
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 30%, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Form ────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
  background: rgba(108,99,255,0.05);
}

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

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239198b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #8b83ff);
  color: white;
  box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-primary-glow);
  filter: brightness(1.1);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(255,77,109,0.2);
}

.btn-danger:hover {
  background: rgba(255,77,109,0.2);
  box-shadow: 0 4px 12px var(--danger-glow);
}

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

.btn-group {
  display: flex;
  gap: var(--space-sm);
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-top: var(--space-sm);
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255,77,109,0.25);
  color: #ff6b88;
}

.alert-success {
  background: var(--success-soft);
  border: 1px solid rgba(0,212,170,0.25);
  color: var(--success);
}

/* ══════════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base), min-width var(--transition-base);
  overflow: hidden;
  z-index: 100;
  position: relative;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.sidebar-logo-icon svg { width: 18px; height: 18px; color: white; }

.sidebar-logo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Navigation ──────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-sm);
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item svg { width: 18px; height: 18px; min-width: 18px; }

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-divider {
  padding: var(--space-sm) var(--space-sm) 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

.user-details { overflow: hidden; }

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-logout svg { width: 15px; height: 15px; }

.btn-logout:hover {
  background: var(--danger-soft);
  border-color: rgba(255,77,109,0.3);
  color: var(--danger);
}

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: 62px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-lg);
  background: rgba(11,13,20,0.9);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle svg { width: 18px; height: 18px; }

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ── Sections ────────────────────────────────────────────────── */
.section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  animation: fadeInSection 0.25s ease;
}

.section.active { display: flex; flex-direction: column; gap: var(--space-lg); }

@keyframes fadeInSection {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Stats Row ───────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.stat-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--danger), transparent);
}

.stat-card-green::before {
  background: linear-gradient(90deg, var(--success), transparent);
}

.stat-card-blue::before {
  background: linear-gradient(90deg, var(--accent-primary), transparent);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--danger);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card-green .stat-value { color: var(--success); }
.stat-card-blue .stat-value { color: var(--accent-primary); }

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── Panel ───────────────────────────────────────────────────── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--accent-primary);
}

/* ── Handover Entries List ───────────────────────────────────── */
.entries-list {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.handover-entry {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  animation: entrySlideIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

@keyframes entrySlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.handover-entry::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--danger);
  border-radius: 0 2px 2px 0;
}

.handover-entry.resolved::before { background: var(--success); }

.handover-entry:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

/* Custom Checkbox */
.entry-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
}

.entry-checkbox input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.entry-checkbox-ui {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.entry-checkbox input:checked + .entry-checkbox-ui {
  background: var(--success);
  border-color: var(--success);
}

.entry-checkbox-ui svg {
  width: 12px; height: 12px;
  color: white;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--transition-fast);
}

.entry-checkbox input:checked + .entry-checkbox-ui svg {
  opacity: 1;
  transform: scale(1);
}

.entry-content { flex: 1; min-width: 0; }

.entry-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.handover-entry.resolved .entry-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.entry-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.entry-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
}

.tag-duration {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(255,201,77,0.2);
}

.tag-creator {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tag-resolved {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(0,212,170,0.2);
}

.tag-time {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.entry-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-icon svg { width: 14px; height: 14px; }

.btn-icon:hover {
  background: var(--danger-soft);
  border-color: rgba(255,77,109,0.25);
  color: var(--danger);
}

/* ── Table ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  padding: 12px var(--space-lg);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  animation: rowFadeIn 0.2s ease;
}

@keyframes rowFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 12px var(--space-lg);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* ── Loading & Empty States ──────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── RICH TEXT EDITOR ────────────────────────── */
.rt-editor-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}
.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}
.rt-toolbar button {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  padding: 0;
  font-family: inherit;
}
.rt-toolbar button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.rt-toolbar button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}
.rt-toolbar .separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.rt-content {
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  padding: 14px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  line-height: 1.6;
  background: transparent;
}
.rt-content:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
}
.rt-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 8px 0;
}
.rt-content h3, .rt-content h4 {
  margin-top: 12px;
  margin-bottom: 8px;
}

/* ── POST CARDS (Tutorials / News) ───────────── */
.post-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.post-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  align-items: center;
}
.post-content {
  color: var(--text-secondary);
  line-height: 1.6;
}
.post-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 12px 0;
}
.post-content h1, .post-content h2, .post-content h3 {
  color: var(--text-primary);
  margin: 16px 0 8px 0;
}

/* Acknowledgment elements */
.ack-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: #ef4444;
}
.ack-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ack-badge.pending {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.ack-badge.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.ack-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ack-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ack-user-row:last-child {
  border-bottom: none;
}
.ack-indicator-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 6px;
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.empty-state p { font-size: 0.82rem; }

/* Role Badge */
.role-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.role-admin {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid var(--border-accent);
}

.role-user {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 520px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.5);
  z-index: 210;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close svg { width: 16px; height: 16px; }

.modal-close:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 300;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  font-size: 0.875rem;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

.toast-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg { width: 13px; height: 13px; }

.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-info .toast-icon { background: var(--accent-primary-soft); color: var(--accent-primary); }

.toast-text { flex: 1; color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { overflow: auto; }
  .app { flex-direction: column; overflow: auto; }

  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: var(--space-sm);
  }

  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: var(--space-sm);
    font-size: 0.7rem;
    min-width: 70px;
  }

  .nav-item::before { display: none; }
  .nav-item svg { width: 20px; height: 20px; }

  .sidebar-footer { display: none; }
  .main-content { overflow: auto; }
  .section { overflow: visible; }

  .stats-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .btn-group { flex-direction: column; }

  .modal { width: 95%; max-height: 90vh; }
  .modal-body { max-height: 50vh; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 var(--space-md); }
  .section { padding: var(--space-md); }
  .panel-header { flex-direction: column; align-items: flex-start; }
}
