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

/* ==========================================================================
   THUTIL DESIGN SYSTEM - THAI E-FILING GREEN & FORMAL FINTECH THEME
   Inspired by Thai Revenue Dept (E-Filing) & Modern Public Utilities
   Zero Animation for Maximum Speed & Gen Y Usability
   Font: TH Sarabun (Official Thai National & Government Standard)
   ========================================================================== */
:root {
    /* Primary Thai E-Filing Green Palette */
    --green-primary: #16a34a;
    --green-hover: #15803d;
    --green-active: #166534;
    --green-tint: #f0fdf4;
    --green-tint-border: #bbf7d0;
    --green-badge: #dcfce7;
    --green-badge-text: #15803d;

    /* Light Theme (Default - Formal Government / Civil Service Style) */
    --bg-app: #f4f6f8;
    --bg-surface: #ffffff;
    --bg-surface-solid: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --bg-subtle: #f0fdf4;
    --bg-hover: #e2e8f0;
    --bg-input: #ffffff;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-hover: #cbd5e1;
    --border-focus: #16a34a;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --accent: #16a34a;
    --accent-hover: #15803d;
    --accent-success: #16a34a;
    --accent-danger: #dc2626;

    --badge-bg: #dcfce7;
    --badge-border: #bbf7d0;
    --badge-text: #15803d;

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    --sidebar-width: 280px;
    --header-height: 60px;
    --bottom-nav-height: 60px;
}

[data-theme="dark"] {
    --green-primary: #22c55e;
    --green-hover: #16a34a;
    --green-active: #15803d;
    --green-tint: rgba(34, 197, 94, 0.08);
    --green-tint-border: rgba(34, 197, 94, 0.25);
    --green-badge: rgba(34, 197, 94, 0.15);
    --green-badge-text: #4ade80;

    --bg-app: #0a0f18;
    --bg-surface: #101726;
    --bg-surface-solid: #101726;
    --bg-card: #131d2e;
    --bg-card-hover: #182438;
    --bg-subtle: #172436;
    --bg-hover: #1f2e45;
    --bg-input: #0c121e;

    --border-color: #1e2c42;
    --border-subtle: #162234;
    --border-hover: #334563;
    --border-focus: #22c55e;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-success: #22c55e;
    --accent-danger: #ef4444;

    --badge-bg: rgba(34, 197, 94, 0.12);
    --badge-border: rgba(34, 197, 94, 0.25);
    --badge-text: #4ade80;
}

/* ==========================================================================
   BASE & RESET (STRICT ZERO ANIMATION, NATURAL DOCUMENT SCROLL)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    animation: none !important;
    transition: none !important;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: 'Sarabun', 'TH Sarabun New', 'TH Sarabun PSK', Tahoma, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16.5px;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto; /* Natural full page scroll */
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

/* ==========================================================================
   APP HEADER (E-FILING CLEAN WHITE WITH GREEN ACCENTS)
   ========================================================================== */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    justify-self: start;
}

.sidebar-toggle-btn {
    display: inline-flex;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--green-tint);
    border-color: var(--green-primary);
    color: var(--green-primary);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1.25rem;
}

.header-nav .nav-link {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    text-decoration: none;
}

.header-nav .nav-link:hover {
    color: var(--green-primary);
    background: var(--green-tint);
}

.header-nav .nav-link.active {
    color: var(--green-primary);
    font-weight: 700;
    background: var(--green-tint);
}

.logo-badge {
    background: var(--green-primary);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
}

.tag-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--badge-border);
    color: var(--badge-text);
    background: var(--badge-bg);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    word-break: keep-all !important;
    line-height: 1.4;
}

.tag-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green-primary);
}

.header-center {
    justify-self: center;
    width: 440px;
    max-width: 100%;
    margin: 0;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem 0.5rem 2.35rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.search-box svg {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-shortcut {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-self: end;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
}

.btn-terms {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.btn-terms:hover, .btn-terms.active {
    color: var(--green-primary);
    border-color: var(--green-primary);
    background: var(--green-tint);
}

/* ==========================================================================
   APP CONTAINER & SIDEBAR (COLLAPSIBLE & EXPANDABLE)
   ========================================================================== */
.app-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-height));
    position: relative;
    background: var(--bg-app);
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 30;
}

/* Collapsed Desktop Sidebar (Full Workspace Expansion) */
body.sidebar-collapsed .app-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
    visibility: hidden;
    pointer-events: none;
}

/* Wide / Expanded Desktop Sidebar */
body.sidebar-wide .app-sidebar {
    width: 360px;
}

.sidebar-section {
    padding: 0.85rem 0.75rem 0.4rem;
}

.sidebar-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem 0.45rem;
}

.tool-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tool-nav-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.525rem 0.75rem;
    border-radius: var(--radius-xs);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}

.tool-nav-item a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tool-nav-item.active a {
    color: var(--green-primary);
    background: var(--green-tint);
    border-left-color: var(--green-primary);
    font-weight: 600;
}

.tool-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.6rem;
    color: var(--text-muted);
}

.tool-nav-item.active .tool-nav-icon {
    color: var(--green-primary);
}

.tool-nav-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    word-break: keep-all !important;
}

.tool-nav-item.active .tool-nav-badge {
    background: var(--green-badge);
    border-color: var(--green-tint-border);
    color: var(--green-badge-text);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

/* ==========================================================================
   APP CONTENT (WORKSPACE - CLEAN, VERTICAL FLOW, SPACIOUS)
   ========================================================================== */
.app-content {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 2rem 2.5rem 4rem;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
}

.workspace-header {
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.35rem;
}

.workspace-category {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--green-primary);
    background: var(--green-tint);
    border: 1px solid var(--green-tint-border);
    border-radius: var(--radius-xs);
    padding: 0.25rem 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    word-break: keep-all !important;
}

.workspace-title {
    font-size: 1.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.workspace-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 860px;
    line-height: 1.65;
}

/* ==========================================================================
   CATEGORY CHIPS & TAB BARS (E-FILING GREEN SEGMENTED CONTROL)
   ========================================================================== */
.category-chips-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tab-bar, .segmented-control {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    background: rgba(15, 23, 42, 0.05);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    gap: 6px;
    margin-bottom: 1.5rem;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

[data-theme="dark"] .tab-bar, 
[data-theme="dark"] .segmented-control {
    background: #1e293b;
    border-color: #334155;
}

.tab-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: none !important;
    outline: none !important;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: inherit;
    user-select: none;
    line-height: 1.4;
}

.tab-btn:hover {
    color: var(--green-primary);
    background: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
    background: var(--green-primary) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

.tab-btn svg {
    flex-shrink: 0;
}

.chip-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1.15rem;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
    font-family: inherit;
    user-select: none;
    line-height: 1.4;
}

.chip-btn:hover {
    background: var(--green-tint);
    border-color: var(--green-primary);
    color: var(--green-primary);
}

.chip-btn.active {
    background: var(--green-primary) !important;
    color: #ffffff !important;
    border-color: var(--green-primary) !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

/* ==========================================================================
   PANEL CARDS & FORM CONTROLS
   ========================================================================== */
.tool-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.75rem;
}

.tool-grid-2 > * {
    min-width: 0;
}

.tool-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.tool-grid-1 > * {
    min-width: 0;
}

/* ==========================================================================
   E-FILING HERO & SPOTLIGHT (CIVIL SERVICE / FINTECH FINISH)
   ========================================================================== */
.efiling-hero {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.25rem 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.efiling-hero-title {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

.efiling-hero-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 820px;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.efiling-hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.efiling-hero-meta {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 1.15rem;
    border-top: 1px solid var(--border-subtle);
}

.efiling-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Spotlight Cards (RD Prep & RD Payroll Reference Style) */
.spotlight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.spotlight-grid > * {
    min-width: 0;
}

.spotlight-card {
    background: var(--green-tint);
    border: 1.5px solid var(--green-tint-border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.spotlight-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.35;
}

.spotlight-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.spotlight-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Recommended Services Section Ribbon */
.service-section-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.service-section-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.service-section-ribbon {
    flex: 1;
    height: 10px;
    background: var(--green-tint);
    border: 1px solid var(--green-tint-border);
    border-radius: var(--radius-xs);
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    min-height: 42px;
    padding: 0.6rem 0.85rem;
    font-size: 0.925rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.form-control:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

/* Buttons (E-FILING Inspired) */
.btn-primary {
    background: var(--green-primary);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    padding: 0.6rem 1.35rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--green-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--green-hover);
    border-color: var(--green-hover);
    color: #ffffff;
}

.btn-outline {
    background: var(--bg-surface);
    color: var(--green-primary);
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    padding: 0.6rem 1.35rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--green-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-decoration: none;
}

.btn-outline:hover {
    background: var(--green-tint);
    border-color: var(--green-hover);
    color: var(--green-hover);
}

.btn-lg {
    font-size: 0.975rem;
    padding: 0.75rem 1.5rem;
    min-height: 46px;
    font-weight: 700;
}

.btn-copy {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-copy:hover {
    background: var(--green-tint);
    border-color: var(--green-primary);
    color: var(--green-primary);
}

/* Formal Result Box (Statement Style with E-Filing Green) */
.result-box {
    background: var(--green-tint);
    border: 1.5px solid var(--green-tint-border);
    border-radius: var(--radius-sm);
    padding: 1.35rem;
    margin-bottom: 1.25rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.result-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--green-badge-text);
}

.result-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green-primary);
    word-break: break-all;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-top: 1rem;
}

.stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 0.85rem 1rem;
}

.stat-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Tables (Official Thai E-Filing Style) */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--green-tint);
    color: var(--green-badge-text);
    font-weight: 700;
    border-bottom: 2px solid var(--green-tint-border);
    padding: 0.65rem 0.75rem;
    text-align: left;
}

tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

/* ==========================================================================
   OVERVIEW DIRECTORY CARDS (RECOMMENDED SERVICES GRID)
   ========================================================================== */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.25rem;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.35rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.overview-card:hover {
    border-color: var(--green-primary);
    background: var(--bg-card-hover);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.08);
}

.overview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.overview-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--green-tint);
    border: 1px solid var(--green-tint-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green-primary);
}

.overview-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.overview-card-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1.15rem;
}

.overview-card-footer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--green-primary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   MOBILE NAVIGATION
   ========================================================================== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
}

.sidebar-backdrop.active {
    display: block;
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 40;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    flex: 1;
    height: 100%;
    cursor: pointer;
    background: none;
    border: none;
}

.mobile-nav-item.active {
    color: var(--green-primary);
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */
@media (max-width: 1080px) {
    .header-nav {
        display: none;
    }
    .tool-grid-2, .spotlight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .app-header {
        display: flex;
        justify-content: space-between;
    }
    .app-sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        width: 300px;
        z-index: 50;
        display: none;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
    }
    .app-sidebar.open {
        display: flex;
    }
    .sidebar-toggle-btn {
        display: flex;
    }
    .header-center {
        display: none;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .app-content {
        padding: 1.25rem 1rem calc(var(--bottom-nav-height) + 1.5rem);
    }
    .efiling-hero {
        padding: 1.5rem 1.25rem;
    }
    .efiling-hero-title {
        font-size: 1.55rem;
    }
    .workspace-title {
        font-size: 1.55rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   FOCUS / PRESENTER MODE (FULLSCREEN STAGE FOR PRESENTATION / LUCKY DRAW)
   ========================================================================== */
.focus-presenter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.focus-presenter-header {
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.focus-presenter-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    max-width: 1050px;
    margin: 0 auto;
    width: 100%;
    text-align: center;
}

.focus-hero-display {
    background: var(--green-tint);
    border: 2.5px solid var(--green-tint-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    width: 100%;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.08);
}

.focus-hero-label {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--green-badge-text);
    margin-bottom: 0.75rem;
}

.focus-hero-number {
    font-size: clamp(3.5rem, 8vw, 7.5rem);
    font-weight: 800;
    color: var(--green-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
    min-height: 1.25em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.focus-hero-meta {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.focus-action-bar {
    margin-bottom: 2rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-focus-trigger {
    font-size: 1.35rem;
    font-weight: 700;
    padding: 1rem 3.5rem;
    min-height: 60px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
    cursor: pointer;
}

.focus-bottom-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
}

.focus-quick-config {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.75rem;
}

.focus-history-strip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow-x: auto;
}

.focus-history-items {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.focus-history-pill {
    background: var(--green-tint);
    border: 1px solid var(--green-tint-border);
    color: var(--green-badge-text);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 700;
}

/* ==========================================================================
   GAMIFIED RANDOMIZER (LUCKY WHEEL, SLOT MACHINE & FIREWORKS)
   ========================================================================== */
.celebration-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
    display: none;
}

.wheel-card {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #ffffff;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.25rem 0 1rem;
    width: 100%;
}

.wheel-pointer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 52px;
    z-index: 25;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
    pointer-events: none;
    transform-origin: 50% 15%;
}

.wheel-pointer.tick {
    transform: translateX(-50%) rotate(-14deg);
}

.wheel-canvas {
    border-radius: 50%;
    box-shadow: 0 0 0 8px #f59e0b, 0 0 0 14px #b45309, 0 12px 36px rgba(0,0,0,0.6);
    background: #0f172a;
    display: block;
    cursor: grab;
}

.wheel-canvas:active {
    cursor: grabbing;
}

.wheel-center-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fde047 0%, #f59e0b 50%, #b45309 100%);
    border: 4px solid #ffffff;
    color: #78350f;
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    user-select: none;
    z-index: 20;
    letter-spacing: -0.02em;
}

.wheel-center-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.wheel-center-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.btn-wheel-spin {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border: 2px solid #fde68a;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 800;
    padding: 0.85rem 2.25rem;
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
}

.btn-wheel-spin:hover {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
}

/* Slot Machine Styles */
.slot-machine-card {
    background: radial-gradient(circle at center, #1e1b4b 0%, #0f0b1f 100%);
    border: 2px solid #6366f1;
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    color: #ffffff;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.slot-frame {
    background: #030014;
    border: 4px solid #f59e0b;
    box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 25px rgba(245, 158, 11, 0.3);
    border-radius: 18px;
    padding: 1.25rem;
    display: flex;
    justify-content: center;
    gap: 0.85rem;
    margin: 1.5rem auto;
    max-width: 580px;
    overflow: hidden;
}

.slot-reel {
    flex: 1;
    height: 125px;
    background: linear-gradient(180deg, #18181b 0%, #27272a 50%, #18181b 100%);
    border: 2px solid #52525b;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.8rem, 3.5vw, 2.75rem);
    font-weight: 900;
    color: #facc15;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.8);
    text-shadow: 0 2px 12px rgba(250, 204, 21, 0.6);
    overflow: hidden;
    user-select: none;
    padding: 0 0.5rem;
    word-break: break-word;
}

.btn-slot-pull {
    background: linear-gradient(180deg, #ec4899 0%, #be185d 100%);
    color: #ffffff;
    border: 2px solid #fbcfe8;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-weight: 800;
    padding: 0.9rem 2.5rem;
    box-shadow: 0 6px 20px rgba(190, 24, 93, 0.4);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.btn-slot-pull:hover {
    background: linear-gradient(180deg, #f472b6 0%, #db2777 100%);
}

/* Winner Celebration Modal */
.winner-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.winner-popup-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 3px solid #fbbf24;
    box-shadow: 0 0 60px rgba(251, 191, 36, 0.5), 0 20px 45px rgba(0,0,0,0.8);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    max-width: 520px;
    width: 100%;
    text-align: center;
    color: #ffffff;
    position: relative;
    animation: winnerPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes winnerPop {
    from { transform: scale(0.65); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.winner-badge-crown {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
    filter: drop-shadow(0 4px 10px rgba(251, 191, 36, 0.5));
}

.winner-title-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fde047;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.winner-name-display {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    word-break: break-word;
}

.winner-actions {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-winner-primary {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 2px solid #6ee7b7;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    padding: 0.65rem 1.4rem;
    cursor: pointer;
}

.btn-winner-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.65rem 1.4rem;
    cursor: pointer;
}

.btn-winner-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   AGE MILESTONES, EDUCATION LEVEL & LIFE STAGES
   ========================================================================== */
.milestone-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.milestone-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-weight: 700;
}

.milestone-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.timeline-item.passed {
    border-color: rgba(16, 185, 129, 0.4);
    background: var(--green-tint);
}

.timeline-item.upcoming {
    opacity: 0.85;
}

.timeline-icon-box {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.timeline-item.passed .timeline-icon-box {
    background: var(--green-primary);
    color: #ffffff;
}

.timeline-item.upcoming .timeline-icon-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ==========================================================================
   FAVORITES & DEFAULT LANDING TOOL PREFERENCES (LOCALSTORAGE)
   ========================================================================== */
.default-tool-banner {
    background: #fefce8;
    border: 1.5px solid #fde047;
    color: #854d0e;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
}

[data-theme="dark"] .default-tool-banner {
    background: #1c1917;
    border-color: #78350f;
    color: #fef08a;
}

.tool-pref-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.btn-pref {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: none !important;
}

.btn-pref:hover {
    color: var(--green-primary);
    border-color: var(--green-primary);
    background: var(--green-tint);
}

.btn-pref.active {
    color: #b45309;
    border-color: #f59e0b;
    background: #fef3c7;
}

[data-theme="dark"] .btn-pref.active {
    color: #fde047;
    border-color: #d97706;
    background: rgba(245, 158, 11, 0.15);
}

.btn-pref-default.active {
    color: var(--green-primary);
    border-color: var(--green-primary);
    background: var(--green-tint);
}

.card-fav-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.card-fav-btn:hover {
    color: #f59e0b;
    border-color: #f59e0b;
}

.card-fav-btn.active {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #fef3c7;
}

[data-theme="dark"] .card-fav-btn.active {
    background: rgba(245, 158, 11, 0.2);
}

.thutil-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #0f172a;
    color: #ffffff;
    border: 1.5px solid #334155;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
    z-index: 99999;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 440px;
    line-height: 1.45;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

[data-theme="dark"] .privacy-guarantee-banner {
    background: rgba(22, 101, 52, 0.2) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

[data-theme="dark"] .privacy-guarantee-banner div > div {
    color: #86efac !important;
}

[data-theme="dark"] .privacy-guarantee-banner p {
    color: #bbf7d0 !important;
}

.lucky-ball {
    user-select: none;
    font-family: var(--font-mono, monospace);
}

.lucky-pill {
    user-select: none;
    font-family: var(--font-mono, monospace);
}

