/* ═══════════════════════════════════════════════════
   EasyDocs — Design System
   ═══════════════════════════════════════════════════ */

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

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-50: #eef2ff;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Dark Theme (default for app) ─── */
[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-card: #1e293b;
    --bg-card-alt: #1a2540;
    --bg-input: #0f172a;
    --bg-topbar: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-table-th: #162032;
    --bg-table-row: transparent;
    --bg-table-hover: #1a2844;
    --border: #334155;
    --border-light: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #ffffff;
    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ─── Light Theme ─── */
[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-alt: #f1f5f9;
    --bg-input: #ffffff;
    --bg-topbar: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-table-th: #f8fafc;
    --bg-table-row: transparent;
    --bg-table-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-heading: #0f172a;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
}


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

body {
    font-family: 'Inter', 'Noto Sans Thai', -apple-system, sans-serif;
    color: var(--text-primary, var(--gray-800));
    background: var(--bg-base, var(--gray-50));
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.25s ease, color 0.25s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

input,
textarea,
select {
    font-family: inherit;
}

/* ─── Container ─── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-lg {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── Typography ─── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-title {
    text-align: center;
    margin-bottom: 16px;
    font-size: 2.25rem;
    font-weight: 800;
}

.section-subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 1.125rem;
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: var(--transition);
    border: 2px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    border-color: var(--border, var(--gray-300));
    color: var(--text-primary, var(--gray-700));
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary, var(--gray-600));
}

.btn-ghost:hover {
    background: var(--bg-card, var(--gray-100));
    color: var(--text-heading, var(--gray-900));
}

.btn-white {
    background: white;
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow);
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* ─── Navbar ─── */
.navbar {
    padding: 16px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.navbar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.navbar-links a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--gray-400);
}

.navbar-links a:hover {
    color: white;
}

.navbar.scrolled .navbar-links a {
    color: var(--gray-600);
}

.navbar.scrolled .navbar-links a:hover {
    color: var(--primary);
}

.navbar.scrolled .navbar-brand {
    color: var(--gray-900);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ─── Hero ─── */
.hero {
    background: var(--gradient-hero);
    padding: 160px 0 100px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    color: white;
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero p {
    color: var(--gray-300);
    font-size: 1.25rem;
    margin-bottom: 40px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    gap: 48px;
    justify-content: center;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-stat {
    text-align: center;
}

.hero-stat .number {
    color: white;
    font-size: 2rem;
    font-weight: 800;
}

.hero-stat .label {
    color: var(--gray-400);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ─── Sections ─── */
.section {
    padding: 100px 0;
}

.section-alt {
    background: white;
}

/* ─── Feature Cards ─── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-card);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.feature-card p {
    color: var(--gray-500);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ─── How It Works ─── */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.3;
}

.step {
    text-align: center;
    position: relative;
}

.step-number {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 20px;
    position: relative;
    z-index: 1;
}

.step h3 {
    margin-bottom: 8px;
}

.step p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* ─── Pricing Cards ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
}

.pricing-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 36px;
    transition: var(--transition);
    position: relative;
}

.pricing-card.featured {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.pricing-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-primary);
    color: white;
    padding: 4px 20px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pricing-card h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.pricing-price {
    margin: 20px 0;
}

.pricing-price .amount {
    font-size: 2.5rem;
    font-weight: 900;
}

.pricing-price .period {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.pricing-features {
    list-style: none;
    margin: 24px 0;
}

.pricing-features li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.pricing-features li .check {
    color: var(--success);
    font-weight: bold;
}

.pricing-features li .cross {
    color: var(--gray-300);
}

/* ─── FAQ ─── */
.faq-list {
    max-width: 700px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    background: white;
}

.faq-question {
    width: 100%;
    padding: 20px 24px;
    background: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gray-800);
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--gray-50);
}

.faq-answer {
    padding: 0 24px 20px;
    color: var(--gray-500);
    font-size: 0.95rem;
    line-height: 1.7;
    display: none;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-item.active .faq-question .arrow {
    transform: rotate(180deg);
}

.arrow {
    transition: var(--transition);
}

/* ─── Footer ─── */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--gray-400);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: white;
}

.footer-brand p {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-top: 12px;
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 24px;
    text-align: center;
    font-size: 0.85rem;
}

/* ─── CTA Section ─── */
.cta-section {
    background: var(--gradient-hero);
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
}

.cta-section h2 {
    color: white;
    font-size: 2.25rem;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.cta-section p {
    color: var(--gray-300);
    margin-bottom: 32px;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.cta-section .btn {
    position: relative;
    z-index: 1;
}

/* ─── Doc Types Grid ─── */
.doc-types-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.doc-type-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.doc-type-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.doc-type-card .icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.doc-type-card h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.doc-type-card p {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ═══════════════════════════════════════════════════
   App (Authenticated) Styles
   ═══════════════════════════════════════════════════ */

/* ─── App Layout ─── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--gray-900);
    color: white;
    padding: 24px 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid var(--gray-800);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
}

.sidebar-brand .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a:hover {
    background: var(--gray-800);
    color: white;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
}

.sidebar-section {
    padding: 16px 24px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 1px;
    font-weight: 600;
}

/* Sidebar user info area */
[data-theme="dark"] .main-content .topbar-title,
[data-theme="light"] .main-content .topbar-title {
    color: var(--text-heading);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    background: var(--bg-base, var(--gray-50));
}

.topbar {
    background: var(--bg-topbar, white);
    padding: 16px 32px;
    border-bottom: 1px solid var(--border, var(--gray-200));
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 4px 20px -10px rgba(0, 0, 0, 0.05);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading, var(--gray-900));
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-content {
    padding: 32px;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card, white);
    border: 1px solid var(--border, var(--gray-200));
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card, none);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light, var(--gray-100));
}

.card-header h3 {
    font-size: 1.1rem;
}

/* ─── Form Styles ─── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, var(--gray-700));
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border, var(--gray-300));
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-input, white);
    color: var(--text-primary, var(--gray-800));
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Fix browser-native select option colors in dark mode */
[data-theme="dark"] select.form-input option {
    background: #1e293b;
    color: #f1f5f9;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

.item-grid-cols {
    display: grid;
    grid-template-columns: 1fr 100px 1fr 1fr;
    gap: 12px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-table-th, var(--gray-50));
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, var(--gray-500));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border, var(--gray-200));
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light, var(--gray-100));
    font-size: 0.9rem;
    color: var(--text-primary, var(--gray-800));
}

.data-table tr:hover td {
    background: var(--bg-table-hover, var(--gray-50));
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

.badge-final {
    background: #d1fae5;
    color: #065f46;
}

.badge-sent {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-paid {
    background: #fef9c3;
    color: #854d0e;
}

.badge-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary);
}

/* ─── Stats Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card, white);
    border: 1px solid var(--border, var(--gray-200));
    border-radius: var(--radius);
    padding: 20px;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted, var(--gray-500));
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 4px;
    color: var(--text-heading, var(--gray-900));
}

/* ─── Quick Actions ─── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-card, white);
    border: 2px dashed var(--border, var(--gray-200));
    border-radius: var(--radius);
    color: var(--text-secondary, var(--gray-600));
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.quick-action-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.quick-action-card .icon {
    font-size: 1.5rem;
}

/* ─── Alerts ─── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border, var(--gray-200));
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary, var(--gray-600));
    background: var(--bg-card, white);
}

.pagination a:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active span {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ─── Document Preview ─── */
.doc-preview {
    background: var(--bg-card, white);
    border: 1px solid var(--border, var(--gray-200));
    border-radius: var(--radius);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

/* ─── Auth Pages ─── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-hero);
    padding: 24px;
}

.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--gray-400);
    font-size: 0.85rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--gray-500);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* ─── Blog Cards ─── */
.blog-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.blog-card-thumb {
    height: 200px;
    overflow: hidden;
}

.blog-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-thumb img {
    transform: scale(1.05);
}

.blog-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-card-thumb-placeholder span {
    font-size: 3rem;
}

.blog-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-bottom: 10px;
}

.blog-card-dot {
    color: var(--gray-300);
}

.blog-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.blog-card-excerpt {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.7;
    flex: 1;
}

.blog-card-link {
    margin-top: 16px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.blog-card:hover .blog-card-link {
    color: var(--primary-dark);
}

/* ─── Blog Article Content ─── */
.blog-content {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--gray-700);
}

.blog-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-100);
}

.blog-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 28px 0 12px;
}

.blog-content p {
    margin-bottom: 18px;
}

.blog-content ul,
.blog-content ol {
    margin: 12px 0 20px 24px;
    padding: 0;
}

.blog-content li {
    margin-bottom: 8px;
    padding-left: 4px;
    line-height: 1.8;
}

.blog-content strong {
    color: var(--gray-800);
    font-weight: 700;
}

.blog-content a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-content a:hover {
    color: var(--primary-dark);
}

.blog-content code {
    background: var(--gray-100);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.blog-content pre {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 20px 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 20px 0;
    font-size: 0.85rem;
    line-height: 1.7;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.blog-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.blog-content table th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-200);
}

.blog-content table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-600);
}

.blog-content table tr:last-child td {
    border-bottom: none;
}

.blog-content table tr:hover td {
    background: var(--gray-50);
}

.blog-content blockquote {
    border-left: 4px solid var(--primary);
    background: var(--primary-50);
    margin: 24px 0;
    padding: 16px 24px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--gray-600);
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-content img {
    border-radius: var(--radius);
    margin: 24px 0;
    box-shadow: var(--shadow);
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {

    .features-grid,
    .pricing-grid,
    .steps,
    .doc-types-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-card.featured {
        transform: none;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero {
        padding: 120px 0 60px;
    }

    .section {
        padding: 60px 0;
    }

    .navbar-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .features-grid,
    .pricing-grid,
    .steps,
    .doc-types-grid {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

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

    .item-grid-cols {
        grid-template-columns: 1fr 1fr !important;
    }

    .topbar {
        padding: 12px 16px;
    }

    .page-content {
        padding: 16px;
    }
}

/* ═══════════════════════════════════════════════════
   Dark Mode Global Overrides
   Applies only inside .main-content to avoid breaking
   the sidebar which is always dark.
   ═══════════════════════════════════════════════════ */

[data-theme="dark"] .main-content h1,
[data-theme="dark"] .main-content h2,
[data-theme="dark"] .main-content h3,
[data-theme="dark"] .main-content h4,
[data-theme="dark"] .main-content h5,
[data-theme="dark"] .main-content h6 {
    color: var(--text-heading);
}

[data-theme="dark"] .main-content p,
[data-theme="dark"] .main-content li,
[data-theme="dark"] .main-content strong,
[data-theme="dark"] .main-content span:not([class]) {
    color: inherit;
}

[data-theme="dark"] .main-content label:not(.form-label) {
    color: var(--text-secondary);
}

/* Any element that has style="color: var(--gray-800)" etc. */
[data-theme="dark"] .page-content {
    color: var(--text-primary);
}

/* Override hardcoded note/hint text in pages */
[data-theme="dark"] .main-content [style*="color: #64748b"],
[data-theme="dark"] .main-content [style*="color: #475569"],
[data-theme="dark"] .main-content [style*="color: #334155"],
[data-theme="dark"] .main-content [style*="color: #1e293b"],
[data-theme="dark"] .main-content [style*="color: #0f172a"] {
    color: var(--text-secondary) !important;
}

/* Headings/titles with hardcoded dark grays */
[data-theme="dark"] .main-content [style*="font-weight: 700"],
[data-theme="dark"] .main-content [style*="font-weight: 800"],
[data-theme="dark"] .main-content [style*="font-weight: 600"] {
    color: var(--text-primary);
}

/* Override cards/boxes with hardcoded backgrounds */
[data-theme="dark"] .main-content [style*="background: white"],
[data-theme="dark"] .main-content [style*="background: #fff"],
[data-theme="dark"] .main-content [style*="background: #f8fafc"],
[data-theme="dark"] .main-content [style*="background: #f1f5f9"] {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* Filter/search bars & inline form wrappers */
[data-theme="dark"] .main-content [style*="background: var(--gray-50)"],
[data-theme="dark"] .main-content [style*="background: var(--gray-100)"] {
    background: var(--bg-card-alt) !important;
}

/* Heroicons SVG Sizing Utilities */
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.inline-block { display: inline-block; vertical-align: text-bottom; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-yellow-500 { color: #eab308; }
.text-yellow-600 { color: #ca8a04; }