:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --border: #dbe5f2;
    --border-strong: #bfd0e6;
    --text: #152033;
    --text-soft: #5f6f86;
    --primary: #0b63e6;
    --primary-hover: #0954c2;
    --secondary: #16a34a;
    --secondary-hover: #12803a;
    --accent: #7c3aed;
    --danger: #dc2626;
    --warning: #ea580c;
    --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 18px 45px rgba(16, 24, 40, 0.08);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --container: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, #f4f7fb 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    background: none;
}

.container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

.site-main {
    padding: 34px 0 48px;
}

/* HEADER */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(191, 208, 230, 0.7);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.04);
}

.topbar {
    background: #0f2747;
    color: #dce9fb;
    font-size: 0.92rem;
}

.topbar-inner {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-text {
    color: #dce9fb;
}

.topbar-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-links a {
    color: #ffffff;
    opacity: 0.92;
    transition: 0.2s ease;
}

.topbar-links a:hover {
    opacity: 1;
}

.header-main {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    position: relative;
}

.brand-wrap {
    flex: 0 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.brand img {
    height: 54px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    font-size: 1.35rem;
    line-height: 1.1;
}

.brand-text small {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.mobile-nav-toggle {
    display: none;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.mobile-nav-toggle:hover {
    background: #f8fbff;
}

.mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1e3356;
    border-radius: 999px;
    transition: 0.2s ease;
}

.mobile-nav-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.main-nav {
    display: flex;
    align-items: center;
}

.main-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav li {
    position: relative;
}

.main-nav a,
.nav-group-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
    background: transparent;
    border: 0;
    white-space: nowrap;
}

.main-nav a:hover,
.nav-group-toggle:hover,
.main-nav a.active,
.nav-group-toggle.active,
.nav-group.open > .nav-group-toggle {
    background: #edf4ff;
    color: var(--primary);
}

.nav-group {
    position: relative;
}

.nav-group::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px;
}

.nav-group .dropdown {
    list-style: none;
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    z-index: 20;
}

@media (min-width: 781px) {
    .nav-group.open > .nav-group-toggle {
        background: transparent;
        color: var(--text);
    }

    .nav-group.open > .nav-group-toggle.active {
        background: #edf4ff;
        color: var(--primary);
    }

    .nav-group.open .dropdown {
        display: none;
    }

    .nav-group:hover .dropdown,
    .nav-group:focus-within .dropdown {
        display: block;
    }

    .nav-group:hover > .nav-group-toggle,
    .nav-group:focus-within > .nav-group-toggle {
        background: #edf4ff;
        color: var(--primary);
    }
}

.dropdown li + li {
    margin-top: 4px;
}

.dropdown a {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
    min-height: 0;
    white-space: normal;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary,
.btn.primary {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

.btn-primary:hover,
.btn.primary:hover {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
    color: #fff;
}

.btn-ghost {
    background: #fff;
    color: var(--primary);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: #f3f8ff;
    color: var(--primary);
}

.btn.small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.9rem;
    border-radius: 10px;
}

/* TYPO */
h1, h2, h3, h4 {
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 800;
}

.page-header p {
    color: var(--text-soft);
}

/* CARDS */
.card,
.invoice-card,
.client-card,
.form-card,
.panel,
.dashboard-stat,
.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card {
    overflow: hidden;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card a {
    display: block;
    padding: 24px;
    color: inherit;
}

.card:hover,
.invoice-card:hover,
.client-card:hover {
    transform: translateY(-2px);
    transition: 0.2s ease;
    box-shadow: var(--shadow-md);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.card-desc {
    color: var(--text-soft);
    font-size: 0.96rem;
}

.logout-card {
    background: #fff6f6;
    border-color: #ffd4d4;
}

.logout-card .card-title,
.logout-card .card-icon {
    color: var(--danger);
}

/* LISTS / CARDS GRID */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
    margin: 0 0 24px;
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.card-body {
    padding: 18px 20px;
    display: grid;
    gap: 10px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.invoice-id {
    font-weight: 800;
    color: var(--text);
}

.invoice-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.invoice-card.ok .invoice-status {
    background: #e9f8ef;
    color: #15803d;
}

.invoice-card.overdue .invoice-status {
    background: #fff1f1;
    color: #b91c1c;
}

.invoice-total {
    font-weight: 800;
    font-size: 1.08rem;
}

.field {
    color: var(--text-soft);
    font-size: 0.96rem;
}

.field strong {
    color: var(--text);
}

/* TABLES */
.report,
.list-table,
table {
    width: 100%;
    border-collapse: collapse;
}

.report,
.list-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.report th,
.report td,
.list-table th,
.list-table td,
table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #edf2f9;
    vertical-align: middle;
}

.report th,
.list-table th,
table th {
    background: #f6f9fd;
    color: #31435f;
    font-size: 0.94rem;
    font-weight: 800;
}

.report tr:hover td,
.list-table tr:hover td,
table tr:hover td {
    background: #fbfdff;
}

/* FORMS */
.form-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.form-card {
    width: 100%;
    max-width: 900px;
    padding: 28px;
}

.form-card.login {
    max-width: 460px;
}

.form-card h1 {
    text-align: center;
    margin-bottom: 16px;
}

.form-card label {
    display: block;
    margin-bottom: 16px;
    color: #30435f;
    font-weight: 600;
}

.form-card input,
.form-card select,
.form-card textarea {
    width: 100%;
    margin-top: 8px;
    min-height: 48px;
    padding: 12px 14px;
    background: #fbfdff;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    outline: none;
    transition: 0.2s ease;
}

.form-card textarea {
    min-height: 130px;
    resize: vertical;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(11, 99, 230, 0.08);
}

.form-card button {
    width: 100%;
    margin-top: 8px;
}

/* HELPERS */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.sums {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.date-range {
    margin-bottom: 18px;
}

.date-range label {
    display: inline-block;
    margin-right: 12px;
}

.empty-state {
    text-align: center;
    color: var(--text-soft);
    padding: 24px;
}

.client-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

#itemsTable {
    width: 100%;
    margin-bottom: 16px;
}

#itemsTable input {
    width: 100%;
}

/* LOGIN / HERO */
.login-bg .site-main {
    padding-top: 0;
}

.login-hero {
    text-align: center;
    padding: 72px 20px 86px;
    background:
        linear-gradient(135deg, rgba(11, 99, 230, 0.96), rgba(124, 58, 237, 0.86)),
        linear-gradient(180deg, #0b63e6 0%, #15396f 100%);
    color: #fff;
    border-radius: 0 0 28px 28px;
    box-shadow: var(--shadow-md);
    margin-bottom: 0;
}

.login-hero h1 {
    font-size: clamp(2.3rem, 4vw, 3.6rem);
    font-weight: 800;
    margin-bottom: 14px;
}

.login-hero p {
    font-size: 1.08rem;
    max-width: 760px;
    margin: 0 auto;
    opacity: 0.95;
}

.login-center-box {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 340px;
    margin-top: -42px;
    padding-bottom: 20px;
}

/* FOOTER */
.site-footer {
    background: #0f172a;
    color: #c8d4e8;
    margin-top: 56px;
    padding-top: 42px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 24px;
    padding-bottom: 28px;
}

.footer-col h3,
.footer-col h4 {
    color: #fff;
    margin-bottom: 12px;
}

.footer-col p {
    color: #c8d4e8;
}

.footer-nav {
    display: grid;
    gap: 8px;
}

.footer-nav a {
    color: #d8e4f8;
}

.footer-nav a:hover {
    color: #fff;
}

.footer-bottom {
    padding: 18px 0 26px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #9fb3cf;
    font-size: 0.95rem;
}

/* COOKIE CONSENT */
.cookie-consent {
    position: fixed;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    max-width: 980px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
    padding: 22px;
}

.cookie-consent.hidden {
    display: none;
}

.cookie-consent__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-consent__text h3 {
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.cookie-consent__text p {
    color: var(--text-soft);
    max-width: 720px;
}

.cookie-consent__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cookie-open body {
    overflow-x: hidden;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .header-main {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 14px 0;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 780px) {
    .topbar-inner,
    .cookie-consent__content,
    .page-header,
    .card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-text {
        text-align: center;
    }

    .topbar-links,
    .header-actions,
    .cookie-consent__actions {
        justify-content: stretch;
    }

    .header-actions .btn,
    .cookie-consent__actions .btn {
        width: 100%;
    }

    .grid-2,
    .grid-3,
    .sums,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 22px;
    }

    .header-main {
        min-height: auto;
        padding: 14px 0;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 14px;
    }

    .brand {
        justify-content: flex-start;
        text-align: left;
    }

    .brand img {
        height: 46px;
    }

    .brand-text strong {
        font-size: 1.15rem;
    }

    .brand-text small {
        font-size: 0.8rem;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .main-nav {
        display: none;
        width: 100%;
        grid-column: 1 / -1;
        padding-top: 4px;
    }

    .main-nav.is-open {
        display: block;
    }

    .main-nav ul {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a,
    .nav-group-toggle {
        width: 100%;
        justify-content: space-between;
        text-align: left;
        padding: 0 14px;
        min-height: 48px;
        border: 1px solid var(--border);
        background: #fff;
    }

    .nav-group .dropdown {
        position: static;
        display: none;
        box-shadow: none;
        border: 0;
        padding: 6px 0 0;
        background: transparent;
        min-width: 0;
    }

    .nav-group.open .dropdown {
        display: block;
    }

    .dropdown a {
        padding-left: 24px;
        border: 1px solid #e7eef8;
        background: #f8fbff;
    }

    .header-actions {
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .header-actions .btn {
        width: 100%;
    }

    .login-hero {
        padding: 52px 16px 70px;
    }

    .cookie-consent {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 16px;
    }
}'