[x-cloak] { display: none !important; }

:root {
    --ink: #241c16;
    --paper: #f3eee4;
    --copper: #b85c38;
    --sage: #3f5d4a;
}

body {
    background-image:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.08), transparent 28%),
        linear-gradient(#f3eee4, #efe8db);
}

.sidebar {
    background: #1c1612;
    min-height: 100vh;
}

.nav-link {
    display: block;
    border-radius: 14px;
    padding: 0.7rem 0.9rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(184, 92, 56, 0.22);
    color: #fff;
}

.card {
    background: #fffaf3;
    border: 1px solid rgba(36, 28, 22, 0.08);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(36, 28, 22, 0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--copper);
    color: white;
}

.btn-ghost {
    background: transparent;
    border-color: rgba(36, 28, 22, 0.12);
}

.btn-danger {
    background: #8f2d2d;
    color: white;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field span,
.label {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(36, 28, 22, 0.5);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
    width: 100%;
    border: 1px solid rgba(36, 28, 22, 0.12);
    background: #fff;
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
    color: var(--ink);
    outline: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus,
textarea:focus {
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(184, 92, 56, 0.12);
}

.remember {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: fit-content;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(36, 28, 22, 0.72);
    user-select: none;
}

.remember input[type="checkbox"] {
    appearance: none;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    flex: 0 0 1.05rem;
    border: 1.5px solid rgba(36, 28, 22, 0.22);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-content: center;
}

.remember input[type="checkbox"]:checked {
    background: var(--copper);
    border-color: var(--copper);
}

.remember input[type="checkbox"]:checked::after {
    content: "";
    width: 0.28rem;
    height: 0.5rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.remember input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(184, 92, 56, 0.18);
}

.field.is-invalid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field.is-invalid select,
.field.is-invalid textarea,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #8f2d2d;
    background: #fff6f4;
    box-shadow: 0 0 0 3px rgba(143, 45, 45, 0.12);
}

.req {
    color: var(--copper);
    font-style: normal;
    margin-left: 0.15rem;
}

.field-error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #8f2d2d;
    font-size: 0.8rem;
    font-style: normal;
    line-height: 1.35;
}

.field-error::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: #8f2d2d;
    flex: 0 0 0.4rem;
}

.validation-summary {
    margin-bottom: 1.25rem;
    border-radius: 18px;
    background: #f8e6e1;
    border: 1px solid rgba(143, 45, 45, 0.18);
    padding: 0.95rem 1.1rem;
    color: #6f2424;
}

.validation-summary strong {
    display: block;
    font-size: 0.95rem;
}

.validation-summary ul {
    margin: 0.55rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    display: grid;
    gap: 0.25rem;
}

.is-invalid-row {
    box-shadow: inset 0 0 0 1px rgba(143, 45, 45, 0.25);
}

.field small {
    font-size: 0.75rem;
    color: rgba(36, 28, 22, 0.45);
}

textarea {
    resize: vertical;
    min-height: 4.6rem;
    line-height: 1.45;
}

.data-table {
    width: 100%;
    text-align: left;
    font-size: 0.92rem;
}

.data-table th {
    padding: 0.85rem 1.1rem;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(36, 28, 22, 0.45);
}

.data-table td {
    padding: 0.95rem 1.1rem;
    border-top: 1px solid rgba(36, 28, 22, 0.06);
}

.data-table tbody tr:hover:not(:has(.empty)) td {
    background: rgba(184, 92, 56, 0.045);
}

.data-table a:not(.btn) {
    color: var(--copper);
    font-weight: 600;
}

.muted {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: rgba(36, 28, 22, 0.45);
}

.text-danger {
    color: #8f2d2d;
}

.table-action {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(36, 28, 22, 0.55) !important;
}

button.table-action {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.table-action:hover {
    color: var(--copper) !important;
}

.empty {
    text-align: center;
    color: rgba(36, 28, 22, 0.45);
    padding: 2rem 1rem !important;
}

.stat-card {
    background: #fffaf3;
    border-radius: 24px;
    padding: 1.25rem 1.4rem;
    border: 1px solid rgba(36, 28, 22, 0.08);
}

.stat-card p {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(36, 28, 22, 0.45);
}

.stat-card strong {
    display: block;
    margin-top: 0.55rem;
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.8rem;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-neutral { background: #efe6d6; }
.badge-info { background: #dce8f4; }
.badge-success { background: #d7eadc; color: var(--sage); }
.badge-danger { background: #f3d6d0; color: #8f2d2d; }
.badge-warning { background: #f3e6c8; color: #7a5a1e; }
.badge-muted { background: #ece7e0; color: #6d645b; }

.flash {
    margin-bottom: 1.25rem;
    border-radius: 18px;
    background: #d7eadc;
    padding: 0.85rem 1rem;
}

.flash-danger {
    background: #f3d6d0;
}

.invoice-sheet {
    background: #fffaf3;
    border-radius: 28px;
    padding: 2rem;
    border: 1px solid rgba(36, 28, 22, 0.08);
}

.totals {
    display: grid;
    gap: 0.45rem;
    font-size: 0.92rem;
}

.totals div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.totals-grand {
    border-top: 1px solid rgba(36, 28, 22, 0.1);
    padding-top: 0.6rem;
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.3rem;
}

.mobile-nav {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.75rem 1rem 0;
}

.mobile-nav a {
    white-space: nowrap;
    font-size: 0.85rem;
    color: rgba(36, 28, 22, 0.55);
}

.mobile-nav a.is-active {
    color: var(--copper);
    font-weight: 700;
}

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.list-meta {
    font-size: 0.92rem;
    color: rgba(36, 28, 22, 0.55);
}

.list-search {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: min(100%, 22rem);
}

.list-search input {
    max-width: 28rem;
    flex: 1;
}

.filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.5rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: #fffaf3;
    border: 1px solid rgba(36, 28, 22, 0.12);
    color: var(--ink);
    cursor: pointer;
}

.filter-trigger svg {
    width: 1.05rem;
    height: 1.05rem;
}

.filter-trigger:hover,
.filter-trigger.has-filters {
    border-color: rgba(184, 92, 56, 0.4);
    color: var(--copper);
}

.filter-badge {
    display: inline-flex;
    min-width: 1.2rem;
    height: 1.2rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 0.35rem;
    background: var(--copper);
    color: #fff;
    font-size: 0.7rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: -0.25rem 0 1.1rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(184, 92, 56, 0.1);
    color: var(--copper);
}

.filter-chip::after {
    content: "×";
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.7;
}

.filter-chip:hover {
    background: rgba(184, 92, 56, 0.18);
}

body.filter-open {
    overflow: hidden;
}

.filter-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(28, 22, 18, 0.42);
}

.filter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 50;
    display: flex;
    width: min(100%, 24rem);
    height: 100vh;
    background: #fffaf3;
    box-shadow: -18px 0 48px rgba(36, 28, 22, 0.16);
}

.filter-drawer-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.filter-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.3rem 1rem;
    border-bottom: 1px solid rgba(36, 28, 22, 0.08);
}

.filter-close {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    border: 1px solid rgba(36, 28, 22, 0.1);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.filter-close svg {
    width: 1.05rem;
    height: 1.05rem;
}

.filter-close:hover {
    border-color: var(--copper);
    color: var(--copper);
}

.filter-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 1.15rem;
    padding: 1.2rem 1.3rem;
}

.filter-drawer-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.3rem 1.2rem;
    border-top: 1px solid rgba(36, 28, 22, 0.08);
    background: #fffaf3;
}

.filter-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.filter-options {
    display: grid;
    gap: 0.35rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.58rem 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(36, 28, 22, 0.08);
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.filter-option input {
    width: 1rem;
    accent-color: var(--copper);
}

.filter-option em {
    margin-left: auto;
    font-style: normal;
    font-size: 0.75rem;
    color: rgba(36, 28, 22, 0.45);
}

.filter-option:has(input:checked) {
    border-color: var(--copper);
    background: rgba(184, 92, 56, 0.08);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.15rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fffaf3;
    border: 1px solid rgba(36, 28, 22, 0.08);
    color: rgba(36, 28, 22, 0.68);
}

.filter-pill:hover {
    border-color: rgba(184, 92, 56, 0.35);
    color: var(--ink);
}

.filter-pill.is-active {
    background: var(--copper);
    border-color: var(--copper);
    color: #fff;
}

.filter-pill em {
    font-style: normal;
    font-size: 0.72rem;
    min-width: 1.35rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    text-align: center;
    background: rgba(36, 28, 22, 0.08);
}

.filter-pill.is-active em {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.list-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    border-top: 1px solid rgba(36, 28, 22, 0.06);
    color: rgba(36, 28, 22, 0.5);
    font-size: 0.85rem;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.pager-btn {
    display: inline-flex;
    min-width: 2.2rem;
    height: 2.2rem;
    align-items: center;
    justify-content: center;
    padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    background: #fff;
    border: 1px solid rgba(36, 28, 22, 0.1);
}

a.pager-btn:hover {
    border-color: var(--copper);
    color: var(--copper);
}

.pager-btn.is-current {
    background: var(--copper);
    border-color: var(--copper);
    color: #fff;
}

.pager-btn.is-disabled {
    opacity: 0.38;
    cursor: not-allowed;
    background: transparent;
}

.pager-ellipsis {
    min-width: 1.4rem;
    text-align: center;
    color: rgba(36, 28, 22, 0.4);
}

@media (min-width: 1024px) {
    .mobile-nav { display: none; }
}
