/* Global CSS Variables */
:root {
    --e-global-color-primary: #202124;
    --e-global-color-secondary: #5f6368;
    --e-global-color-text: #202124;
    --e-global-color-accent: #1a73e8;
    --e-global-color-47181bf: #1a73e8;
    --e-global-color-2b44cf5: #0b57d0;
    --e-global-color-d4743d7: #f1f3f4;
    --e-global-color-1aa9d7c: #ffffff;
    --e-global-color-e1acc65: #e4e7eb;
    --e-global-color-89ac6ee: #dadce0;
    --e-global-typography-primary-font-family: "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --e-global-typography-primary-font-weight: 600;
    --e-global-typography-secondary-font-family: "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --e-global-typography-secondary-font-weight: 500;
    --e-global-typography-text-font-family: "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --e-global-typography-text-font-weight: 400;
    --e-global-typography-accent-font-family: "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --e-global-typography-accent-font-weight: 500;
}

.hidden {
    display: none !important;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--e-global-typography-text-font-family);
    font-weight: var(--e-global-typography-text-font-weight);
    color: var(--e-global-color-primary);
    background-color: var(--bg-body);
    min-height: 100vh;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Navigation Bar */
/* Navbar not used on dashboard now, but kept for other pages */
.navbar {
    --navbar-height: 64px;
    background-color: var(--surface-card);
    border-bottom: 1px solid var(--border-soft);
    padding: 0.85rem clamp(1.5rem, 4vw, 3rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    min-height: var(--navbar-height);
}


.logo {
    color: var(--e-global-color-primary);
    font-family: var(--e-global-typography-primary-font-family);
    font-weight: var(--e-global-typography-primary-font-weight);
    font-size: 1.5rem;
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: color var(--transition-smooth);
}

.logo:hover {
    color: var(--e-global-color-accent);
}

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

.nav-search {
    width: min(360px, 45vw);
}

.nav-search input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--e-global-color-secondary);
    min-width: 200px;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--e-global-color-accent);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.nav-link {
    color: var(--e-global-color-secondary);
    font-family: var(--e-global-typography-secondary-font-family);
    font-weight: var(--e-global-typography-secondary-font-weight);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    transition: color var(--transition-smooth), background-color var(--transition-smooth);
}

.nav-link:hover {
    background-color: rgba(26, 115, 232, 0.08);
    color: var(--e-global-color-accent);
}

.nav-link.active {
    background-color: rgba(26, 115, 232, 0.12);
    color: var(--e-global-color-accent);
    font-weight: 600;
}

.nav-link.logout {
    color: #c5221f;
}

.nav-link.logout:hover {
    background-color: rgba(197, 34, 31, 0.1);
    color: #a50e0e;
}

.desktop-only {
    display: table-cell;
}

@media (max-width: 768px) {
    .navbar {
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: var(--space-sm);
        position: relative;
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        gap: 0.35rem;
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-md);
        padding: 0.4rem 0.5rem;
        background: var(--surface-card);
        cursor: pointer;
        justify-self: end;
    }

    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--e-global-color-primary);
        border-radius: 999px;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 1rem;
        padding: var(--space-md);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-soft);
        background: var(--surface-card);
        box-shadow: var(--shadow-soft);
        display: grid;
        gap: var(--space-xs);
        min-width: 220px;
        transform: scale(0.95);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, transform 0.2s ease;
        z-index: 100;
    }

    .nav-links.nav-links--open {
        transform: scale(1);
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        padding: 1rem;
        min-height: calc(100vh - 120px);
    }
    
    .container {
        padding: 1.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }

    .desktop-only {
        display: none;
    }
}

.user-info {
    color: var(--e-global-color-secondary);
    font-size: 0.9rem;
    margin-right: 1rem;
}

.user-info .user-name {
    font-weight: var(--e-global-typography-accent-font-weight);
}

.user-info .user-role {
    font-size: 0.8rem;
    opacity: 0.9;
    color: var(--text-muted);
}

.auth-body {
    background: #f6f7f9;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
    grid-template-rows: 1fr;
}

.auth-shell {
    width: min(420px, 100%);
}

.auth-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 4vw, 2rem);
    display: grid;
    gap: var(--space-md);
    box-shadow: var(--shadow-soft);
}

.auth-logo {
    display: grid;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.auth-logo img {
    max-height: 60px;
    object-fit: contain;
}

.auth-header {
    text-align: center;
    display: grid;
    gap: var(--space-2xs);
}

.auth-form {
    display: grid;
    gap: var(--space-sm);
}

/* Main Content Layout */
.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.container {
    background-color: var(--surface-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    max-width: 500px;
    width: 100%;
}

/* Typography */
h1 {
    font-family: var(--e-global-typography-primary-font-family);
    font-weight: var(--e-global-typography-primary-font-weight);
    color: var(--e-global-color-primary);
    margin-bottom: 1.25rem;
    text-align: left;
    letter-spacing: -0.01em;
}

h2, h3 {
    font-family: var(--e-global-typography-secondary-font-family);
    font-weight: var(--e-global-typography-secondary-font-weight);
    color: var(--e-global-color-primary);
    margin-bottom: 0.5rem;
}

p {
    color: var(--e-global-color-secondary);
    font-size: 1rem;
    text-align: left;
    margin-bottom: 1rem;
}

em {
    color: var(--e-global-color-secondary);
    font-style: italic;
}

/* Buttons and Links */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.65rem 1.25rem;
    font-family: var(--e-global-typography-accent-font-family);
    font-weight: var(--e-global-typography-accent-font-weight);
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    transition: background-color var(--transition-smooth), color var(--transition-smooth), transform var(--transition-smooth);
    cursor: pointer;
    text-align: center;
    background-color: var(--surface-card);
    color: var(--e-global-color-primary);
}
.btn:hover { 
    background-color: var(--surface-muted);
    transform: translateY(-1px);  
}
.btn-primary {
    background-color: var(--e-global-color-accent);
    border-color: var(--e-global-color-accent);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--e-global-color-2b44cf5);
}

.btn-secondary {
    background-color: #e8f0fe;
    border-color: transparent;
    color: var(--e-global-color-accent);
}
.btn-secondary:hover {
    background-color: rgba(26, 115, 232, 0.2);
}

.btn--danger {
    background-color: #e53935;
    border-color: #e53935;
    color: #fff;
}

.btn--danger:hover {
    background-color: #c62828;
}

/* --- Unified layout and components --- */
:root {
    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-soft: 0 2px 8px rgba(32, 33, 36, 0.08);
    --shadow-strong: 0 8px 24px rgba(32, 33, 36, 0.12);

    --transition-smooth: 0.2s ease;
    --surface-card: #ffffff;
    --surface-muted: #f1f3f4;
    --bg-body: #f8f9fa;
    --border-soft: #e0e3ea;
    --text-muted: var(--e-global-color-secondary);
}

body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    row-gap: var(--space-xl);
    align-content: start;
    justify-items: center;
    padding-block-end: var(--space-xl);
    background-color: var(--bg-body);
    color: var(--e-global-color-primary);
}

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

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

a:hover {
    color: var(--e-global-color-accent);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.navbar {
    width: 100%;
    padding-block: 0.85rem;
    padding-inline: clamp(1.5rem, 4vw, 3rem);
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-lg);
    background-color: var(--surface-card);
    border-bottom: 1px solid var(--border-soft);
}

.logo {
    font-family: var(--e-global-typography-primary-font-family);
    font-weight: var(--e-global-typography-primary-font-weight);
    font-size: clamp(1.4rem, 4vw, 1.65rem);
    display: inline-grid;
    color: var(--e-global-color-primary);
    letter-spacing: -0.01em;
    transition: color var(--transition-smooth);
}

.nav-links {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: end;
    align-items: center;
    gap: var(--space-sm);
}

.nav-toggle {
    display: none;
}

.user-info {
    display: inline-grid;
    justify-items: end;
    gap: var(--space-2xs);
    font-size: 0.9rem;
    text-align: right;
    color: var(--text-muted);
}

.user-info .user-role {
    font-size: 0.8rem;
    opacity: 0.8;
}

:where(.btn,
       .nav-link,
       .nav-link-back) {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    padding-block: 0.55rem;
    padding-inline: clamp(0.9rem, 3vw, 1.35rem);
    border-radius: 999px;
    border: 1px solid var(--btn-border, transparent);
    font-family: var(--e-global-typography-accent-font-family);
    font-weight: var(--e-global-typography-accent-font-weight);
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    min-height: 2.5rem;
    background-color: var(--btn-bg, transparent);
    color: var(--btn-fg, var(--e-global-color-primary));
    transition:
        background-color var(--transition-smooth),
        color var(--transition-smooth),
        border-color var(--transition-smooth),
        transform var(--transition-smooth);
}

:where(.btn,
       .nav-link,
       .nav-link-back):hover {
    background-color: var(--btn-bg-hover, var(--btn-bg, transparent));
    color: var(--btn-fg-hover, var(--btn-fg, var(--e-global-color-primary)));
    transform: translateY(-1px);    
}

:where(.btn,
       .nav-link,
       .nav-link-back):active {
    transform: translateY(0);
}

:where(.btn,
       .nav-link,
       .nav-link-back):focus-visible {
    outline: 3px solid var(--e-global-color-accent);
    outline-offset: 2px;
}

.btn {
    --btn-bg: var(--e-global-color-accent);
    --btn-bg-hover: var(--e-global-color-2b44cf5);
    --btn-fg: var(--e-global-color-1aa9d7c);
    --btn-border: transparent;
}

.nav-link.active {
    --btn-bg: rgba(26, 115, 232, 0.12);
    --btn-bg-hover: rgba(26, 115, 232, 0.18);
    --btn-fg: var(--e-global-color-accent);
    --btn-border: transparent;
    font-weight: 600;
}

.btn--neutral,
.nav-link-back {
    --btn-bg: var(--surface-card);
    --btn-bg-hover: var(--surface-muted);
    --btn-fg: var(--e-global-color-primary);
    --btn-border: var(--border-soft);
}

.btn--full {
    width: 100%;
}

.btn--compact {
    padding-block: 0.5rem;
    padding-inline: 0.9rem;
    font-size: 0.85rem;
}

.nav-link {
    --btn-bg: transparent;
    --btn-bg-hover: rgba(26, 115, 232, 0.08);
    --btn-fg: var(--e-global-color-secondary);
    --btn-border: transparent;
    font-size: 0.95rem;
}

.nav-link.logout {
    --btn-bg: transparent;
    --btn-bg-hover: rgba(197, 34, 31, 0.12);
    --btn-fg: #c5221f;
    --btn-fg-hover: #a50e0e;
}

.page-shell {
    max-width: 1300px;
    width: 100%;
    margin: 2rem auto;
    display: grid;
    gap: var(--space-xl);
}

.layout-shell {
    width: 100%;
    padding-inline: clamp(1.5rem, 4vw, 3rem);
    padding-left: 280px;
}

.page-shell--with-sidebar {
    padding-top: 0;
    margin-left: 0;
}

.body,
body {
    background: #f6f7f9;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    overflow-y: auto;
    align-self: start;
    display: grid;
    gap: 10px;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
    min-height: 60vh;
    grid-template-rows: min-content auto min-content;
    z-index: 30;
}

.side-nav__group,
.side-nav__footer {
    display: grid;
    gap: var(--space-sm);
    grid-auto-rows: min-content;
    grid-auto-flow: row;
}

.side-nav__footer {
    border-top: 1px solid #e4e7ec;
    padding-top: 0.75rem;
}

.side-nav__search {
    width: 100%;
}

.side-nav__search input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #d0d7e3;
    border-radius: 30px;
    background: #fff;
    color: #111827;
}

.side-nav__search input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.page-card,
.info-section,
.table-scroll,
.invoice-toolbar {
    box-shadow: none;
}

.side-nav__link {
    height: fit-content;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem 0.8rem;
    color: #3d434c;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background-color var(--transition-smooth), color var(--transition-smooth), border-color var(--transition-smooth);
}

.side-nav__icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
}

.side-nav__icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.side-nav__link:hover {
    background: #eef2f7;
    color: #111827;
}

.side-nav__link.is-active {
    box-shadow: inset 3px 0 0 #1a73e8;
    color: #0f172a;
}

@media (max-width: 1024px) {
    .side-nav {
        position: static;
        width: auto;
        height: auto;
        max-height: none;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        min-height: auto;
    }

    .layout-shell {
        padding-inline: clamp(1rem, 4vw, 2rem);
        padding-left: clamp(1rem, 4vw, 2rem);
    }

    .page-shell {
        margin: 1.5rem auto;
    }

    .side-nav__link {
        grid-template-columns: auto 1fr;
    }
}

.page-card {
    background-color: var(--surface-card);


    display: grid;
    gap: var(--space-lg);
    height: fit-content;
    box-shadow: none;
}

.page-card--centered {
    justify-items: center;
    text-align: center;
}

.page-card--narrow {
    width: min(100%, 34rem);
    justify-self: center;
    padding:20px;
}

.page-card--wide {
    width: 100%;
    padding:20px;
}

.page-header {
    display: grid;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: var(--space-md);
}

.page-subtitle {
    color: var(--text-muted);
    font-style: normal;
    font-size: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-md);
}

.stat-card {
    background-color: var(--surface-card);
    color: var(--e-global-color-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    display: grid;
    gap: var(--space-xs);
    transition: background-color var(--transition-smooth);
}

.stat-card h3 {
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    opacity: 0.9;
    text-transform: none;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: var(--e-global-typography-primary-font-weight);
}

.status-indicator,
.status-badge,
.role-badge {
    display: inline-grid;
    align-items: center;
    justify-content: center;
    padding-block: 0.35rem;
    padding-inline: 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: var(--e-global-typography-accent-font-weight);
    text-transform: uppercase;
}

.status-connected,
.status-active,
.role-admin {
    background-color: rgba(26, 115, 232, 0.12);
    color: var(--e-global-color-accent);
}

.status-disconnected,
.status-inactive {
    background-color: rgba(95, 99, 104, 0.15);
    color: var(--text-muted);
}

.role-user {
    background-color: rgba(32, 33, 36, 0.08);
    color: var(--e-global-color-primary);
}

.info-section {
    display: grid;
    gap: var(--space-sm);
    background-color: var(--surface-card);
    grid-template-rows: min-content min-content;
    height:fit-content;
}

.info-section ul {
    list-style: none;
    padding: 0;
    display: grid;
    gap: var(--space-xs);
}

.info-section ul li strong {
    color: var(--e-global-color-primary);
    font-weight: var(--e-global-typography-accent-font-weight);
}

.upload-status {
    display: grid;
    gap: var(--space-2xs);
    min-width: 12rem;
    --progress: 25%;
}

.upload-status[data-status="processing"] { --progress: 65%; }
.upload-status[data-status="processed"] { --progress: 100%; }
.upload-status[data-status="failed"] { --progress: 100%; }

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: var(--e-global-typography-accent-font-weight);
    text-transform: none;
    width: fit-content;
}

.status-chip--uploaded,
.status-chip--processing {
    background: rgba(26, 115, 232, 0.12);
    color: var(--e-global-color-accent);
}

.status-chip--processed {
    background: rgba(46, 125, 50, 0.16);
    color: #2e7d32;
}

.status-chip--failed {
    background: rgba(229, 57, 53, 0.16);
    color: #e53935;
}

.progress-track {
    height: 8px;
    background-color: var(--surface-muted);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    width: var(--progress);
    background-color: var(--e-global-color-accent);
    transition: width var(--transition-smooth), background-color var(--transition-smooth);
}

.progress-fill.is-success { background-color: #2e7d32; }
.progress-fill.is-danger { background-color: #e53935; }

.upload-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.invoice-toolbar__actions {
    display: inline-flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.project-panel {
    margin-top: var(--space-md);
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
}

.project-panel__header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-md);
}

.project-panel__subtitle {
    color: var(--text-muted);
    margin: 0;
}

.project-form__grid {
    display: grid;
    gap: var(--space-md);
}

.projects-table tr.is-active,
.projects-table tr.is-active:hover {
    background-color: rgba(26, 115, 232, 0.08);
}

.project-form__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-md);
}

.project-form__row--header {
    align-items: center;
    grid-template-columns: 1.5fr auto;
}

.project-form__textarea {
    width: 100%;
}

.project-form__textarea textarea {
    width: 100%;
    min-height: 6.5rem;
}

.project-form__textarea--full {
    grid-column: 1 / -1;
}

.project-form__row--dates {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.input-date {
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font: inherit;
    background: #fff;
}

.project-form__actions {
    margin-top: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.project-status {
    margin-top: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.project-drawer-invoices {
    margin-top: var(--space-md);
    display: grid;
    gap: var(--space-sm);
}

.project-drawer-invoices h4 {
    margin: 0;
    font-size: 1rem;
}

.project-resources {
    display: grid;
    gap: var(--space-sm);
}

.project-resources__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-resource-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: var(--space-sm);
}

.project-resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--surface-card);
}

.project-resource-meta {
    display: grid;
    gap: 0.25rem;
}

.project-resource-actions {
    display: flex;
    gap: var(--space-xs);
}

.timestamp {
    color: var(--text-muted);
    font-family: "SFMono-Regular", ui-monospace, "Roboto Mono", monospace;
    font-size: 0.9rem;
    background-color: var(--surface-muted);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    justify-self: start;
}

.admin-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-md);
}

.admin-quick-action {
    --btn-bg: var(--e-global-color-accent);
    --btn-bg-hover: var(--e-global-color-2b44cf5);
    --btn-fg: var(--e-global-color-1aa9d7c);
    --btn-border: transparent;
}

.admin-quick-action--neutral {
    --btn-bg: var(--surface-card);
    --btn-bg-hover: var(--surface-muted);
    --btn-fg: var(--e-global-color-primary);
    --btn-border: var(--border-soft);
}

.users-header {
    display: grid;
    gap: var(--space-sm);
    grid-template-rows:min-content min-content;
}
.user-header-text {
    display: grid;
    gap: var(--space-xs);
    grid-template-columns: 1fr max-content;
    align-items: center;
}
.users-count {
    color: var(--e-global-color-secondary);
    font-size: 0.9rem;
}
.user-create {
    display: grid;
    justify-items: end;
}

.resource-create-btn {
    width: fit-content;
    place-self: end;
}
.users-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--surface-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.users-table th,
.users-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.users-table thead th {
    background-color: var(--surface-muted);
    color: var(--e-global-color-primary);
    font-family: var(--e-global-typography-secondary-font-family);
}

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

.users-table tbody tr:hover {
    background-color: rgba(26, 115, 232, 0.04);
}

.action-links {
    display: grid;
    grid-auto-flow: column;
    gap: var(--space-xs);
    justify-content: start;
}

.empty-state {
    display: grid;
    gap: var(--space-sm);
    justify-items: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    background-color: var(--surface-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
}

form {
    display: grid;
    gap: var(--space-lg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--space-md);
}

.form-group {
    display: grid;
    gap: var(--space-xs);
}

.business-toggle {
    display: flex;
    justify-content: flex-start;
    margin-bottom: var(--space-sm);
}

.summary-toggle {
    display: flex;
    justify-content: flex-end;
    margin: var(--space-xs) 0 var(--space-sm);
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    font-weight: 600;
    color: var(--e-global-color-primary);
    user-select: none;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-slider {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--border-soft);
    position: relative;
    transition: background-color var(--transition-smooth);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-smooth);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--e-global-color-accent);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.field-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.invoice-toolbar {
    display: grid;
    grid-template-columns: auto max-content;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.invoice-toolbar #invoice-search-input {
    padding: 10px;
    min-width: 60%;
    border-radius: 50px;
    border-style: solid;
    border-width: 1px;
    border-color: var(--border-soft);
}
#invoice-create-btn:hover {
    background-color:rgba(39, 174, 96, 0.15);
    border-color: rgba(39, 174, 96, 0.35);
    color:#1b7f4d;
}
.checkbox-inline {

    display:grid;
    grid-template-columns: min-content 1fr;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

label {
    color: var(--e-global-color-primary);
    font-family: var(--e-global-typography-secondary-font-family);
    font-weight: var(--e-global-typography-secondary-font-weight);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--e-global-color-primary);
    background-color: var(--surface-card);
    transition:
        border-color var(--transition-smooth),
        background-color var(--transition-smooth),
        box-shadow var(--transition-smooth);

}

select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--e-global-color-primary);
    background-color: var(--surface-card);
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

select:focus {
    outline: none;
    border-color: var(--e-global-color-accent);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.18);
}

input[type="number"] {
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--e-global-color-primary);
    background-color: var(--surface-card);
    width: 100%;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--e-global-color-accent);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.18);
}

input[type="date"] {
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--e-global-typography-text-font-family);
    color: var(--e-global-color-primary);
    background-color: var(--surface-card);
    width: 100%;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--e-global-color-accent);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.18);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--e-global-color-accent);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.18);
    background-color: #fff;
}

input::placeholder,
textarea::placeholder {
    color: rgba(32, 33, 36, 0.55);
}

input:disabled,
textarea:disabled {
    background-color: var(--surface-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.checkbox-group {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-md);
    background-color: var(--surface-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--e-global-color-accent);
}

.checkbox-group label {
    margin: 0;
    color: var(--e-global-color-text);
}

.form-actions {
    display: grid;
    gap: var(--space-sm);
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    align-items: center;
}

.error-message,
.info-box,
.password-hint,
.user-id-info {
    display: grid;
    gap: var(--space-xs);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    font-size: 0.95rem;
}

.error-message {
    background-color: #fdecea;
    border-color: #f7c5c0;
    color: #a61b15;
}

.info-box {
    background-color: #e8f0fe;
    border-color: #c6dafc;
    color: #174ea6;
}

.password-hint {
    background-color: var(--surface-muted);
    border-color: var(--border-soft);
    color: var(--text-muted);
}

.variant-search {
    display: grid;
    grid-template-columns: auto;
    gap: var(--space-sm);
    border-radius: var(--radius-md);
}

.variant-search input {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--surface-card);
}

.table-scroll {
    overflow-x: auto;
}


.variants-table {
    min-width: max-content;
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-md);
}

.variants-table th {
    background-color: var(--surface-muted);
    color: var(--e-global-color-primary);
    padding: var(--space-sm);
    text-align: left;
    font-weight: 600;
}

.variants-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-soft);
}

.variants-table__sku {
    font-family: var(--e-global-typography-accent-font-family);
}

.variants-table__price {
    font-weight: 600;
    text-align: right;
}

.variant-status {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
}

.variant-status--active {
    background-color: rgba(26, 115, 232, 0.12);
    color: var(--e-global-color-accent);
    border-color: rgba(26, 115, 232, 0.3);
}

.variant-status--inactive {
    background-color: rgba(95, 99, 104, 0.2);
    color: var(--text-muted);
    border-color: rgba(95, 99, 104, 0.3);
}

.user-id-info {
    background-color: var(--surface-card);
    border-color: var(--border-soft);
    color: var(--text-muted);
}

.back-link {
    display: grid;
    justify-items: center;
    justify-self: center;
    gap: var(--space-xs);
    color: var(--e-global-color-secondary);
    font-size: 0.95rem;
}

.back-link a:hover {
    color: var(--e-global-color-accent);
}

.admin-navigation {
    border-top: 1px solid var(--border-soft);
    padding-top: var(--space-md);
    display: grid;
    justify-content: start;
}

@media (max-width: 900px) {
    .users-header {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

@media (max-width: 768px) {
    .navbar {
        justify-items: center;
        text-align: center;
        row-gap: var(--space-sm);
    }

    .nav-links {
   
        width: 100%;
        justify-items: center;
    }

    .nav-links .nav-link {
        width: 100%;
    }

    .user-info {
        justify-items: center;
        text-align: center;
    }

    .page-shell {
        margin: clamp(1rem, 4vw, 2rem);
    }

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

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

    .users-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .admin-quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .form-actions {
        grid-template-columns: 1fr;
    }
}
.products-table tbody tr {
    cursor: pointer;
}

.alert {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.alert--error {
    background: #ffecec;
    color: #a62121;
    border: 1px solid #f3b8b8;
}

.alert--success {
    background: #ebfbf2;
    color: #1d7a42;
    border: 1px solid #bde5cd;
}

.product-create-form {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background-color: var(--surface-card);
}

.product-create-form__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-sm);
}

.product-create-form input {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
}

.product-create-form button {
    justify-self: start;
}

.product-edit-form {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    background-color: var(--surface-card);
    display: grid;
    gap: var(--space-sm);
}

.product-edit-form__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-sm);
}

.product-edit-form input,
.product-edit-form select {
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background-color: var(--surface-card);
}

.product-edit-form__actions {
    display: flex;
    justify-content: flex-end;
}

.product-variants-panel {
    margin-top: var(--space-lg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: grid;
    gap: var(--space-md);
    background-color: var(--surface-card);
}

.product-variants-panel.hidden {
    display: none;
}

.product-variants-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.variant-create-form {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    background-color: var(--surface-card);
    display: grid;
    gap: var(--space-sm);
}

.variant-create-form__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-sm);
}

.variant-create-form input,
.variant-create-form select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background-color: var(--surface-card);
}

.variant-create-form__actions {
    display: flex;
    justify-content: flex-end;
}

.panel-subtitle {
    color: var(--e-global-color-secondary);
    margin: 0;
}

.panel-placeholder {
    text-align: center;
    padding: var(--space-lg);
    color: var(--e-global-color-secondary);
}

.invoice-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-md);
}

.invoice-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) max-content;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.invoice-form input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background-color: var(--surface-card);
}

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

.rot-panel .table-scroll {
    width: 100%;
    overflow-x: auto;
}

.rot-panel .invoices-table--rot {
    min-width: 960px;
}

.invoices-table thead th {
    background-color: var(--surface-muted);
    color: var(--e-global-color-primary);
}

.invoices-table th,
.invoices-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

.invoice-status {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
}

.invoice-status--draft {
    background: rgba(95, 99, 104, 0.18);
    color: var(--text-muted);
    border-color: rgba(95, 99, 104, 0.35);
}

.invoice-status--sent {
    background: rgba(242, 153, 74, 0.15);
    color: #c35b0a;
    border-color: rgba(242, 153, 74, 0.3);
}

.invoice-status--accepted {
    background: rgba(26, 115, 232, 0.15);
    color: #0b57d0;
    border-color: rgba(26, 115, 232, 0.3);
}

.invoice-status--completed {
    background: rgba(0, 150, 136, 0.15);
    color: #04695f;
    border-color: rgba(0, 150, 136, 0.35);
}

.invoice-status--paid {
    background: rgba(39, 174, 96, 0.15);
    color: #1b7f4d;
    border-color: rgba(39, 174, 96, 0.35);
}

.invoice-status--overdue {
    background: rgba(197, 34, 31, 0.15);
    color: #a50e0e;
    border-color: rgba(197, 34, 31, 0.35);
}
.invoices-table tbody tr {
    cursor: pointer;
}

.invoice-drawer,
.project-drawer {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 950;
}

.invoice-drawer__overlay,
.project-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(32, 33, 36, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.invoice-editor,
.project-editor {
    position: relative;
    height: 100%;
    width: min(90%, 100%);
    max-width: 100vh;
    margin-top: 0;
    padding: var(--space-lg);
    background-color: #f1f3f4;
    border-left: 1px solid var(--border-soft);
    box-shadow: var(--shadow-strong);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transform: translateX(36px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.project-editor {
    max-width: 820px;
    background-color: #f8f9fa;
}

.invoice-drawer--open,
.project-drawer--open {
    pointer-events: auto;
}

.invoice-drawer--open .invoice-drawer__overlay,
.project-drawer--open .project-drawer__overlay {
    opacity: 1;
}

.invoice-drawer--open .invoice-editor,
.project-drawer--open .project-editor {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.search-drawer[aria-hidden="true"] {
    display: none;
}

body.drawer-open {
    overflow: hidden;
}

.invoice-editor__close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: color var(--transition-smooth);
}

.invoice-editor__close:hover,
.invoice-editor__close:focus-visible {
    color: var(--e-global-color-primary);
}

.invoice-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.invoice-title-group {
    display: grid;
    gap: 0.15rem;
}

#invoice-title[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed transparent;
    cursor: text;
}

#invoice-title[contenteditable="true"]:focus {
    border-bottom-color: #c7c7c7;
}

.invoice-title-hint {
    font-size: 0.75rem;
    color: var(--e-global-color-secondary);
    margin: 0;
}

.invoice-status-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-sm);
}

.status-select {
    display: grid;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    font-family: var(--e-global-typography-text-font-family);
    font-size: 0.95rem;
    color: var(--e-global-color-primary);
    cursor: pointer;
    min-width: 9rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--e-global-color-secondary) 50%), linear-gradient(135deg, var(--e-global-color-secondary) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}

.status-select select:focus {
    outline: 3px solid rgba(26, 115, 232, 0.25);
    outline-offset: 2px;
}

#invoice-preview-link.hidden {
    display: none;
}

.invoice-editor.hidden {
    display: none;
}

.invoice-preview-wrapper {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    margin-top: 10px;
}
.invoice-meta-form {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    margin-top:10px;
}


.invoice-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-sm);
}

.invoice-meta-section {
    display: grid;
    gap: var(--space-xs);
}

.invoice-meta-section h3 {
    margin: 0 0 0.2rem 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--e-global-color-secondary);
}

.invoice-meta-form label {
    display: grid;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--e-global-color-secondary);
}

.invoice-meta-form input,
.invoice-meta-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
}

.invoice-meta-form textarea {
    min-height: 4rem;
    resize: vertical;
}

.invoice-meta-textarea {
    display: grid;
    gap: 0.2rem;
}

.invoice-meta-form button {
    justify-self: start;
}

.invoice-lines-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-md);
}

.invoice-lines-table th,
.invoice-lines-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

.invoice-lines__littera {
    font-family: var(--e-global-typography-accent-font-family);
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.invoice-lines-table .line-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: rgba(26, 115, 232, 0.12);
    color: var(--e-global-color-accent);
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.35rem;
}

.invoice-lines__actions {
    text-align: right;
}

.invoice-line-remove {
    background: none;
    border: none;
    color: var(--e-global-color-accent);
    cursor: pointer;
    font-weight: 600;
    padding: 0;
}

.invoice-line-remove:hover {
    text-decoration: underline;
    color: var(--e-global-color-2b44cf5);
}

.invoice-line-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: flex-start;
}

.invoice-line-actions--inline {
    justify-content: center;
    margin-top: var(--space-md);
}

.invoice-line-actions--inline .btn {
    min-width: 10rem;
}

@media (max-width: 560px) {
    .invoice-line-actions {
        justify-content: center;
    }

    .invoice-line-actions .btn {
        width: 100%;
    }
}

.invoice-line-form {
    display: grid;
    gap: var(--space-sm);
}

.rot-section {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(26, 115, 232, 0.05);
    display: grid;
    gap: var(--space-sm);
    grid-column: 1 / -1;
}

.rot-section--disabled {
    opacity: 0.5;
    pointer-events: none;
}

.rot-fields {
    display: grid;
    gap: var(--space-xs);
}

.rot-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0;
}

.form-label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-label span {
    font-weight: 600;
    color: var(--e-global-color-primary);
}

.form-label--full {
    grid-column: 1 / -1;
}

#variant-line-form,
#free-line-form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#variant-line-form .variant-search {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    #variant-line-form,
    #free-line-form {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.invoice-line-form input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background-color: var(--surface-card);
}

.invoice-line-form button {
    align-self: center;
    justify-self: stretch;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    min-height: 2.2rem;
    grid-column: 1 / -1;
}

.invoice-lines-table .empty-cell {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
}

.variant-search {
    position: relative;
}

.variant-search__results {
    position: absolute;
    top: calc(100% + 0.2rem);
    left: 0;
    right: 0;
    background-color: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    max-height: 18rem;
    overflow-y: auto;
    z-index: 20;
}

.variant-search__results.hidden {
    display: none;
}

.variant-search__item {
    width: 100%;
    padding: 0.6rem 0.8rem;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto;
    gap: var(--space-xs);
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.variant-search__item:not(:last-child) {
    border-bottom: 1px solid var(--border-soft);
}

.variant-search__item:hover {
    background-color: #f6f9ff;
}

.variant-search__title {
    font-weight: 600;
}

.variant-search__meta {
    color: var(--e-global-color-secondary);
    font-size: 0.85rem;
}

.variant-search__price {
    justify-self: end;
    font-weight: 600;
}

.variant-search__empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--e-global-color-secondary);
    font-size: 0.9rem;
}

.company-logo-field {
    margin-top: var(--space-md);
}

.company-logo-actions {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    align-items: flex-start;
}

.company-logo-preview {
    display: grid;
    gap: var(--space-sm);
}

.company-logo-preview img {
    max-height: 120px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    background: var(--surface-card);
    padding: var(--space-xs);
}

.company-profile-form textarea {
    min-height: 5rem;
}

.btn--saving {
    pointer-events: none;
    opacity: 0.7;
}

.btn--saved {
    pointer-events: none;
    background-color: #34a853;
    border-color: #34a853;
    color: #fff;
}
.navbar .logo img {
    max-width: 40px;
    height: auto;
}

@media (max-width: 700px) {
    .invoice-meta-form,
    .invoice-preview-wrapper,
    .invoice-editor {
        padding: var(--space-sm);
    }
    .invoice-editor {
        width: 100%;
        max-width: 100%;
    }

    .invoice-title-group {
        width: 100%;
    }

    .invoice-status-group {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: var(--space-xs);
    }

    .invoice-line-actions--inline {
        flex-direction: column;
        align-items: stretch;
    }

    .invoice-line-actions--inline .btn {
        width: 100%;
    }

    .invoice-meta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: var(--space-sm);
        position: relative;
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        gap: 0.35rem;
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-md);
        padding: 0.4rem 0.5rem;
        background: var(--surface-card);
        cursor: pointer;
        justify-self: end;
    }

    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--e-global-color-primary);
        border-radius: 999px;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 0.5rem);
        right: 1rem;
        padding: var(--space-md);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-soft);
        background: var(--surface-card);
        box-shadow: var(--shadow-soft);
        display: grid;
        gap: var(--space-xs);
        min-width: 220px;
        transform: scale(0.95);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, transform 0.2s ease;
        z-index: 100;
    }

    .nav-links.nav-links--open {
        transform: scale(1);
        opacity: 1;
        visibility: visible;
            display: grid;
    grid-template-rows: auto auto auto;
    max-width: fit-content;
    min-width: fit-content;
    }
    .invoices-table .mobile {
        display: none;
    }

    .main-content {
        padding: 1rem;
        min-height: calc(100vh - 120px);
    }
    
    .container {
        padding: 1.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
}

.invoice-summary {
    border-top: 1px solid var(--border-soft);
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    display: grid;
    gap: var(--space-sm);
}

.invoice-summary__row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.invoice-summary__row span:last-child {
    font-weight: 600;
}

.invoice-summary__row--total {
    font-size: 1.05rem;
    border-top: 1px solid var(--border-soft);
    padding-top: var(--space-sm);
}

.invoice-summary__row--rot {
    font-size: 0.9rem;
    color: var(--e-global-color-secondary);
}

.invoice-tax-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.invoice-rot-note {
    font-size: 0.85rem;
    color: var(--e-global-color-secondary);
    margin-top: var(--space-xs);
}

body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(32, 33, 36, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    z-index: 1000;
}

.modal--open {
    display: flex;
}

.modal__dialog {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    width: min(580px, 100%);
    max-height: 90vh;
    padding: clamp(1.25rem, 4vw, 2rem);
    overflow-y: auto;
    display: grid;
    gap: var(--space-md);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
}

.modal__close:hover {
    color: var(--e-global-color-primary);
}

.modal__dialog .variant-search {
    position: static;
}

.modal__dialog .variant-search__results {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    max-height: min(45vh, 24rem);
    margin-top: var(--space-xs);
    box-shadow: inset 0 0 0 1px var(--border-soft);
}

@media (max-width: 600px) {
    .modal {
        padding: var(--space-md);
    }

    .modal__dialog {
        width: 100%;
        max-height: 95vh;
    }
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.section-hidden {
    display: none !important;
}
:root {
