/* ==========================================================
   ADMIN PANEL STYLESHEET
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --admin-bg: #060912;
  --admin-sidebar-bg: #0c1222;
  --admin-header-bg: rgba(12, 18, 34, 0.85);
  --admin-card-bg: rgba(16, 24, 45, 0.7);
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-focus: rgba(99, 102, 241, 0.5);

  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary: #06b6d4;
  --accent: #8b5cf6;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-code: 'Fira Code', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme in Admin Studio */
[data-theme="light"] {
  --admin-bg: #f8fafc;
  --admin-sidebar-bg: #ffffff;
  --admin-header-bg: rgba(255, 255, 255, 0.92);
  --admin-card-bg: rgba(255, 255, 255, 0.95);
  --admin-border: rgba(203, 213, 225, 0.85);
  --admin-border-focus: rgba(79, 70, 229, 0.5);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .form-control {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .nav-item {
  color: #64748b;
}

[data-theme="light"] .nav-item:hover {
  background: rgba(79, 70, 229, 0.08);
  color: #0f172a;
}

[data-theme="light"] .nav-item.active {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
  border-left-color: #4f46e5;
}

[data-theme="light"] .modal-content {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .header-title-group h1 {
  color: #0f172a !important;
}

[data-theme="light"] .header-title-group p {
  color: #475569 !important;
}

[data-theme="light"] .sidebar-brand h2 {
  color: #0f172a !important;
}

[data-theme="light"] .sidebar-brand span {
  color: #0284c7 !important;
}

[data-theme="light"] .sidebar-user-info h4 {
  color: #0f172a !important;
}

[data-theme="light"] .metric-details h3 {
  color: #0f172a !important;
}

[data-theme="light"] .admin-card-title {
  color: #0f172a !important;
}

[data-theme="light"] .form-label {
  color: #334155 !important;
  font-weight: 600;
}

[data-theme="light"] .suggestion-chip {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 500;
}

[data-theme="light"] .suggestion-chip:hover {
  background: #4f46e5 !important;
  color: #ffffff !important;
}

[data-theme="light"] .btn-header-ghost {
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .btn-header-ghost:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

#copilot-chat-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--admin-border);
}

[data-theme="light"] #copilot-chat-box {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.copilot-header-title {
  color: #00ff88;
}

[data-theme="light"] .copilot-header-title {
  color: #059669 !important;
}

.copilot-confidential-badge {
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
  font-family: var(--font-code);
}

[data-theme="light"] .copilot-confidential-badge {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
  font-weight: 600;
}

.copilot-bubble-bot {
  align-self: flex-start;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.25);
  color: #00ff88;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
}

[data-theme="light"] .copilot-bubble-bot {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #065f46 !important;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.copilot-bubble-bot strong {
  color: #00ff88;
}

[data-theme="light"] .copilot-bubble-bot strong {
  color: #047857 !important;
}

.copilot-bubble-bot pre, .copilot-bubble-bot code {
  font-family: var(--font-code);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

[data-theme="light"] .copilot-bubble-bot pre, 
[data-theme="light"] .copilot-bubble-bot code {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.copilot-bubble-user {
  align-self: flex-end;
  background: var(--primary);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.5;
}

[data-theme="light"] .copilot-bubble-user {
  background: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

/* Card items in Admin Manager lists */
.admin-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: var(--transition);
}

.admin-item-card.align-center {
  align-items: center;
}

[data-theme="light"] .admin-item-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.admin-item-title {
  font-family: var(--font-heading);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
}

[data-theme="light"] .admin-item-title {
  color: #0f172a !important;
}

.admin-tag-pill {
  font-size: 0.72rem;
  font-family: var(--font-code);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  padding: 2px 7px;
  border-radius: 4px;
}

[data-theme="light"] .admin-tag-pill {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0;
}

.admin-rule-answer {
  font-size: 0.88rem;
  color: #cbd5e1;
  margin-top: 4px;
  line-height: 1.5;
}

[data-theme="light"] .admin-rule-answer {
  color: #334155 !important;
}

.admin-rule-keyword {
  font-size: 0.75rem;
  font-family: var(--font-code);
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  padding: 2px 7px;
  border-radius: 4px;
}

[data-theme="light"] .admin-rule-keyword {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

.admin-member-count {
  font-size: 0.8rem;
  color: #6ee7b7;
}

[data-theme="light"] .admin-member-count {
  color: #059669 !important;
  font-weight: 600;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--admin-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==========================================================
   PIN LOCK SCREEN OVERLAY
   ========================================================== */
.pin-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(20px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pin-lock-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-box {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--admin-border-focus);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 360px;
  max-width: 90%;
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.pin-lock-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 20px;
}

.pin-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pin-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pin-input-wrap {
  position: relative;
  margin-bottom: 20px;
}

.pin-input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  font-family: var(--font-code);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  color: #fff;
  outline: none;
  transition: var(--transition);
}

.pin-toggle-visibility {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.pin-toggle-visibility:hover {
  color: var(--secondary);
}

.pin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.pin-box.shake {
  animation: pinBoxShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pinBoxShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}

.pin-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: var(--transition);
}

.pin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.pin-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 14px;
}

/* ==========================================================
   ADMIN LAYOUT (SIDEBAR + MAIN)
   ========================================================== */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar-bg);
  border-right: 1px solid var(--admin-border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 0 15px var(--primary-glow);
}

.sidebar-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: var(--secondary);
  font-family: var(--font-code);
}

.sidebar-nav {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

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

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: #fff;
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-sidebar-link:hover {
  color: var(--secondary);
}

.btn-lock {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-lock:hover {
  color: var(--danger);
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  height: 72px;
  background: var(--admin-header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
}

.header-title-group p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.btn-header {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-header-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--admin-border);
  color: var(--text-main);
}

.btn-header-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-header-primary {
  background: var(--primary);
  color: #fff;
}

.btn-header-primary:hover {
  box-shadow: 0 0 15px var(--primary-glow);
}

/* Tab Views Container */
.admin-body {
  padding: 32px;
  flex: 1;
}

.admin-view {
  display: none;
  animation: fadeInView 0.25s ease-out;
}

.admin-view.active {
  display: block;
}

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

/* ==========================================================
   METRICS & CARDS
   ========================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.metric-card:hover {
  border-color: var(--admin-border-focus);
  transform: translateY(-2px);
}

.metric-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.metric-details h3 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.metric-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* General Panels & Boxes */
.admin-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

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

.admin-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.admin-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Forms & Inputs */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background: rgba(7, 11, 22, 0.8);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.btn-action {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 0 18px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

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

/* ==========================================================
   TABLES & LISTS
   ========================================================== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

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

.badge-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-code);
  font-weight: 600;
}

.badge-frontend { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-backend { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-tools { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-soft { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-action:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon-action.delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ==========================================================
   MODAL WINDOWS
   ========================================================== */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.admin-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.admin-modal-box {
  background: #0f1629;
  border: 1px solid var(--admin-border-focus);
  border-radius: var(--radius-lg);
  width: 540px;
  max-width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
  transform: translateY(15px);
  transition: var(--transition);
}

.admin-modal-overlay.open .admin-modal-box {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: #fff;
}

/* ==========================================================
   TOAST NOTIFICATION
   ========================================================== */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: #111a33;
  border: 1px solid var(--admin-border-focus);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  color: #fff;
  font-size: 0.9rem;
  animation: slideInToast 0.3s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }

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

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 6px;
}

.admin-sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--admin-border);
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}

.admin-sidebar-toggle:hover {
  background: var(--primary);
  color: #fff;
}

.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================
   MOBILE & TABLET RESPONSIVENESS (ALL DEVICES)
   ========================================================== */
@media (max-width: 900px) {
  .admin-sidebar-toggle {
    display: flex;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 999;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.65);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .admin-header {
    padding: 0 16px;
  }

  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  #copilot-chat-box {
    height: 320px !important;
  }
}

@media (max-width: 600px) {
  .admin-header {
    height: auto;
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-left-wrap {
    flex: 1;
    min-width: 200px;
  }

  .header-title-group h1 {
    font-size: 1.15rem;
  }

  .header-title-group p {
    font-size: 0.75rem;
  }

  .header-actions {
    gap: 8px;
  }

  .btn-header {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .admin-body {
    padding: 14px 10px;
  }

  .admin-card {
    padding: 16px 12px;
  }

  .admin-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .admin-card-title {
    font-size: 1.05rem;
  }

  .modal-box {
    width: 95vw;
    max-width: 95vw;
    padding: 18px 14px;
    max-height: 92vh;
  }

  .pin-box {
    width: 92vw;
    max-width: 360px;
    padding: 24px 16px;
  }

  .pin-input {
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    padding: 12px 38px 12px 12px;
  }

  .toast {
    min-width: 260px;
    font-size: 0.85rem;
  }
}

/* ==========================================================
   ADMIN DIARY & PERSONAL REFLECTIONS STYLING
   ========================================================== */
.diary-admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.diary-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diary-stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: #c084fc;
  font-family: var(--font-heading);
}

.diary-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.diary-admin-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.diary-admin-tabs {
  display: flex;
  gap: 8px;
}

.diary-admin-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diary-admin-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.diary-admin-tab.active {
  background: #a855f7;
  color: #ffffff;
  border-color: #a855f7;
}

.diary-admin-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  min-width: 280px;
}

.diary-admin-search-box i {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.diary-admin-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
  width: 100%;
}

.diary-admin-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diary-admin-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.diary-admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.diary-admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.diary-admin-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diary-admin-badge-public {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.diary-admin-badge-private {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.diary-admin-content-preview {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.diary-admin-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.diary-admin-meta-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.diary-admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-privacy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.btn-privacy-toggle:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #d8b4fe;
}

