:root {
    --bg: #f5efe4;
    --bg-strong: #f0e3d2;
    --panel: rgba(255, 251, 245, 0.88);
    --panel-strong: #fffaf2;
    --panel-soft: #f5e8d7;
    --text: #1d1b19;
    --muted: #655b51;
    --line: rgba(111, 93, 72, 0.18);
    --primary: #b74b2a;
    --primary-deep: #91351b;
    --accent: #166c63;
    --danger: #ae2e24;
    --success: #1c7b57;
    --shadow: 0 28px 60px rgba(71, 44, 16, 0.12);
    --shadow-soft: 0 16px 30px rgba(71, 44, 16, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 215, 173, 0.7), transparent 28%),
        linear-gradient(180deg, #f8f0e3 0%, #f6efe8 40%, #efe6d8 100%);
    min-height: 100vh;
}

.page-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.page-backdrop-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(10px);
    opacity: 0.8;
}

.orb-one {
    width: 320px;
    height: 320px;
    top: -80px;
    right: -40px;
    background: rgba(183, 75, 42, 0.18);
}

.orb-two {
    width: 420px;
    height: 420px;
    left: -120px;
    bottom: -140px;
    background: rgba(22, 108, 99, 0.14);
}

.page-backdrop-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(122, 98, 68, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(122, 98, 68, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell,
.auth-shell {
    position: relative;
    z-index: 1;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 26px;
    min-height: 100vh;
    padding: 28px 22px;
    background:
        linear-gradient(180deg, rgba(39, 28, 20, 0.98), rgba(57, 38, 24, 0.94)),
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.24), transparent 32%);
    color: #f7ebdf;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #f28b50);
    color: #fff8f1;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    letter-spacing: 0.08em;
    box-shadow: 0 18px 32px rgba(183, 75, 42, 0.28);
}

.brand h2,
.topbar h1,
.card h2,
.login-card h2 {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.03em;
}

.brand h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}

.brand span {
    color: rgba(247, 235, 223, 0.68);
    font-size: 0.92rem;
}

.nav-links {
    display: grid;
    gap: 8px;
}

.nav-section {
    margin-top: 14px;
    padding: 0 14px;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(247, 235, 223, 0.5);
}

.nav-links a {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    color: rgba(255, 245, 236, 0.86);
    transition: 0.22s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255, 245, 236, 0.1);
    color: #fffaf5;
    transform: translateX(3px);
}

.nav-links a.active {
    box-shadow: inset 0 0 0 1px rgba(255, 245, 236, 0.08);
}

.nav-logout {
    margin-top: 12px;
    color: #ffcfbd !important;
}

.main-content,
.auth-main {
    padding: 28px 30px 34px;
}

.page-body {
    display: grid;
    gap: 22px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px 28px;
    background: rgba(255, 250, 243, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.56);
    border-radius: 26px;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(183, 75, 42, 0.12);
    color: var(--primary-deep);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1;
}

.topbar p {
    max-width: 640px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #fffdf9, #f5ebde);
    border: 1px solid rgba(162, 124, 88, 0.16);
}

.topbar-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #2aa398);
    color: #f7fffd;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

.topbar-user strong {
    display: block;
}

.topbar-user span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    text-transform: capitalize;
    font-size: 0.92rem;
}

.mobile-nav-toggle,
.mobile-nav-overlay {
    display: none;
}

.alert {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

.alert-success {
    background: rgba(28, 123, 87, 0.12);
    border-color: rgba(28, 123, 87, 0.18);
    color: var(--success);
}

.alert-danger {
    background: rgba(174, 46, 36, 0.11);
    border-color: rgba(174, 46, 36, 0.14);
    color: var(--danger);
}

.stats-grid,
.content-grid {
    display: grid;
    gap: 20px;
}

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

.stats-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.card,
.stat-card,
.login-card {
    position: relative;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.auth-layout {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
    gap: 24px;
    align-items: stretch;
}

.auth-panel {
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-panel-brand {
    padding: 34px;
    background:
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.16), transparent 30%),
        radial-gradient(circle at bottom left, rgba(22, 108, 99, 0.14), transparent 34%),
        linear-gradient(160deg, rgba(44, 30, 20, 0.94), rgba(69, 43, 27, 0.96));
    color: #fff5ec;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.auth-kicker {
    display: inline-flex;
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255, 244, 232, 0.12);
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-panel-brand h1 {
    margin: 0;
    max-width: 10ch;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2.5rem, 5vw, 4.25rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.auth-panel-brand p {
    max-width: 52ch;
    margin: 0;
    color: rgba(255, 245, 236, 0.8);
    font-size: 1.03rem;
    line-height: 1.7;
}

.auth-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.auth-feature-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 245, 236, 0.08);
    border: 1px solid rgba(255, 245, 236, 0.1);
}

.auth-feature-card strong,
.auth-trust-row strong {
    font-family: "Space Grotesk", sans-serif;
}

.auth-feature-card span,
.auth-trust-row span {
    color: rgba(255, 245, 236, 0.75);
    line-height: 1.55;
}

.auth-trust-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding-top: 6px;
}

.auth-trust-row strong {
    display: block;
    margin-bottom: 6px;
}

.card {
    padding: 24px;
}

.stat-card {
    padding: 24px 24px 22px;
    background:
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(250, 241, 229, 0.92));
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto 18px 0 auto;
    width: 84px;
    height: 84px;
    border-radius: 24px;
    background: rgba(183, 75, 42, 0.08);
    transform: rotate(18deg) translateY(30%);
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-size: 0.92rem;
}

.stat-card strong {
    position: relative;
    display: block;
    margin-top: 14px;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 0.95;
}

.stat-card small {
    position: relative;
    display: inline-flex;
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.5;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.card h2,
.login-card h2 {
    margin: 0;
    font-size: 1.35rem;
}

.section-note {
    margin: -8px 0 18px;
    color: var(--muted);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full,
.details-grid .full,
.form-actions {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.92);
    color: var(--text);
    transition: 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(183, 75, 42, 0.55);
    box-shadow: 0 0 0 4px rgba(183, 75, 42, 0.12);
}

textarea {
    resize: vertical;
}

.invoice-header,
.summary-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.invoice-items {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.invoice-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(177, 137, 92, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.94), rgba(247, 238, 224, 0.94));
}

.row-remove {
    justify-content: flex-end;
}

.summary-box {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #fbf4ea, #f4e5d5);
    border: 1px solid rgba(164, 133, 100, 0.18);
}

.summary-box div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-box strong {
    font-family: "Space Grotesk", sans-serif;
}

.filter-bar,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #d76e43);
    color: #fff9f3;
    box-shadow: 0 14px 24px rgba(183, 75, 42, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-deep), var(--primary));
}

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

.btn-light {
    background: rgba(245, 233, 214, 0.86);
    color: var(--text);
    border: 1px solid rgba(160, 128, 93, 0.16);
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(183, 75, 42, 0.26);
    outline-offset: 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

thead,
tbody,
tr {
    width: 100%;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid rgba(109, 88, 65, 0.12);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: rgba(255, 247, 235, 0.64);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.details-grid div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 251, 245, 0.78);
    border: 1px solid rgba(162, 131, 98, 0.14);
}

.details-grid strong {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-card {
    width: min(540px, 100%);
    padding: 34px;
    background:
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(249, 239, 226, 0.94));
}

.auth-form {
    margin-top: 24px;
}

.login-card p {
    margin: 10px 0 0;
    color: var(--muted);
}

.auth-main {
    width: min(560px, 100%);
}

.auth-help {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(145, 107, 73, 0.14);
    color: var(--muted);
}

.auth-help strong {
    color: var(--text);
    font-family: "Space Grotesk", sans-serif;
}

.dashboard-alert {
    margin-bottom: -4px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 18px;
}

.dashboard-hero-copy,
.dashboard-hero-panel {
    padding: 28px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.62);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.dashboard-hero-copy {
    background:
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.16), transparent 34%),
        linear-gradient(135deg, rgba(255, 251, 245, 0.95), rgba(248, 239, 226, 0.92));
}

.dashboard-hero-copy h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.dashboard-hero-copy p {
    max-width: 56ch;
    margin: 14px 0 22px;
    color: var(--muted);
    line-height: 1.7;
}

.dashboard-hero-panel {
    display: grid;
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(40, 28, 19, 0.95), rgba(68, 42, 24, 0.94)),
        radial-gradient(circle at top right, rgba(183, 75, 42, 0.24), transparent 34%);
    color: #fff4e8;
}

.dashboard-hero-meter {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 244, 232, 0.09);
    border: 1px solid rgba(255, 244, 232, 0.11);
}

.dashboard-hero-meter.is-soft {
    background: rgba(22, 108, 99, 0.12);
}

.dashboard-hero-meter span,
.dashboard-hero-meter small {
    display: block;
    color: rgba(255, 244, 232, 0.78);
}

.dashboard-hero-meter strong {
    display: block;
    margin: 10px 0 6px;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 0.95;
}

.dashboard-metrics {
    margin-top: 2px;
}

.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    display: grid;
    gap: 12px;
    width: min(360px, calc(100vw - 24px));
}

.alert.is-toast {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 12px;
    animation: slideToast 0.28s ease;
}

.toast-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 12px;
    background: rgba(29, 27, 25, 0.08);
    color: inherit;
    cursor: pointer;
}

.toast-close:hover {
    background: rgba(29, 27, 25, 0.14);
}

.mobile-nav-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.mobile-nav-toggle.is-open .mobile-nav-toggle-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-nav-toggle.is-open .mobile-nav-toggle-line:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-open .mobile-nav-toggle-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.confirm-modal.is-open {
    display: flex;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(23, 17, 12, 0.56);
    backdrop-filter: blur(8px);
}

.confirm-modal-card {
    position: relative;
    width: min(480px, 100%);
    padding: 24px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(247, 236, 221, 0.98));
    box-shadow: 0 30px 70px rgba(31, 21, 14, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.confirm-modal-card h3 {
    margin: 0 0 10px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.5rem;
}

.confirm-modal-card p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.65;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    animation: fadeLift 0.5s ease forwards;
}

[data-reveal="2"] { animation-delay: 0.06s; }
[data-reveal="3"] { animation-delay: 0.12s; }
[data-reveal="4"] { animation-delay: 0.18s; }
[data-reveal="5"] { animation-delay: 0.24s; }

@keyframes slideToast {
    from {
        opacity: 0;
        transform: translateY(-8px) translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

@keyframes fadeLift {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
}

@media print {
    .page-backdrop,
    .sidebar,
    .topbar,
    .btn,
    form,
    .alert,
    .mobile-nav-toggle,
    .mobile-nav-overlay,
    .toast-stack,
    .confirm-modal {
        display: none !important;
    }

    .app-shell,
    .content-grid,
    .stats-grid,
    .main-content,
    .page-body {
        display: block;
        padding: 0;
        gap: 0;
    }

    body {
        background: #fff;
    }

    .card,
    .stat-card {
        box-shadow: none;
        border: 0;
        background: #fff;
        padding: 0;
        margin-bottom: 20px;
    }
}
