:root {
  --brand-primary: #1e40af;
  --brand-secondary: #3b82f6;
  --brand-accent: #93c5fd;
  --brand-success: #10b981;
  --brand-danger: #ef4444;
  --app-bg: linear-gradient(135deg, #f0f7ff 0%, #e0efff 50%, #f0f7ff 100%);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(30, 64, 175, 0.15);
  --glass-shadow: 0 12px 40px -8px rgba(30, 64, 175, 0.12);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --glass-blue-tint: rgba(30, 64, 175, 0.08);
  --glass-blue-pop: rgba(30, 64, 175, 0.18);
  --glass-blue-deep: rgba(30, 64, 175, 0.4);
  --radius-glass: 24px;
  --radius-btn: 12px;
  --sidebar-w: 280px;
  --topbar-h: 85px;
  --section-p: 3rem;
  --card-p: 2rem;
  --footer-p: 4rem;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --app-bg: radial-gradient(circle at top right, #020617, #0f172a);
  --glass-bg: rgba(15, 23, 42, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-blue-tint: rgba(37, 99, 235, 0.2);
  --glass-blue-pop: rgba(37, 99, 235, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--app-bg) fixed;
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}
a { color: var(--brand-secondary); text-decoration: none; }
a:hover { color: var(--brand-primary); }

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-glass);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
  padding: var(--card-p);
}

.fade-up { animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.page-container { max-width: 1400px; margin: 0 auto; width: 100%; padding: 0 2rem; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; border: none; border-radius: var(--radius-btn); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; text-decoration: none; line-height: 1.2; }
.btn-primary { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: white; box-shadow: 0 10px 25px -5px rgba(30, 64, 175, 0.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 15px 30px -5px rgba(30, 64, 175, 0.45); color: white; }
.btn-secondary { background: var(--glass-blue-tint); color: var(--brand-primary); }
.btn-secondary:hover { background: var(--glass-blue-pop); }
.btn-outline { background: transparent; color: var(--brand-primary); border: 2px solid var(--brand-primary); }
.btn-outline:hover { background: var(--brand-primary); color: white; }
.btn-lg { height: 48px; padding: 0 30px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; height: 50px; font-size: 1.05rem; border-radius: 14px; }
.btn-save { width: 180px; height: 46px; margin: 0 auto; display: block; border-radius: 14px; font-size: 1rem; }
.btn-back { background: var(--glass-blue-tint); color: var(--brand-primary); padding: 6px 16px; border-radius: 10px; }
.btn-back:hover { background: var(--glass-blue-pop); }
.btn-action { padding: 6px 14px; border: none; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; background: var(--glass-blue-tint); color: var(--brand-primary); transition: var(--transition); }
.btn-action:hover { background: var(--glass-blue-pop); }
.btn-pin { background: transparent; color: var(--brand-secondary); }
.btn-del { background: transparent; color: #dc2626; }
.btn-del:hover { background: #fef2f2; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; transform: translateY(-2px); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 8px; }

/* ─── Topbar ────────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; width: 100%; }
.main-area { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: var(--topbar-h);
  width: 100%;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1040;
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.25), rgba(59, 130, 246, 0.15));
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-bottom: 2px solid rgba(30, 64, 175, 0.2);
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.1);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 2rem; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
#sidebarToggleBtn {
  background: var(--brand-primary); color: white; border: none; border-radius: 12px;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s; box-shadow: 0 8px 20px rgba(30, 64, 175, 0.25); cursor: pointer;
  font-size: 1.3rem;
}
#sidebarToggleBtn:hover { transform: scale(1.05); }
.topbar-title { font-size: 1rem; font-weight: 800; color: var(--brand-primary); letter-spacing: -0.5px; line-height: 1.2; }
.topbar-breadcrumb { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; opacity: 0.7; }
.topbar-search { position: relative; }
.topbar-search input {
  width: 250px; padding: 8px 16px 8px 36px; border: none; border-radius: 50px;
  background: rgba(255,255,255,0.5); backdrop-filter: blur(10px); font-size: 0.85rem; font-weight: 600; outline: none; color: var(--text-main);
}
.topbar-search input:focus { background: rgba(255,255,255,0.8); box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.topbar-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--brand-primary); opacity: 0.5; font-size: 0.9rem; }
.theme-toggle {
  background: rgba(255,255,255,0.3); backdrop-filter: blur(10px); border: 1px solid var(--glass-border);
  border-radius: 50px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; transition: all 0.3s; color: var(--text-main);
}
.theme-toggle:hover { background: var(--glass-blue-tint); }

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
  z-index: 1999; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }
.sidebar-trigger-zone {
  position: fixed; left: 0; top: 0; bottom: 0; width: 30px; z-index: 2001;
  pointer-events: all; background: transparent;
}
.app-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 20px 0 60px rgba(0,0,0,0.1);
  overflow-y: auto;
}
.app-sidebar.show { transform: translateX(0); }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 0; }
.sidebar-brand {
  padding: 1.5rem 1.5rem 1rem;
}
.sidebar-brand a {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
}
.sidebar-brand-icon {
  width: 42px; height: 42px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.25);
}
.sidebar-brand-icon span { color: white; font-size: 1.3rem; font-weight: 700; }
.sidebar-brand-text {
  font-size: 1.3rem; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; padding: 0.9rem 1.25rem; margin: 0.1rem 0.5rem;
  color: var(--text-muted); text-decoration: none; border-radius: 14px;
  font-weight: 600; transition: all 0.2s ease; border: 1px solid transparent;
  font-size: 0.9rem;
}
.sidebar-link i { font-size: 1.3rem; width: 2rem; display: inline-flex; align-items: center; justify-content: center; margin-right: 8px; }
.sidebar-link:hover { background: var(--glass-blue-tint); color: var(--brand-primary); transform: translateX(4px); }
.sidebar-link.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff; box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}
.sidebar-link.active i { color: #fff; }
.sidebar-link.logout { margin-top: auto; }
.sidebar-user {
  padding: 1rem 1.25rem; margin: 0.5rem;
  border-radius: 16px; background: rgba(255,255,255,0.3);
  border: 1px solid var(--glass-border);
}
.sidebar-user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(30, 64, 175, 0.15); color: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; border: 2px solid white; flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; min-width: 0; flex: 1; }
.sidebar-user-name { font-weight: 700; font-size: 0.85rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { background: none; border: none; color: #dc2626; font-size: 0.75rem; font-weight: 700; cursor: pointer; padding: 0; }

/* ─── Auth Pages ────────────────────────────────────────────────────────────── */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 2rem; }
.auth-card { width: 100%; max-width: 480px; background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); overflow: hidden; box-shadow: var(--glass-shadow); }
.auth-header { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); padding: 3rem 2rem; text-align: center; color: white; }
.auth-header i { font-size: 3rem; margin-bottom: 0.75rem; display: block; filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2)); }
.auth-header h2 { font-weight: 800; margin-bottom: 0; font-size: 1.5rem; }
.auth-header p { font-size: 0.7rem; opacity: 0.75; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; margin-top: 0.5rem; }
.auth-body { padding: 2.5rem 2rem; }
.auth-footer { padding: 1.5rem; text-align: center; border-top: 1px solid var(--glass-border); background: rgba(30, 64, 175, 0.03); font-size: 0.85rem; color: var(--text-muted); }
.auth-footer a { font-weight: 800; }

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; opacity: 0.5; margin-bottom: 0.5rem; color: var(--text-main); letter-spacing: 0.5px; }
.glass-input {
  width: 100%; padding: 0.85rem 1.25rem; border: 2px solid transparent; border-radius: 12px;
  font-size: 0.95rem; font-weight: 500; transition: all 0.3s; outline: none;
  background: rgba(255,255,255,0.6); color: var(--text-main);
}
.glass-input:focus { border-color: var(--brand-primary); background: rgba(255,255,255,0.8); box-shadow: 0 10px 20px -5px rgba(30, 64, 175, 0.15); transform: translateY(-2px); }
[data-theme="dark"] .glass-input { background: rgba(15, 23, 42, 0.4); color: var(--text-main); }
[data-theme="dark"] .glass-input:focus { background: rgba(15, 23, 42, 0.6); }

/* ─── Landing Page ─────────────────────────────────────────────────────────── */
.landing { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; }
.landing-card { max-width: 860px; width: 100%; text-align: center; }
.badge { display: inline-block; padding: 6px 18px; background: rgba(59,130,246,0.1); color: var(--brand-secondary); border-radius: 20px; font-size: 0.85rem; font-weight: 600; margin-bottom: 20px; }
.landing-title { font-size: 2.5rem; font-weight: 800; line-height: 1.2; margin-bottom: 16px; color: var(--text-main); letter-spacing: -1px; }
.landing-desc { font-size: 1.05rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 32px; line-height: 1.5; }
.landing-actions { display: flex; gap: 16px; justify-content: center; margin-bottom: 48px; }
.feature-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.feature-card { background: white; border-radius: var(--radius-btn); padding: 24px 20px; width: 240px; text-align: left; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.feature-card .accent-line { width: 34px; height: 3px; border-radius: 2px; margin-bottom: 16px; }

/* ─── Notes Page ────────────────────────────────────────────────────────────── */
.app-main { flex-grow: 1; padding: var(--section-p) 0; width: 100%; min-height: calc(100vh - var(--topbar-h)); }
.notes-page { max-width: 1200px; margin: 0 auto; padding: 0 2rem; min-width: 0; width: 100%; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { text-align: center; padding: 1.5rem 1rem; }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; display: block; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; margin-bottom: 2px; }
.stat-card .stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; opacity: 0.75; letter-spacing: 1px; }

.notes-toolbar { margin-bottom: 2rem; }
.notes-toolbar .glass-card { padding: 1.25rem 1.5rem; }
.notes-toolbar-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.notes-toolbar-inner .search-box { flex: 1; min-width: 200px; position: relative; }
.notes-toolbar-inner .search-box input {
  width: 100%; padding: 10px 14px 10px 36px; border: none; border-radius: 50px;
  background: rgba(255,255,255,0.5); font-size: 0.85rem; font-weight: 600; outline: none; color: var(--text-main);
  backdrop-filter: blur(10px);
}
.notes-toolbar-inner .search-box input:focus { background: rgba(255,255,255,0.8); box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.notes-toolbar-inner .search-box .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--brand-primary); opacity: 0.5; font-size: 0.9rem;
}

.note-grid-glass { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.note-card {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-glass);
  box-shadow: var(--glass-shadow); padding: var(--card-p);
  transition: all 0.3s ease; position: relative;
}
.note-card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px -12px rgba(30, 64, 175, 0.2); }
.pin-badge { position: absolute; top: 12px; right: 14px; font-size: 0.9rem; }
.note-card-title { font-size: 1rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 24px; max-width: 100%; }
.note-card-preview { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.note-card { min-width: 0; }
.note-card-meta { font-size: 0.78rem; color: var(--brand-secondary); margin-bottom: 16px; font-weight: 500; }
.note-card-assets { margin-left: 8px; color: var(--brand-accent); }
.note-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.25; color: var(--brand-primary); }
.empty-state h3 { font-weight: 700; margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; }

/* ─── Editor ────────────────────────────────────────────────────────────────── */
.editor-page { max-width: 1000px; margin: 0 auto; padding: 0 2rem; width: 100%; }
.editor-card { border-radius: var(--radius-glass); overflow: hidden; }
.editor-card .tox { border: none !important; border-radius: 0 !important; }
.editor-card .tox-tinymce { border: none !important; }
.editor-card .tox .tox-edit-area { overflow-x: auto !important; }
.editor-header {
  padding: 16px 24px; border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 16px;
}
.editor-title {
  flex: 1; border: none; font-size: 1.5rem; font-weight: 700; color: var(--text-main);
  outline: none; background: transparent; padding: 4px 0;
}
.editor-actions { padding: 16px 24px; border-top: 1px solid var(--glass-border); }
.action-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.share-input { padding: 8px 12px; border: 2px solid transparent; border-radius: 10px; font-size: 0.85rem; width: 200px; background: rgba(255,255,255,0.5); outline: none; font-weight: 500; }
.share-input:focus { border-color: var(--brand-primary); background: rgba(255,255,255,0.8); }
.attachment-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  background: var(--glass-blue-tint); border-radius: 8px; font-size: 0.8rem; color: var(--brand-primary);
  border: 1px solid var(--glass-border);
}
.attachment-chip a { color: var(--text-muted); text-decoration: none; }
.attachment-chip a:hover { color: #dc2626; }

/* ─── Detail Page ───────────────────────────────────────────────────────────── */
.detail-page { max-width: 900px; margin: 0 auto; padding: 0 2rem; min-width: 0; width: 100%; }
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; flex-wrap: wrap; gap: 12px; }
.detail-actions { display: flex; gap: 8px; }
.note-content { line-height: 1.8; font-size: 1.05rem; color: var(--text-main); word-wrap: break-word; overflow-wrap: break-word; max-width: 100%; }
.note-content img { max-width: 100%; height: auto; border-radius: 16px; margin: 2rem 0; box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15); display: block; border: 1px solid rgba(255,255,255,0.2); }
.note-content table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 2rem 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--glass-border); display: block; overflow-x: auto; }
.note-content table td, .note-content table th { padding: 15px 20px; border: 1px solid var(--glass-border); white-space: nowrap; }
.note-content table th { background: var(--glass-blue-tint); font-weight: 800; color: var(--brand-primary); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }
.note-content p { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.note-content blockquote { border-left: 4px solid var(--brand-secondary); padding: 12px 20px; margin: 16px 0; background: var(--glass-blue-tint); border-radius: 0 12px 12px 0; }
.note-content pre { background: #1e293b; color: #e2e8f0; padding: 20px; border-radius: 12px; overflow-x: auto; margin: 16px 0; max-width: 100%; }
.note-content code { background: var(--glass-blue-tint); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; word-break: break-word; }
.note-content a { word-break: break-all; }

/* ─── Admin ─────────────────────────────────────────────────────────────────── */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 0 2rem; min-width: 0; width: 100%; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; padding: 6px; border-radius: var(--radius-glass); flex-wrap: wrap; }
.tab { padding: 10px 24px; border-radius: var(--radius-btn); cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); transition: var(--transition); border: none; background: transparent; }
.tab.active { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: white; box-shadow: 0 8px 20px rgba(30,64,175,0.3); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.admin-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; }
.admin-chart-grid .glass-card { min-width: 0; overflow: hidden; position: relative; }
.admin-chart-grid canvas { display: block; max-width: 100%; max-height: 200px; }
.admin-donut-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; min-width: 0; }
.admin-donut-grid .glass-card { min-width: 0; overflow: hidden; position: relative; }
.admin-donut-grid canvas { display: block; max-width: 100%; max-height: 200px; }
.admin-restart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-row { min-width: 0; }
.stats-row .glass-card { overflow: hidden; }

.data-table-wrapper { overflow-x: auto; border-radius: var(--radius-glass); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--glass-border); font-size: 0.85rem; }
.data-table th { background: var(--glass-blue-tint); font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .actions-cell { display: flex; gap: 6px; }
.data-table .empty { text-align: center; padding: 40px; color: var(--text-muted); }

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.app-footer {
  background: linear-gradient(to top, rgba(30, 64, 175, 0.12), rgba(30, 64, 175, 0.05));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 2px solid rgba(30, 64, 175, 0.15);
  padding: var(--footer-p) 0; margin-top: auto; width: 100%;
}

/* ─── Diagnostics ───────────────────────────────────────────────────────────── */
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.diag-card { text-align: center; padding: 24px; border-radius: var(--radius-glass); }
.diag-card strong { font-size: 1rem; display: block; margin-bottom: 4px; }
.diag-card span { font-size: 0.85rem; color: var(--text-muted); }
.diag-pass { background: rgba(220,252,231,0.5); border: 1px solid #bbf7d0; color: #166534; }
.diag-fail { background: rgba(254,242,242,0.5); border: 1px solid #fecaca; color: #991b1b; }
.diag-log { background: #1e293b; color: #e2e8f0; padding: 16px 20px; border-radius: 12px; font-family: monospace; font-size: 0.85rem; line-height: 1.6; margin-top: 24px; }

/* ─── Offline Indicator ─────────────────────────────────────────────────────── */
#offlineBadge {
  animation: pulseOffline 2s ease-in-out infinite;
}
@keyframes pulseOffline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
#offlineMsg {
  animation: slideDown 0.3s ease forwards;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .page-container, .topbar-inner { padding: 0 1.5rem; }
}
@media (max-width: 992px) {
  :root { --section-p: 2rem; --footer-p: 3rem; }
}
@media (max-width: 768px) {
  :root { --topbar-h: 70px; --section-p: 1.5rem; --card-p: 1.25rem; --footer-p: 2.5rem; --radius-glass: 16px; }
  .page-container, .topbar-inner { padding: 0 1rem; }
  .app-sidebar { width: 85%; max-width: 320px; }
  .sidebar-trigger-zone { width: 15px; }
  .note-grid-glass { grid-template-columns: 1fr; gap: 1.25rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .auth-container { padding: 1.5rem 1rem; }
  .auth-header { padding: 2rem 1.5rem; }
  .auth-body { padding: 1.5rem; }
  .topbar-search input { width: 160px; }
  .landing-title { font-size: 1.8rem; }
  .admin-chart-grid { grid-template-columns: 1fr; }
  .admin-donut-grid { grid-template-columns: 1fr; }
  .admin-restart-grid { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; align-items: flex-start; }
  .detail-actions { width: 100%; flex-wrap: wrap; }
  .editor-header { flex-wrap: wrap; }
  .editor-title { font-size: 1.1rem; width: 100%; }
  .action-row { flex-direction: column; align-items: stretch; }
  .action-row .share-input { width: 100% !important; }
  .notes-page, .detail-page, .editor-page, .admin-page { padding: 0 1rem; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-card { padding: 1rem 0.75rem; }
  .landing-actions { flex-direction: column; align-items: stretch; }
  .note-card-actions { flex-direction: column; }
  .auth-card { border-radius: 16px; }
  .admin-tabs { gap: 2px; padding: 4px; }
  .tab { padding: 8px 12px; font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 10px 8px; font-size: 0.78rem; }
}
