/* ==========================================================================
   D.SIGNATURE StudioFlow - Dark Luxury Obsidian Design System
   UX/UI Promax Architecture Theme
   ========================================================================== */

:root {
  /* Color Palette - Obsidian & Architectural Luxury (UI/UX Pro Max) */
  --bg-app: #080a0f;
  --bg-card: #10141d;
  --bg-card-hover: #161b27;
  --bg-card-active: #1b2130;
  --bg-input: #0c0f16;
  --bg-header: rgba(9, 12, 18, 0.85);
  --bg-sidebar: #0c0f16;
  --bg-modal: #10141e;
  --bg-glass: rgba(16, 20, 29, 0.78);

  /* Accents */
  --accent-gold: #d4af37;
  --accent-gold-hover: #e5be48;
  --accent-gold-subtle: rgba(212, 175, 55, 0.12);
  --accent-gold-border: rgba(212, 175, 55, 0.32);

  --accent-blue: #38bdf8;
  --accent-blue-subtle: rgba(56, 189, 248, 0.12);
  --accent-blue-border: rgba(56, 189, 248, 0.32);

  --accent-purple: #a78bfa;
  --accent-purple-subtle: rgba(167, 139, 250, 0.12);

  --accent-emerald: #34d399;
  --accent-emerald-subtle: rgba(52, 211, 153, 0.12);
  --accent-emerald-border: rgba(52, 211, 153, 0.32);

  --accent-orange: #fb923c;
  --accent-orange-subtle: rgba(251, 146, 60, 0.12);

  --accent-rose: #f472b6;
  --accent-rose-subtle: rgba(244, 114, 182, 0.12);

  --accent-danger: #f87171;
  --accent-danger-subtle: rgba(248, 113, 113, 0.12);
  --accent-danger-border: rgba(248, 113, 113, 0.32);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.13);
  --border-gold: rgba(212, 175, 55, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.5), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.65), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow-gold: 0 0 20px rgba(212, 175, 55, 0.25);

  /* Geometry & Radius */
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Transitions */
  --anim-fast: 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  --anim-normal: 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  --anim-smooth: 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  background-image: radial-gradient(circle at 50% -10%, #151a26 0%, #080a0f 65%, #050608 100%);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Font Monospace Utility */
.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   APP HEADER & NAVIGATION
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 54px;
  background-color: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  width: 100%;
  max-width: 100%;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #e5be48, #d4af37, #997819);
  color: #0b0d13;
  font-weight: 900;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 10.5px;
  color: var(--accent-gold);
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* Main Navigation Tabs */
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 22, 32, 0.6);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--anim-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #0b0d13;
  background: linear-gradient(135deg, #e5be48, #d4af37);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
  font-weight: 700;
}

.nav-tab-btn.admin-tab {
  border: 1px dashed rgba(212, 175, 55, 0.3);
}

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

/* Live Realtime Status Pill */
.live-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseLive 2s infinite ease-in-out;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Minimalist Dot Indicators */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}
.dot-cao {
  background-color: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}
.dot-vua {
  background-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}
.dot-thap {
  background-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}
.dot-running {
  background-color: #e5be48;
  box-shadow: 0 0 8px rgba(229, 190, 72, 0.5);
}
.dot-pending {
  background-color: #94a3b8;
}
.dot-done {
  background-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

/* User Profile Badge */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--anim-fast);
  user-select: none;
}

.user-profile-badge:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-meta-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.user-role-label {
  font-size: 10px;
  color: var(--accent-gold);
  font-weight: 600;
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: 54px;
  right: 24px;
  width: 220px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
  backdrop-filter: blur(20px);
}

.profile-dropdown.show {
  display: flex;
  animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--anim-fast);
}

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

.dropdown-item.text-danger:hover {
  background-color: var(--accent-danger-subtle);
  color: var(--accent-danger);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

/* ==========================================================================
   IN-APP NOTIFICATION BELL & DROPDOWN PANEL
   ========================================================================== */

.notification-area {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--anim-fast);
}

.notif-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-header);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.6);
  animation: notifPulse 2.5s infinite ease-in-out;
}

.notif-badge.has-overdue {
  background: linear-gradient(135deg, #f43f5e, #dc2626);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.8);
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* NOTIFICATION FLYOUT DROPDOWN */
.notif-flyout {
  position: absolute;
  top: 48px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  background-color: rgba(18, 22, 32, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.2) inset;
  display: none;
  flex-direction: column;
  z-index: 1050;
  overflow: hidden;
  animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-flyout.show {
  display: flex;
}

.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 15, 22, 0.6);
}

.notif-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-counter-pill {
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.notif-filter-tabs {
  display: flex;
  padding: 6px 12px;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
}

.notif-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--anim-fast);
}

.notif-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.notif-tab-btn.active {
  background: var(--accent-gold-subtle);
  color: var(--accent-gold);
  font-weight: 700;
}

.notif-list {
  padding: 10px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--anim-fast);
  cursor: pointer;
}

.notif-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.notif-card.is-overdue {
  border-left: 3px solid var(--accent-danger);
  background: rgba(244, 63, 94, 0.04);
}

.notif-card.is-today {
  border-left: 3px solid var(--accent-gold);
  background: rgba(212, 175, 55, 0.04);
}

.notif-card.is-soon {
  border-left: 3px solid var(--accent-blue);
}

.notif-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-type-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-overdue {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.badge-today {
  background: rgba(212, 175, 55, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.badge-tomorrow, .badge-soon {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-week {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.notif-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
}

.notif-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.notif-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.notif-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 12, 18, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN APP VIEWPORT CONTAINER
   ========================================================================== */

.app-main {
  flex: 1;
  padding: 8px 12px;
  max-width: 100%;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ==========================================================================
   STAT CARDS (KPI COUNTERS) - GLASS & AMBIENT GLOW (UI/UX PRO MAX)
   ========================================================================== */

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--anim-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
}

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

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--anim-fast);
  border: 1px solid transparent;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #e5be48, #d4af37);
  color: #0b0d13;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #eed065, #e5be48);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45);
  transform: translateY(-1px);
}

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

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger {
  background: var(--accent-danger-subtle);
  border-color: var(--accent-danger-border);
  color: var(--accent-danger);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.25);
}

.btn-zalo {
  background: #0068ff;
  border-color: #0068ff;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 104, 255, 0.35);
}

.btn-zalo:hover {
  background: #0053cc;
  border-color: #0053cc;
  box-shadow: 0 4px 16px rgba(0, 104, 255, 0.5);
  transform: translateY(-1px);
}

.zalo-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 104, 255, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(0, 104, 255, 0.3);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--anim-fast);
}

.zalo-pill-btn:hover {
  background: #0068ff;
  color: #ffffff;
  border-color: #0068ff;
  box-shadow: 0 0 10px rgba(0, 104, 255, 0.4);
  transform: scale(1.05);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 11.5px;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   FORM INPUTS & SELECTS
   ========================================================================== */

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color var(--anim-fast), box-shadow var(--anim-fast);
}

.form-control:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-row .form-group {
  flex: 1;
}

/* ==========================================================================
   MODAL COMPONENT
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(6, 8, 12, 0.78);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 540px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  z-index: 2001;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: var(--radius-xs);
  transition: color var(--anim-fast);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: rgba(10, 12, 18, 0.4);
}

/* ==========================================================================
   TOAST NOTIFICATION COMPONENT
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 440px;
  background-color: rgba(18, 23, 34, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2) inset;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  border-left: 4px solid var(--accent-emerald);
}

.toast.toast-error {
  border-left: 4px solid var(--accent-danger);
}

.toast.toast-warning {
  border-left: 4px solid var(--accent-orange);
}

.toast.toast-info {
  border-left: 4px solid var(--accent-blue);
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */

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

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ==========================================================================
   MOBILE & RESPONSIVE PRO MAX OPTIMIZATIONS
   ========================================================================== */

@media (max-width: 1024px) {
  .app-header { padding: 0 14px; }
  .app-main { padding: 12px; }
}

@media (max-width: 768px) {
  /* 1. App Header 2-row layout */
  .app-header {
    height: auto !important;
    min-height: auto !important;
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
  }

  .header-brand {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .header-actions {
    gap: 8px !important;
  }

  .main-nav {
    width: 100% !important;
    display: flex !important;
    overflow-x: auto !important;
    gap: 4px !important;
    padding-bottom: 2px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }

  .main-nav .nav-tab-btn {
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .main-nav .nav-tab-btn span.tab-label {
    display: inline !important;
    font-size: 11.5px !important;
  }

  /* 2. Main viewport */
  .app-main {
    padding: 8px !important;
    height: calc(100vh - 100px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  /* 3. Projects View Layout on Mobile */
  .projects-layout-container {
    flex-direction: column !important;
    gap: 8px !important;
    height: 100% !important;
  }

  .projects-sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    max-height: 130px !important;
    flex-shrink: 0 !important;
  }

  .project-viewport {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .project-viewport-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .view-mode-toggle {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
  }

  .view-mode-btn {
    flex: 1 !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 6px 8px !important;
  }

  /* 4. Stats and KPI Grid */
  .stats-grid, .overview-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 10px !important;
  }

  .stat-val {
    font-size: 20px !important;
  }

  /* 5. Filter Toolbar */
  .filter-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .filter-toolbar select, .filter-toolbar input {
    width: 100% !important;
  }

  /* 6. Modals & Notifications on Mobile */
  .modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 8px auto !important;
    max-height: 90vh !important;
  }

  .modal-body {
    padding: 14px 12px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .notif-flyout {
    position: fixed !important;
    top: 50px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: 75vh !important;
    z-index: 2000 !important;
  }

  /* 7. Sheet / Table Mobile Touch Scroll */
  .sheet-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .sheet-table th, .sheet-table td {
    padding: 7px 8px !important;
    font-size: 11px !important;
  }
}

/* ==========================================================================
   APP LINKS & ECOSYSTEM CARDS
   ========================================================================== */

.app-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.app-link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all var(--anim-fast);
  position: relative;
  overflow: hidden;
}

.app-link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-gold), transparent);
  opacity: 0.8;
}

.app-link-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(212, 175, 55, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.app-link-tag-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.app-link-tag-active {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.app-link-tag-dev {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.3);
}

.app-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-medium);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--anim-fast);
  cursor: pointer;
}

.app-link-btn:hover {
  background: var(--accent-gold-subtle);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}
