:root {
    /* Brand Colors - High Tech / Modern Palette */
    --primary: #0f172a;
    /* Slate 900 */
    --primary-light: #1e293b;
    /* Slate 800 */
    --secondary: #334155;
    /* Slate 700 */
    --accent: #38bdf8;
    /* Sky 400 - Electric Blue */
    --accent-glow: rgba(56, 189, 248, 0.4);
    --accent-strong: #0ea5e9;
    /* Sky 500 */

    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Red 500 */
    --info: #3b82f6;
    /* Blue 500 */

    /* Surface & Backgrounds */
    --bg-main: #f8fafc;
    /* Slate 50 */
    --bg-app-shell: #f1f5f9;
    /* Slate 100 */
    --surface: rgba(255, 255, 255, 0.75);
    --surface-elevated: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.4);

    /* Text Colors */
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-disabled: #94a3b8;
    /* Slate 400 */
    --text-on-accent: #ffffff;

    /* Borders & Shadows */
    --border-light: rgba(148, 163, 184, 0.1);
    --border-medium: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(100, 116, 139, 0.3);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 12px 24px -10px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.15);
    --shadow-premium: 0 30px 60px -12px rgba(15, 23, 42, 0.25);
    --shadow-glow: 0 0 15px var(--accent-glow);

    /* Layout Tokens */
    --sidebar-width: 280px;
    --topbar-height: 80px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Animation Tokens */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-standard: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-app-shell);
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

body.auth-mode {
    background: radial-gradient(circle at 50% 10%, rgba(56, 189, 248, 0.1) 0%, transparent 40%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: block;
}

/* Landing & Auth Redesign */
.landing-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.landing-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0f172a;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    z-index: 0;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: var(--accent);
    top: -200px;
    left: -200px;
    animation: pulse 10s infinite alternate;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: var(--info);
    bottom: -150px;
    right: -150px;
    animation: pulse 8s infinite alternate-reverse;
}

@keyframes pulse {
    from {
        transform: scale(1);
        opacity: 0.1;
    }

    to {
        transform: scale(1.2);
        opacity: 0.2;
    }
}

.landing-hero {
    width: 100%;
    max-width: 1200px;
    display: flex;
    gap: 80px;
    align-items: center;
    position: relative;
    z-index: 10;
}

.landing-content {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 60px;
    align-items: center;
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    color: white;
    margin: 24px 0;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero-text p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
    max-width: 540px;
    line-height: 1.7;
}

.modern-badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
}

.stat-lab {
    font-size: 0.8rem;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Auth Card */
.auth-box {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.5);
}

.auth-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
}

.auth-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-disabled);
    padding: 14px;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-standard);
}

.auth-btn.active {
    background: var(--primary-light);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-body {
    padding: 40px;
}

.auth-intro {
    margin-bottom: 32px;
}

.auth-intro h2 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-intro p {
    color: var(--text-disabled);
    font-size: 0.9rem;
}

.input-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.field-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-disabled);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.field-with-icon i {
    position: absolute;
    left: 16px;
    color: var(--text-disabled);
    font-size: 1rem;
}

.field-with-icon input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.field-with-icon input:focus {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
    outline: none;
}

.prime-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--transition-standard);
    box-shadow: 0 10px 20px -5px rgba(56, 189, 248, 0.4);
}

.prime-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(56, 189, 248, 0.5);
}

.prime-btn.success {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.auth-divider {
    text-align: center;
    position: relative;
    margin: 32px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    position: relative;
    background: #25334b;
    /* Rough card match */
    padding: 0 16px;
    font-size: 0.7rem;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.auth-links {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 0.85rem;
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.auth-links .bull {
    color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 991px) {
    .landing-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-stats {
        justify-content: center;
    }
}

.app-shell {
    min-height: 100vh;
}

.app-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 998;
    backdrop-filter: blur(4px);
}

body.sidebar-open .app-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow- premium);
    overflow: hidden;
    transition: var(--transition-standard);
}

.sidebar-header {
    padding: 32px 24px 24px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.brand-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-disabled);
    font-weight: 500;
}

/* Language Selector */
.sidebar-lang {
    margin-top: 16px;
}

.lang-selector {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 2px 12px;
    gap: 10px;
    transition: var(--transition-fast);
}

.lang-selector:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.lang-selector i {
    font-size: 0.8rem;
    color: var(--text-disabled);
    pointer-events: none;
}

.lang-selector select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 8px 0;
    width: 100%;
    cursor: pointer;
    outline: none;
}

.lang-selector select option {
    background: var(--primary-light);
    color: white;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    display: block;
    padding: 0 12px;
    margin-bottom: 12px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-disabled);
    opacity: 0.6;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-disabled);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-standard);
    margin-bottom: 2px;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, transparent 100%);
    color: var(--accent);
    position: relative;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.1);
}

.user-strip {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--accent);
}

.user-meta {
    flex: 1;
    min-width: 0;
}

.user-display-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-badge {
    display: block;
    font-size: 0.7rem;
    color: var(--text-disabled);
    text-transform: capitalize;
}

.logout-trigger {
    border: none;
    background: transparent;
    color: var(--text-disabled);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 8px;
}

.logout-trigger:hover {
    color: var(--danger);
    transform: translateX(2px);
}

/* Main Content */
/* Main Content & Topbar */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 0 0 40px;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-footer {
    margin-top: auto;
    padding: 12px 32px 22px;
}

.app-footer-inner {
    border-top: 1px solid var(--border-light);
    padding-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text-disabled);
    font-size: 0.8rem;
}

.app-footer-text strong {
    color: var(--text-main);
}

.app-footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

.app-footer-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
}

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

.topbar-title-group {
    display: flex;
    flex-direction: column;
}

.eyebrow {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

#view-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.01em;
}

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

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-app-shell);
    transform: scale(1.05);
}

@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-110%);
        left: 0;
        top: 0;
        height: 100vh;
        border-radius: 0;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .topbar {
        padding: 0 20px;
    }
}

.container {
    width: 100%;
    margin-top: 16px;
    padding: 0 20px 0 8px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.header-intro h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.header-intro p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.header-controls {
    display: flex;
    gap: 12px;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrap i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.search-wrap input {
    padding: 12px 16px 12px 42px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    width: 320px;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.search-wrap input:focus {
    width: 400px;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    outline: none;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .search-wrap input,
    .search-wrap input:focus {
        width: 100%;
    }
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--surface-glass);
    cursor: pointer;
    transition: var(--transition-standard);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-premium), var(--shadow-glow);
    border-color: var(--accent-glow);
}

.card-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    flex-shrink: 0;
    transition: var(--transition-standard);
}

.card:hover .card-icon {
    background: var(--accent);
    color: white;
    transform: rotate(10deg) scale(1.1);
}

.card-content {
    flex: 1;
}

.card-content h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 6px;
}

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-chevron {
    color: var(--text-disabled);
    font-size: 1.25rem;
    transition: var(--transition-standard);
    opacity: 0.3;
}

.card:hover .card-chevron {
    opacity: 1;
    color: var(--accent);
    transform: translateX(4px);
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--info));
    opacity: 0;
    transition: var(--transition-fast);
}

.card:hover::after {
    opacity: 1;
}

.card h3 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.15rem;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
}

.card p {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 5px;
}

.card .tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1565c0;
    margin-right: 5px;
    margin-top: 5px;
}

.card .timestamp {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.28);
    padding-top: 10px;
}

/* Form Sections */
.section {
    background: var(--surface);
    backdrop-filter: blur(12px);
    padding: 28px;
    border-radius: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.section-header h2 {
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* QA Accordion */
.qa-btn {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.qa-body {
    display: none;
    background: #fff8e1;
    padding: 15px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    border-left: 4px solid var(--warning);
}

.qa-body.show {
    display: block;
}

.qa-item {
    margin-bottom: 8px;
}

.qa-item strong {
    display: block;
    color: #bf360c;
}

/* Inputs */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.full {
    grid-column: span 2;
}

.full-3 {
    grid-column: span 3;
}

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

label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--primary);
    letter-spacing: 0.02em;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(11, 17, 33, 0.02);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12), var(--shadow-glow);
}

/* Buttons */
.btn {
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    box-shadow: 0 10px 24px rgba(11, 17, 33, 0.15);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(11, 17, 33, 0.2), var(--shadow-glow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #3b82f6);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #22c55e);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #f97316);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
}

/* Modal & Toast */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.52);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(6px);
}

.modal {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(11, 17, 33, 0.4);
}

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

.modal-footer {
    padding: 15px 30px;
    background: #f8fafc;
    text-align: right;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #0f172a;
    color: white;
    padding: 14px 20px;
    border-radius: 16px;
    transform: translateX(150%);
    transition: 0.3s;
    z-index: 3000;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.22);
}

.toast.show {
    transform: translateX(0);
}

.hidden {
    display: none !important;
}

/* Report Styles */
.report-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.report-title {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
    padding-left: 10px;
}

.report-content ul {
    list-style: none;
    padding-left: 5px;
}

.report-content li {
    margin-bottom: 5px;
}

.report-content strong {
    color: #555;
    min-width: 140px;
    display: inline-block;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8fafc;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #fcfcfc;
}

.data-table .btn-rm {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
}

.data-table .btn-edit {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
}

/* Inline Add Styles */
.inline-add-container {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 18px;
    border: 1px dashed var(--accent);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.inline-add-row {
    background: #f8f9fa;
}

.inline-add-row td {
    padding: 8px 15px !important;
}

.inline-add-row input {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.field-add-row {
    margin-top: 15px;
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    background: #fdfdfd;
    padding: 10px;
    border-radius: 4px;
    border: 1px dashed #ccc;
}

.section-add-container {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(59, 130, 246, 0.08));
    border-radius: 18px;
    border: 2px dashed var(--accent);
    text-align: center;
}

/* Diagram Visualization & Zoom */
.survey-diagram-outer {
    margin-top: 20px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.diagram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.diagram-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.diagram-controls {
    display: flex;
    gap: 5px;
}

.diagram-viewport {
    width: 100%;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    min-height: 360px;
    max-height: 70vh;
    margin-top: 10px;
}

.diagram-split-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* Report Styles for Diagrams */
.report-content .mermaid {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 20px;
    margin: 15px 0;
    overflow: auto;
    min-height: 320px;
}

.report-diagram-title {
    font-weight: 600;
    color: var(--primary);
    margin-top: 15px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mermaid-wrapper {
    width: 100%;
    transition: transform 0.2s ease;
    transform-origin: top center;
    flex-shrink: 0;
}

.mermaid svg {
    max-width: 100%;
}

.mermaid text {
    font-size: 13px !important;
}

.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node path {
    rx: 8 !important;
    ry: 8 !important;
}

/* Mermaid Decision & Subgraph Styling */
.mermaid .node polygon {
    fill: #fff9c4 !important;
    /* Light yellow for decisions */
    stroke: #fbc02d !important;
    stroke-width: 2px !important;
}

.mermaid .cluster rect {
    fill: #f5f5f5 !important;
    stroke: #bdbdbd !important;
    stroke-dasharray: 5 5 !important;
    rx: 10 !important;
    ry: 10 !important;
}

.mermaid .cluster-label {
    font-weight: bold !important;
    fill: var(--primary) !important;
    font-size: 14px !important;
}

.mermaid {
    line-height: 0;
}

.zoom-btn {
    padding: 2px 8px;
    font-size: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Inline AI Button */
.ai-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.ai-input-wrapper input,
.ai-input-wrapper textarea {
    padding-right: 40px !important;
}

.btn-ai-inline {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    opacity: 0.6;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.btn-ai-inline:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--primary);
}

.ai-working {
    animation: ai-glow 1.5s infinite ease-in-out;
}

@keyframes ai-glow {
    0% {
        color: var(--accent);
        transform: scale(1);
    }

    50% {
        color: var(--warning);
        transform: scale(1.2);
    }

    100% {
        color: var(--accent);
        transform: scale(1);
    }
}

@media (max-width: 1100px) {
    .diagram-split-layout {
        grid-template-columns: 1fr;
    }
}

/* Data Architecture UI */
.da-welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.modal.modal-fullscreen {
    width: 98vw;
    max-width: 98vw !important;
    max-height: 96vh;
    height: 96vh;
}

.da-welcome-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
}

.da-welcome-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.da-quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.da-quick-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.da-quick-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.da-quick-btn i {
    font-size: 0.9rem;
}

.da-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.da-stat-card {
    background: white;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.da-stat-card .num {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
    display: block;
}

.da-stat-card .label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.da-stat-card.pk .num {
    color: #4caf50;
}

.da-stat-card.fk .num {
    color: #ff9800;
}

.da-stat-card.null .num {
    color: #f44336;
}

.da-section-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.da-section-header {
    background: #f8fafc;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.da-section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.da-section-header h3 i {
    color: var(--accent);
}

.da-entity-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.15s;
}

.da-entity-row:hover {
    background: #fafbfc;
}

.da-entity-row:last-child {
    border-bottom: none;
}

.da-entity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 14px;
    flex-shrink: 0;
}

.da-entity-icon.master {
    background: #e3f2fd;
    color: #1976d2;
}

.da-entity-icon.transaction {
    background: #e8f5e9;
    color: #388e3c;
}

.da-entity-icon.lookup {
    background: #fff3e0;
    color: #f57c00;
}

.da-entity-info {
    flex: 1;
    min-width: 0;
}

.da-entity-name {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.da-entity-name .tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.da-entity-name .tag.master {
    background: #e3f2fd;
    color: #1976d2;
}

.da-entity-name .tag.transaction {
    background: #e8f5e9;
    color: #388e3c;
}

.da-entity-name .tag.lookup {
    background: #fff3e0;
    color: #f57c00;
}

.da-entity-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 3px;
}

.da-entity-actions {
    display: flex;
    gap: 6px;
    margin-left: 12px;
}

.da-entity-actions button {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    transition: 0.2s;
}

.da-entity-actions button:hover {
    background: #f5f5f5;
}

.da-entity-actions .btn-edit {
    color: var(--accent);
    border-color: var(--accent);
}

.da-entity-actions .btn-delete {
    color: var(--danger);
    border-color: var(--danger);
}

.da-empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #888;
}

.da-empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 16px;
    display: block;
}

.da-empty-state h4 {
    color: #666;
    margin-bottom: 8px;
}

.da-empty-state p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.da-help-tip {
    background: #e3f2fd;
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.da-help-tip i {
    color: var(--accent);
    margin-top: 2px;
}

/* Survey Redesign */
.survey-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: flex-start;
}

.survey-nav-col {
    position: sticky;
    top: calc(var(--topbar-height) + 24px);
}

.sticky-nav {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.nav-header {
    background: var(--surface-low);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.nav-header h3 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
}

.section-toc {
    list-style: none;
    padding: 12px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition-fast);
}

.toc-item span {
    width: 24px;
    height: 24px;
    background: var(--surface-elevated);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-disabled);
}

.toc-item:hover {
    background: var(--primary-light);
    color: var(--accent);
}

.toc-item.active {
    background: var(--accent);
    color: white;
}

.toc-item.active span {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.survey-header-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

.unit-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.unit-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--accent);
}

.unit-info small {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    font-size: 0.7rem;
    color: var(--text-disabled);
    margin-bottom: 2px;
}

.unit-info h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-btn:hover {
    background: var(--surface-elevated);
    color: var(--primary);
}

.action-btn.ai-btn {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.action-btn.primary {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-group {
    display: flex;
    background: var(--surface-low);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

/* Form Sections */
.survey-form-stack {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    scroll-margin-top: calc(var(--topbar-height) + 40px);
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.form-group.full {
    grid-column: span 2;
}

.ai-input-wrapper {
    position: relative;
    display: flex;
    gap: 12px;
}

.ai-input-wrapper input,
.ai-input-wrapper textarea {
    width: 100%;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 0.92rem;
    transition: var(--transition-fast);
    background: var(--surface-low);
}

.ai-input-wrapper input:focus,
.ai-input-wrapper textarea:focus {
    background: white;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    outline: none;
}

.btn-ai-inline {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    background: var(--surface-elevated);
    color: #8b5cf6;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-ai-inline:hover {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

@media (max-width: 1100px) {
    .survey-shell {
        grid-template-columns: 1fr;
    }

    .survey-nav-col {
        display: none;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: span 1;
    }

    .survey-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
}

.da-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.da-template-card {
    background: white;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.da-template-card:hover {
    border-color: var(--accent);
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.da-template-card i {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 8px;
    display: block;
}

.da-template-card .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
}

.da-template-card .desc {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.da-rel-card {
    background: #fafafa;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border-left: 3px solid var(--accent);
}

.da-rel-card .rel-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.da-rel-card .rel-line .entity-ref {
    font-weight: 600;
    color: var(--primary);
}

.da-rel-card .rel-line .rel-type {
    color: #666;
    font-size: 0.75rem;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
}

.da-rel-card .rel-line .fk-ref {
    color: #888;
    font-size: 0.8rem;
}

.da-rel-arrow {
    color: var(--accent);
}

.da-dict-entry {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.da-dict-entry .dict-header {
    background: #f8fafc;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.da-dict-entry .dict-header .title {
    font-weight: 600;
    color: var(--primary);
}

.da-dict-entry .dict-header .meta {
    font-size: 0.8rem;
    color: #888;
}

.da-dict-entry .dict-body {
    padding: 12px 16px;
}

.da-attr-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 3px;
}

.da-attr-chip.pk {
    background: #e8f5e9;
    color: #2e7d32;
}

.da-attr-chip.fk {
    background: #fff3e0;
    color: #e65100;
}

.da-attr-chip .type {
    color: #888;
    font-size: 0.7rem;
}

.da-search-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.da-search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.da-search-bar select {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 140px;
}

.da-hidden {
    display: none;
}

.da-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #888;
}

.da-template-body {
    padding: 20px;
}

.da-template-intro {
    margin-bottom: 16px;
    color: #666;
    font-size: 0.9rem;
}

.da-muted-meta {
    font-size: 0.85rem;
    color: #888;
}

.da-rel-add-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.da-scroll-box {
    padding: 16px 20px;
    overflow-y: auto;
}

.da-rel-box {
    max-height: 280px;
}

.da-dict-box {
    max-height: 300px;
}

.da-dict-export-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.da-sticky-card {
    position: sticky;
    top: 20px;
}

.da-diagram-controls {
    display: flex;
    gap: 6px;
}

.da-diagram-preview {
    min-height: 500px;
    padding: 20px;
    background: #fafafa;
}

.da-hidden-input {
    display: none;
}


/* AI Intake note editor */
.ai-note-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    align-items: center;
}

.ai-note-select {
    min-width: 120px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
}

.ai-note-editor {
    min-height: 240px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    overflow: auto;
    line-height: 1.55;
}

.ai-note-editor:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    border-color: #2563eb;
}

.ai-note-editor h2,
.ai-note-editor h3,
.ai-note-editor h4 {
    margin: 10px 0 8px;
}

.ai-note-help {
    color: #666;
}

.ai-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 10px;
}

.ai-note-actions {
    display: flex;
    gap: 10px;
}

.ai-note-actions .btn {
    white-space: nowrap;
}

.ai-note-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.ai-note-table td,
.ai-note-table th {
    border: 1px solid #d6d9e0;
    padding: 8px;
    min-width: 90px;
}

.survey-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px 14px;
    margin-bottom: 18px;
}

.survey-highlight-box {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(20, 184, 166, 0.08));
    padding: 18px;
    border-radius: 18px;
}

.survey-module-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(20, 184, 166, 0.14);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(59, 130, 246, 0.06));
}

.survey-module-intro strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1rem;
    color: var(--primary);
}

.survey-module-intro p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.survey-module-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.survey-module-grid .cb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.survey-module-grid .cb-item input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.survey-module-grid .cb-item span {
    color: var(--text);
    font-weight: 600;
    line-height: 1.45;
}

.survey-module-grid .cb-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.08);
    border-color: rgba(20, 184, 166, 0.28);
}

.survey-module-grid .cb-item:has(input:checked) {
    border-color: rgba(20, 184, 166, 0.42);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(59, 130, 246, 0.08));
    box-shadow: 0 18px 32px rgba(20, 184, 166, 0.12);
}

.survey-module-grid .custom-module-item span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.survey-module-custom {
    padding: 16px 18px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
}

.survey-module-custom-row {
    display: flex;
    gap: 10px;
    margin: 10px 0 8px;
}

.survey-module-custom-row input {
    flex: 1;
}

.module-chip-remove {
    position: static;
    margin-left: auto;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 0.8rem;
}

.section-upload-wrap {
    margin-top: 10px;
}

.section-upload-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.section-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.section-image-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.section-image-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.section-image-meta {
    padding: 8px;
    font-size: 0.75rem;
    color: #555;
}

.section-image-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .landing-shell {
        padding: 14px;
    }

    .landing-hero {
        grid-template-columns: 1fr;
    }

    .landing-copy,
    .landing-panel {
        border-radius: 24px;
    }

    .landing-copy {
        padding: 28px 22px;
    }

    .landing-metrics {
        grid-template-columns: 1fr;
    }

    .auth-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-card {
        padding: 20px;
    }

    .sidebar {
        left: 0;
        top: 0;
        height: 100vh;
        border-radius: 0 28px 28px 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 14px;
    }

    .topbar {
        margin: 0 14px;
        padding: 16px;
        border-radius: 20px;
        flex-wrap: wrap;
    }

    .topbar h2 {
        font-size: 1.35rem;
    }

    .topbar-actions,
    #header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .container {
        padding: 0 14px;
    }

    .card-grid,
    .form-grid,
    .form-grid-3,
    .diagram-split-layout {
        grid-template-columns: 1fr;
    }

    .full,
    .full-3 {
        grid-column: auto;
    }

    .dashboard-header,
    .diagram-header,
    .section-header {
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
    }

    .ai-note-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .survey-module-intro,
    .survey-module-custom-row {
        flex-direction: column;
    }

    .survey-module-count {
        min-width: 0;
    }

    .ai-note-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .ai-note-select {
        min-width: 110px;
    }
}

@media (min-width: 769px) and (max-width: 1180px) {
    .main-content {
        margin-left: calc(var(--sidebar-width) + 24px);
        width: calc(100% - var(--sidebar-width) - 30px);
    }

    .container,
    .topbar {
        margin-left: 18px;
        margin-right: 18px;
    }

    .container {
        padding: 0 8px;
    }
}


/* Survey Layout (Vertical Sidebar) */
.survey-shell {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.survey-nav-col {
    width: 280px;
    position: sticky;
    top: calc(var(--topbar-height) + 20px);
}

.survey-main-col {
    flex: 1;
    min-width: 0;
}

.sticky-nav {
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.nav-header {
    padding: 20px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-toc {
    list-style: none;
    padding: 10px 0;
}

.toc-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.toc-item span {
    width: 24px;
    height: 24px;
    background: var(--bg-app-shell);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-main);
    flex: 0 0 24px;
}

.toc-item:hover {
    background: rgba(15, 23, 42, 0.03);
    color: var(--primary);
}

.toc-item.active {
    background: rgba(56, 189, 248, 0.08);
    color: var(--accent-strong);
    border-right: 3px solid var(--accent);
}

.toc-item.active span {
    background: var(--accent);
    color: white;
}
