@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ══════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════ */
:root {
    /* Light Theme */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --secondary: #ffffff;
    --accent: #10B981;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --bg-main: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hero-start: #EFF6FF;
    --bg-hero-end: #DBEAFE;
    --border-light: #CBD5E1;
    --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.07), 0 1px 2px -1px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-bg: rgba(255,255,255,0.95);
    --sidebar-bg: #FFFFFF;
    --input-bg: #F8FAFC;
}

[data-theme="dark"] {
    --primary: #3B82F6;
    --primary-hover: #60A5FA;
    --secondary: #0F172A;
    --accent: #10B981;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --bg-main: #0B1120;
    --bg-card: #1E293B;
    --bg-hero-start: #0B1120;
    --bg-hero-end: #1E293B;
    --border-light: #334155;
    --nav-bg: rgba(11,17,32,0.92);
    --sidebar-bg: #111827;
    --input-bg: #0F172A;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════
   BASE RESET
══════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main { flex-grow: 1; }

/* ══════════════════════════════════════
   NAVBAR
══════════════════════════════════════ */
.navbar {
    background-color: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    gap: 0.5rem;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-links a:hover { color: var(--primary); background: rgba(37,99,235,0.08); }

#theme-toggle {
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: 0.75rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}
#theme-toggle:hover { color: var(--primary); transform: scale(1.1) rotate(15deg); background: rgba(59,130,246,0.2); }

/* Theme-specific Logo Visibility */
[data-theme="dark"] .logo-light-theme { display: block !important; }
[data-theme="dark"] .logo-dark-theme  { display: none  !important; }
[data-theme="light"] .logo-light-theme { display: none  !important; }
[data-theme="light"] .logo-dark-theme  { display: block !important; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    gap: 0.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}
.btn-lg { padding: 1rem 2.5rem; font-size: 1.125rem; }
.btn-primary { background-color: var(--primary); color: white !important; box-shadow: 0 4px 14px 0 rgba(37,99,235,0.35); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,99,235,0.4); }
.btn-accent { background-color: var(--accent); color: white !important; }
.btn-accent:hover { background-color: #059669; transform: translateY(-2px); }
.btn-outline { background-color: transparent; color: var(--text-main); border: 1.5px solid var(--border-light); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary) !important; }
.btn-back-tool {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}
.btn-back-tool:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

/* ══════════════════════════════════════
   ALERTS
══════════════════════════════════════ */
.alert {
    padding: 1rem 1.5rem;
    margin: 1rem auto;
    max-width: 1200px;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.5s ease;
}
.alert-success { background-color: rgba(16,185,129,0.12); color: #059669; border: 1px solid rgba(16,185,129,0.25); }
[data-theme="dark"] .alert-success { color: #34D399; }
.alert-error { background-color: rgba(239,68,68,0.1); color: #DC2626; border: 1px solid rgba(239,68,68,0.2); }
[data-theme="dark"] .alert-error { color: #F87171; }

/* ══════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════ */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeInUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeInDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }

.animate-fade-up { animation: fadeInUp 0.8s cubic-bezier(0.16,1,0.3,1) forwards; }

/* ══════════════════════════════════════
   HERO
══════════════════════════════════════ */
.hero {
    padding: 4rem 2rem 3rem;
    background: linear-gradient(135deg, var(--bg-hero-start) 0%, var(--bg-hero-end) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-container {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 4rem;
    z-index: 10;
}
.hero-text {
    flex: 1.2;
    text-align: left;
}
.hero-text h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}
.hero-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2rem;
    line-height: 1.6;
}
.hero-form-wrapper {
    flex: 0.8;
    background: var(--bg-card);
    padding: 1.75rem 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}
.hero-form-wrapper .form-group {
    margin-bottom: 0.75rem;
}
.hero-form-wrapper h2 {
    font-size: 1.35rem !important;
}

@media (max-width: 1024px) {
    .hero { padding: 4rem 1.5rem; }
    .hero-container { flex-direction: column; text-align: center; gap: 3rem; }
    .hero-text { text-align: center; }
    .hero-text h1 { font-size: 2.5rem; }
    .hero-text p { margin-left: auto; margin-right: auto; }
}

/* ══════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════ */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - 68px);
    background-color: var(--bg-main);
}

/* ── Sidebar ── */
.sidebar {
    width: 270px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-light);
    height: calc(100vh - 68px);
    position: sticky;
    top: 68px;
    padding: 1.5rem 0.5rem 0;
    display: flex;
    flex-direction: column;
    z-index: 900;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed { width: 70px; padding: 1.5rem 0.5rem; }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 0.875rem; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 1.5rem 0.5rem; }
.sidebar.collapsed .sidebar-user a { display: none; }

/* Mobile Slide-In Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 899;
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    padding: 2.5rem;
    min-width: 0;
    overflow-x: hidden;
}

/* ── Sidebar Sub-elements ── */
.sidebar-header { margin-bottom: 1.5rem; padding: 0 1.25rem; }
.sidebar-title {
    font-size: 0.68rem; text-transform: uppercase; font-weight: 800;
    color: var(--text-muted); letter-spacing: 1.5px; opacity: 0.6;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.75rem 1.5rem;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.15); border-radius: 10px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); }

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin-bottom: 0.25rem; }

.nav-label {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
    font-size: 0.62rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    opacity: 0.5;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.sidebar-nav a i { font-size: 1.1rem; width: 22px; text-align: center; color: var(--text-muted); transition: inherit; }
.sidebar-nav a:hover { background: rgba(37,99,235,0.08); color: var(--primary); transform: translateX(3px); }
.sidebar-nav a:hover i { color: var(--primary); }

.sidebar-nav a.active { background: rgba(37,99,235,0.12); color: var(--primary) !important; }
.sidebar-nav a.active::before {
    content: '';
    position: absolute; left: 0; top: 20%; height: 60%; width: 3px;
    background-color: var(--primary); border-radius: 0 4px 4px 0;
}
.sidebar-nav a.active i { color: var(--primary) !important; }

/* Submenu */
.sidebar-nav .submenu { display: none; padding-left: 2.25rem; margin-top: 0.15rem; list-style: none; }
.sidebar-nav .submenu.open { display: block; animation: fadeInDown 0.25s ease; }
.sidebar-nav .submenu a { padding: 0.45rem 1rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.sidebar-nav .submenu a:hover { color: var(--primary); background: transparent; transform: translateX(2px); }
.sidebar-nav .submenu a.active { color: var(--primary) !important; font-weight: 700; background: transparent; }
.sidebar-nav .submenu a.active::before { display: none; }
.sidebar-nav a.active-parent { background: rgba(37,99,235,0.05); }
.submenu-icon { transition: transform 0.3s ease; }
.sidebar-nav .has-submenu.open > a .submenu-icon { transform: rotate(180deg); }

.sidebar-nav a.disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }
.sidebar-nav a.disabled:hover { background: transparent; color: var(--text-main); transform: none; }

/* User Profile */
.sidebar-user {
    margin-top: auto;
    padding: 1.25rem 0.75rem 0.75rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.user-avatar {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #1D4ED8 100%);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
    box-shadow: 0 4px 10px rgba(37,99,235,0.25);
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-weight: 700; font-size: 0.9rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.72rem; color: var(--text-muted); }

/* ══════════════════════════════════════
   DASHBOARD STAT CARDS
══════════════════════════════════════ */
.dashboard-heading { margin-bottom: 2.5rem; animation: fadeInUp 0.5s ease; }
.dashboard-heading h1 { font-size: 2.25rem; font-weight: 800; color: var(--text-main); letter-spacing: -1px; margin-bottom: 0.25rem; }
.dashboard-heading p { color: var(--text-muted); font-size: 1.05rem; }
.dashboard-heading .date-badge {
    display: inline-block; background: rgba(37,99,235,0.1); color: var(--primary);
    padding: 0.35rem 1rem; border-radius: 20px; font-size: 0.85rem; font-weight: 700;
    margin-bottom: 1rem; border: 1px solid rgba(37,99,235,0.2);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease backwards;
}
.stat-grid .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(37,99,235,0.25); }

.stat-icon-wrapper { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon-primary  { background: rgba(37,99,235,0.12);  color: #3B82F6; border: 1px solid rgba(59,130,246,0.2); }
.stat-icon-accent   { background: rgba(16,185,129,0.12); color: #10B981; border: 1px solid rgba(16,185,129,0.2); }
.stat-icon-purple   { background: rgba(139,92,246,0.12); color: #8B5CF6; border: 1px solid rgba(139,92,246,0.2); }
.stat-icon-amber    { background: rgba(245,158,11,0.12); color: #F59E0B; border: 1px solid rgba(245,158,11,0.2); }
.stat-details { flex: 1; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-main); line-height: 1.2; margin-bottom: 0.2rem; }
.stat-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ══════════════════════════════════════
   DASHBOARD SECTIONS
══════════════════════════════════════ */
.dashboard-section { margin-bottom: 3rem; }
.dashboard-section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 0.875rem; border-bottom: 2px solid var(--border-light);
}
.dashboard-section-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }

/* Quick Action Grid */
.quick-action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.65rem; background: var(--bg-card); border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md); padding: 1.25rem 1rem; text-decoration: none;
    color: var(--text-main); font-weight: 600; transition: var(--transition); text-align: center; font-size: 0.88rem;
}
.quick-action-btn i { font-size: 1.6rem; color: var(--primary); transition: var(--transition); }
.quick-action-btn:hover { background: rgba(37,99,235,0.07); border-color: rgba(37,99,235,0.35); color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.quick-action-btn.disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(1); }
.quick-action-btn.disabled:hover { transform: none; background: var(--bg-card); border-color: var(--border-light); color: var(--text-main); }

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.activity-table { width: 100%; border-collapse: collapse; text-align: left; }
.activity-table th {
    background: var(--bg-main);
    padding: 0.875rem 1.25rem;
    font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 1px; border-bottom: 2px solid var(--border-light);
}
.activity-table td {
    padding: 0.875rem 1.25rem; font-size: 0.92rem;
    color: var(--text-main); border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
.activity-table tr:last-child td { border-bottom: none; }
.activity-table tr:hover td { background: rgba(37,99,235,0.04); }
[data-theme="dark"] .activity-table tr:hover td { background: rgba(59,130,246,0.06); }

.activity-status { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.status-success { background: rgba(16,185,129,0.12); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
[data-theme="dark"] .status-success { color: #34D399; }
.status-info { background: rgba(37,99,235,0.12); color: #2563EB; border: 1px solid rgba(59,130,246,0.2); }
[data-theme="dark"] .status-info { color: #60A5FA; }

/* ══════════════════════════════════════
   HERO (DASHBOARD) SECTION
══════════════════════════════════════ */
.main-content .hero { padding: 4rem 2rem; border-radius: var(--radius-lg); margin-bottom: 2rem; }
.main-content .hero::after { display: none; }

/* ══════════════════════════════════════
   TOOL CARDS (Dashboard Grid)
══════════════════════════════════════ */
.tools-section { max-width: 1400px; margin: 0 auto; padding: 5rem 2rem; position: relative; z-index: 10; }
.section-title { text-align: center; font-size: 2.25rem; font-weight: 800; margin-bottom: 0.75rem; color: var(--text-main); letter-spacing: -0.5px; }
.section-subtitle { text-align: center; color: var(--text-muted); font-size: 1.1rem; margin-bottom: 3.5rem; }

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

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1.5px solid var(--border-light);
    text-align: center;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    opacity:0; transform: translateY(20px);
    animation: fadeInUp 0.6s cubic-bezier(0.16,1,0.3,1) forwards;
}
.grid > a:nth-child(1) { animation-delay: 0.05s; }
.grid > a:nth-child(2) { animation-delay: 0.1s; }
.grid > a:nth-child(3) { animation-delay: 0.15s; }
.grid > a:nth-child(4) { animation-delay: 0.2s; }
.grid > a:nth-child(5) { animation-delay: 0.25s; }
.grid > a:nth-child(6) { animation-delay: 0.3s; }
.grid > a:nth-child(7) { animation-delay: 0.35s; }
.grid > a:nth-child(8) { animation-delay: 0.4s; }

.tool-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    transform: scaleX(0); transition: transform 0.4s cubic-bezier(0.4,0,0.2,1); transform-origin: left;
}
.tool-card:hover::before { transform: scaleX(1); }
.tool-card:hover { transform: translateY(-6px) !important; box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,0.3); }

.tool-icon {
    font-size: 2rem; color: var(--primary); margin-bottom: 1.25rem;
    background: rgba(59,130,246,0.1); width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px; transition: var(--transition);
}
.tool-card:hover .tool-icon { background: var(--primary); color: white; transform: scale(1.1) rotate(5deg); }
.tool-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-main); }
.tool-card p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* ══════════════════════════════════════
   AUTH & TOOL APP PAGES
══════════════════════════════════════ */
.auth-container, .tool-app-container {
    min-height: calc(100vh - 68px);
    display: flex; align-items: center; justify-content: center;
    padding: 4rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-hero-start) 0%, var(--bg-hero-end) 100%);
}
.tool-app-container { align-items: flex-start; }
.main-content .tool-app-container { background: transparent; padding: 1rem 0; min-height: auto; align-items: center; }

.auth-card, .tool-app-card {
    background: var(--bg-card);
    padding: 2.5rem; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
    border: 1.5px solid var(--border-light);
    animation: fadeInUp 0.6s cubic-bezier(0.16,1,0.3,1) forwards;
}
.tool-app-card { max-width: 800px; }
.auth-header h1 { font-size: 1.75rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.5rem; text-align: center; }
.auth-header p { color: var(--text-muted); text-align: center; margin-bottom: 2rem; }

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.45rem; font-weight: 600; color: var(--text-main); font-size: 0.88rem; }
.form-control {
    width: 100%; padding: 0.75rem 1rem;
    background-color: var(--input-bg) !important;
    color: var(--text-main) !important;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: inherit; font-size: 0.95rem;
    transition: var(--transition);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    background-color: var(--bg-card) !important;
}

.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* Signup 2-col grid */
.auth-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.auth-form-grid .form-group { margin-bottom: 0; }
.auth-form-grid .form-group label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 0.3rem; }

/* Password Toggle */
.password-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.password-wrapper .form-control { padding-right: 3rem !important; }
.toggle-password { position: absolute; right: 1rem; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 0.25rem; display: flex; align-items: center; transition: var(--transition); z-index: 10; }
.toggle-password:hover { color: var(--primary); }

/* ══════════════════════════════════════
   TOOL RESULT / UPSELL
══════════════════════════════════════ */
.tool-result { margin-top: 2rem; padding: 1.5rem; background: var(--bg-main); border: 1.5px solid var(--border-light); border-radius: var(--radius-md); display: none; }
.tool-result.active { display: block; animation: fadeInUp 0.4s ease forwards; }
.tool-upsell { display: none; margin-top: 2rem; padding: 2.5rem 2rem; background: rgba(37,99,235,0.05); border-radius: var(--radius-md); border: 1px dashed var(--primary); text-align: center; }
.tool-upsell.active { display: block; animation: fadeInUp 0.5s ease forwards; }

/* ══════════════════════════════════════
   CTA SECTION
══════════════════════════════════════ */
.cta-section {
    background: linear-gradient(135deg, rgba(15,23,42,0.97) 0%, rgba(30,58,138,0.97) 100%);
    color: white; text-align: center; padding: 2rem 2rem;
    margin-top: auto; border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
[data-theme="light"] .cta-section { background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 100%); }
.cta-section h2 { font-size: 2rem; margin-bottom: 0.5rem; font-weight: 800; letter-spacing: -0.5px; background: linear-gradient(to right, #fff, #93c5fd); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cta-section p { font-size: 1rem; opacity: 0.85; margin-bottom: 1.25rem; max-width: 650px; margin-left: auto; margin-right: auto; line-height: 1.6; }

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
footer { background-color: var(--bg-card); color: var(--text-muted); text-align: center; padding: 2rem 1.5rem; font-size: 0.9rem; border-top: 1px solid var(--border-light); }

/* ══════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
══════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 1200;
        transform: translateX(-100%);
        padding-top: 68px;
        box-shadow: 4px 0 30px rgba(0,0,0,0.25);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-overlay.active { display: block; }
    .main-content { padding: 1.5rem 1.25rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .quick-action-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ══════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
══════════════════════════════════════ */
@media (max-width: 768px) {
    /* Navbar */
    .nav-container { padding: 0.75rem 1rem; }
    .nav-links > a:not([id]):not(.btn) { display: none; }
    .brand img { height: 30px !important; }

    /* Dashboard */
    .main-content { padding: 1rem; }
    .dashboard-heading h1 { font-size: 1.6rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.875rem; }
    .stat-value { font-size: 1.4rem; }
    .stat-card { padding: 1.1rem; gap: 0.875rem; }
    .stat-icon-wrapper { width: 44px; height: 44px; font-size: 1.2rem; }

    /* Tool Grid */
    .grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .tool-card { padding: 1.5rem 1rem; }
    .tool-icon { width: 56px; height: 56px; font-size: 1.5rem; border-radius: 14px; }
    .tool-card h3 { font-size: 0.95rem; }
    .tool-card p { font-size: 0.82rem; }

    /* Auth Cards */
    .auth-card { padding: 1.5rem 1rem; margin: 0.5rem; }
    .auth-form-grid { grid-template-columns: 1fr; gap: 0.6rem; }

    /* Tables */
    .activity-table th, .activity-table td { padding: 0.75rem 1rem; font-size: 0.82rem; }

    /* Quick Actions */
    .quick-action-grid { grid-template-columns: repeat(2, 1fr); }

    /* Section Title */
    .section-title { font-size: 1.75rem; }
    .hero .hero p { font-size: 1rem; }

    /* CTA */
    .cta-section h2 { font-size: 1.6rem; }
}

/* ══════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤ 480px)
══════════════════════════════════════ */
@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
    .quick-action-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-heading h1 { font-size: 1.4rem; }
    .nav-container { padding: 0.65rem 0.75rem; }
}

/* ══════════════════════════════════════
   GLOBAL MOBILE FIXES (ADDITIONAL)
══════════════════════════════════════ */

/* ── Dashboard Wrapper on Mobile ── */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
    }
    .dashboard-wrapper .main-content {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    /* ── Dashboard Calendar ── */
    .calendar-grid {
        gap: 2px !important;
    }
    .calendar-day {
        min-height: 32px !important;
        font-size: 0.72rem !important;
        padding: 4px 2px !important;
    }
    .calendar-header-row span {
        font-size: 0.65rem !important;
    }

    /* ── Recent Activity Table ── */
    .activity-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .activity-table {
        min-width: 480px;
    }
    .activity-table td, .activity-table th {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.65rem 0.75rem;
    }

    /* ── Quick Actions ── */
    .quick-action-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    .quick-action-card {
        padding: 1rem 0.75rem;
    }
    .quick-action-icon {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
    }
    .quick-action-card h4 { font-size: 0.82rem; }
    .quick-action-card p { font-size: 0.72rem; display: none; }

    /* ── Stat Cards ── */
    .stat-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* ── Dashboard Section Padding ── */
    .dashboard-section {
        padding: 1rem !important;
    }
    .dashboard-heading {
        padding: 1rem 1rem 0.5rem;
    }

    /* ── Invoice Generator Mobile ── */
    .invoice-container {
        margin: 0.5rem;
        padding: 1.25rem;
        border-radius: 16px;
    }
    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    .totals-box {
        width: 100% !important;
    }
    .totals-section {
        justify-content: stretch !important;
    }
    #print-view .control-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* ── Items Table Mobile — Hide less important cols ── */
    .items-table th:nth-child(4),
    .items-table td:nth-child(4) {
        display: none;
    }

    /* ── Action Buttons Full Width ── */
    .invoice-actions {
        flex-direction: column;
    }
    .invoice-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* ── Print View ── */
    #print-view {
        padding: 10px 5px !important;
    }
    #printable-invoice-container {
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }
}

/* ══════════════════════════════════════
   MOBILE FIXES — VERY SMALL (≤ 400px)
══════════════════════════════════════ */
@media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr !important; }
    .tool-card { padding: 1rem 0.75rem; }
    .tool-card h3 { font-size: 0.85rem; }
}
