:root {
    --bg: #f5efe4;
    --bg-strong: #efe2cf;
    --panel: rgba(255, 250, 242, 0.92);
    --panel-strong: #fff8ee;
    --ink: #1d1a17;
    --muted: #6f675e;
    --accent: #b4572d;
    --accent-dark: #8f431f;
    --line: rgba(29, 26, 23, 0.1);
    --success: #1f7a57;
    --warning: #b9770e;
    --danger: #b63d2f;
    --shadow: 0 18px 40px rgba(95, 65, 40, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(180, 87, 45, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(31, 122, 87, 0.12), transparent 24%),
        linear-gradient(180deg, #fffaf2 0%, var(--bg) 100%);
    min-height: 100vh;
}

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

.shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 28px;
    background: rgba(28, 24, 21, 0.92);
    color: #f6ede0;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand h1,
.page-header h2,
.stat-card strong,
.section-header h3,
.auth-card h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.02em;
}

.brand p,
.sidebar-meta,
.meta-subvalue,
.muted,
th,
.eyebrow,
.brand-kicker {
    color: rgba(246, 237, 224, 0.74);
}

.brand-kicker,
.eyebrow {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 700;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(246, 237, 224, 0.86);
    transition: 0.2s ease;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 248, 238, 0.14);
    color: #fff8ee;
}

.sidebar-meta {
    margin-top: auto;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    line-height: 1.6;
}

.meta-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.meta-value {
    font-weight: 700;
    color: #fff5e6;
}

.content {
    padding: 20px;
}

.page-header,
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.header-time,
.pill,
.status-badge,
.mode-badge,
.metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

.header-time,
.pill,
.metric-badge {
    background: rgba(255, 248, 238, 0.8);
    border: 1px solid var(--line);
}

.grid {
    display: grid;
    gap: 14px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 24px;
}

.stat-card,
.panel,
.table-wrap,
.auth-card {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
}

.panel,
.table-wrap {
    padding: 16px;
}

.split-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
}

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

th,
td {
    padding: 14px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(29, 26, 23, 0.08);
    vertical-align: top;
}

th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.label-stack {
    display: grid;
    gap: 4px;
}

.small {
    font-size: 0.76rem;
    color: var(--muted);
}

.status-badge.active {
    background: rgba(31, 122, 87, 0.14);
    color: var(--success);
}

.status-badge.offline {
    background: rgba(182, 61, 47, 0.12);
    color: var(--danger);
}

.mode-badge.online {
    background: rgba(180, 87, 45, 0.14);
    color: var(--accent);
}

.mode-badge.office {
    background: rgba(25, 93, 142, 0.12);
    color: #195d8e;
}

.status-badge.draft,
.status-badge.sent,
.status-badge.paid,
.status-badge.overdue {
    background: rgba(29, 26, 23, 0.08);
    color: var(--ink);
}

.status-badge.paid {
    background: rgba(31, 122, 87, 0.14);
    color: var(--success);
}

.status-badge.overdue {
    background: rgba(182, 61, 47, 0.12);
    color: var(--danger);
}

.status-badge.sent {
    background: rgba(185, 119, 14, 0.14);
    color: var(--warning);
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.74rem;
    font-weight: 700;
}

.activity-badge.active {
    background: rgba(31, 122, 87, 0.18);
    color: #15563d;
}

.activity-badge.passive {
    background: rgba(185, 119, 14, 0.18);
    color: #8f5d09;
}

.activity-badge.idle {
    background: rgba(182, 61, 47, 0.18);
    color: #962f23;
}

form {
    margin: 0;
}

.filters,
.form-grid,
.invoice-items {
    display: grid;
    gap: 10px;
}

.filters {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}

.pagination-summary {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 0.78rem;
}

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

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

.field {
    display: grid;
    gap: 8px;
}

label {
    font-size: 0.78rem;
    font-weight: 600;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(29, 26, 23, 0.14);
    padding: 10px 12px;
    font: inherit;
    color: inherit;
    background: rgba(255, 255, 255, 0.92);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    cursor: pointer;
    background: var(--accent);
    color: #fff8ee;
    font-weight: 700;
    border: none;
    transition: 0.2s ease;
}

button:hover {
    background: var(--accent-dark);
}

.button-secondary {
    background: rgba(29, 26, 23, 0.08);
    color: var(--ink);
}

.button-secondary:hover {
    background: rgba(29, 26, 23, 0.14);
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-form select,
.inline-form button {
    width: auto;
}

.developer-card-grid,
.screenshot-grid,
.card-grid {
    display: grid;
    gap: 12px;
}

.developer-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.developer-card,
.screenshot-card,
.mini-card {
    background: var(--panel-strong);
    border: 1px solid rgba(29, 26, 23, 0.08);
    border-radius: 18px;
    padding: 12px;
}

.developer-card-header,
.screenshot-meta-row,
.invoice-item-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
}

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

.screenshot-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    background: #eadcc9;
    border: 1px solid rgba(29, 26, 23, 0.08);
}

.screenshot-trigger {
    padding: 0;
    border: 0;
    background: transparent;
    display: block;
}

.screenshot-trigger img {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lazy-image {
    background:
        linear-gradient(110deg, rgba(234, 220, 201, 0.9) 8%, rgba(255, 248, 238, 0.95) 18%, rgba(234, 220, 201, 0.9) 33%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.screenshot-trigger:hover img {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(29, 26, 23, 0.14);
}

.screenshot-details {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.screenshot-card strong {
    font-size: 0.82rem;
}

.screenshot-card .screenshot-meta-row {
    flex-wrap: wrap;
}

.screenshot-card .pill,
.screenshot-card .status-badge,
.screenshot-card .activity-badge {
    font-size: 0.68rem;
    padding: 4px 8px;
}

.screenshot-card .label-stack > div:not(.small) {
    font-size: 0.78rem;
    line-height: 1.25;
}

.date-group {
    display: grid;
    gap: 16px;
    margin-bottom: 26px;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(29, 26, 23, 0.08);
}

.alert.success {
    background: rgba(31, 122, 87, 0.1);
    color: var(--success);
}

.alert.error {
    background: rgba(182, 61, 47, 0.1);
    color: var(--danger);
}

.alert.info {
    background: rgba(25, 93, 142, 0.1);
    color: #195d8e;
}

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

.auth-card {
    width: min(480px, 100%);
    padding: 28px;
}

.compact {
    color: var(--ink);
}

.compact .brand-kicker,
.compact p {
    color: var(--muted);
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    border: 1px dashed rgba(29, 26, 23, 0.14);
}

.footer-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.92rem;
}

.pagination-panel {
    margin-top: 18px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255, 248, 238, 0.86);
    border: 1px solid var(--line);
    font-weight: 700;
    transition: 0.18s ease;
}

.pagination-link:hover {
    transform: translateY(-1px);
    background: #fff8ee;
}

.pagination-link.active {
    background: var(--accent);
    color: #fff8ee;
    border-color: transparent;
}

.pagination-link.disabled {
    opacity: 0.45;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox[hidden] {
    display: none;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 16, 15, 0.78);
    backdrop-filter: blur(4px);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1240px);
    height: min(88vh, 900px);
    margin: 4vh auto;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
}

.lightbox-figure {
    margin: 0;
    background: rgba(255, 250, 242, 0.98);
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.lightbox-figure img {
    width: 100%;
    height: min(72vh, 760px);
    object-fit: contain;
    border-radius: 18px;
    background: #eadcc9;
}

.lightbox-caption {
    display: grid;
    gap: 6px;
    padding-top: 14px;
}

.lightbox-caption span {
    color: var(--muted);
}

.lightbox-close,
.lightbox-nav {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    padding: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 250, 242, 0.92);
    color: var(--ink);
    font-size: 2rem;
    line-height: 1;
}

.lightbox-close {
    position: absolute;
    top: -18px;
    right: 0;
    z-index: 2;
}

.lightbox-nav {
    justify-self: center;
}

@media (max-width: 1200px) {
    .screenshot-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .screenshot-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .shell,
    .split-grid,
    .form-grid.two,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 20px;
    }
}

@media (max-width: 720px) {
    .content,
    .sidebar,
    .auth-card {
        padding: 20px;
    }

    .page-header,
    .section-header,
    .developer-card-header,
    .screenshot-meta-row,
    .invoice-item-row,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

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

    .pagination-summary {
        flex-direction: column;
    }

    .lightbox-dialog {
        width: 94vw;
        height: auto;
        margin: 3vh auto;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lightbox-nav {
        position: static;
        width: 100%;
        height: 46px;
        font-size: 1.5rem;
    }

    .lightbox-figure img {
        height: min(62vh, 520px);
    }
}

@media (max-width: 720px) {
    .screenshot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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