:root {
    --ink: #1f1e1a;
    --paper: #f8f4eb;
    --panel: #fffef9;
    --accent: #8f2f14;
    --ok: #1f7a4d;
    --bad: #a32020;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, 'Palatino Linotype', serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #ffd6bf 0%, #f8f4eb 40%, #e7ebe3 100%);
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    font-size: 0.74rem;
    color: #4f4a41;
    margin-bottom: 0.4rem;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.auth-shell {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1.2fr 1fr;
    width: min(980px, 100%);
}

.auth-info,
.auth-card,
.section-card,
.stat-card {
    background: var(--panel);
    border: 1px solid #d6c8b8;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(36, 29, 22, 0.08);
}

.auth-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-info h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.1;
}

.auth-info ul {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.45rem;
}

.auth-card {
    padding: 2rem;
}

.subtext {
    margin-top: 0.5rem;
    margin-bottom: 1.2rem;
    color: #5f584e;
}

.form-stack,
.grid-form {
    display: grid;
    gap: 0.75rem;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #ccb9a3;
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    background: #fff;
}

textarea {
    min-height: 90px;
}

.password-wrap {
    display: flex;
    gap: 0.5rem;
}

.btn-primary,
.btn-secondary,
.ghost-btn {
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    padding: 0.72rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #bc5c24 100%);
    color: #fff;
    font-weight: 700;
}

.btn-secondary {
    background: #efe5d7;
    color: #2f2b23;
    font-weight: 600;
}

.ghost-btn {
    background: #f2ece2;
    color: #463f33;
    min-width: 72px;
}

.hint {
    margin-top: 0.9rem;
    color: #6f685d;
    font-size: 0.9rem;
}

.dash-body {
    min-height: 100vh;
    padding: 1rem;
}

.dash-v2-body {
    min-height: 100vh;
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow-x: hidden;
}

.sidebar {
    background: linear-gradient(180deg, #2f2418 0%, #1f1912 100%);
    color: #f6ead9;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand-block h2 {
    font-size: 1.4rem;
}

.side-nav {
    display: grid;
    gap: 0.45rem;
}

.side-nav a {
    text-decoration: none;
    color: #f6ead9;
    padding: 0.62rem 0.7rem;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.side-nav a:hover {
    background: #3a2d1f;
    border-color: #8f6a3f;
}

.side-nav a.active {
    background: #bc5c24;
    border-color: #d58c5f;
    color: #fff;
}

.sidebar-logout {
    width: 100%;
}

.content-area {
    padding: 1rem;
    display: grid;
    gap: 1rem;
    min-width: 0;
    overflow-x: hidden;
}

.content-topbar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.mobile-menu-btn {
    display: none;
    background: #2f2418;
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
}

.sidebar-overlay {
    display: none;
}

.dash-topbar,
.dash-main {
    width: min(1200px, 100%);
    margin: 0 auto;
}

.dash-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-main {
    display: grid;
    gap: 1rem;
}

.section-card {
    padding: 1rem;
    overflow: hidden;
}

.section-copy {
    margin-top: 0.35rem;
    margin-bottom: 1rem;
    color: #5f584e;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-form.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

.inline-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.inline-checks label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #4f473c;
}

.inline-checks input[type='checkbox'] {
    width: auto;
}

.table-wrap {
    margin-top: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    display: block;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    border: 1px solid #eadbc8;
    border-radius: 10px;
    background: #fff;
}

.responsive-table {
    width: max-content;
    min-width: 760px;
    max-width: none;
}

.pagination-wrap {
    margin-top: 1rem;
}

.pagination-wrap nav {
    display: flex;
    justify-content: flex-end;
}

.pagination-wrap svg {
    width: 20px;
}

.vendor-row {
    cursor: default;
}

.vendor-row:hover {
    background: transparent;
}

.view-detail-btn {
    min-width: auto;
    padding: 0.45rem 0.7rem;
    font-size: 0.84rem;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 16, 10, 0.6);
    display: grid;
    place-items: center;
    padding: 1rem;
    z-index: 40;
}

.modal-backdrop[hidden] {
    display: none !important;
}

.vendor-modal {
    width: min(860px, 100%);
    max-height: 90vh;
    background: #fffaf2;
    border: 1px solid #d7c3aa;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
}

.vendor-modal-head {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #ebdcc8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.vendor-modal-body {
    padding: 1rem;
    overflow-y: auto;
}

.vendor-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1rem;
}

.vendor-detail-grid p {
    background: #fff;
    border: 1px solid #eadbc7;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    line-height: 1.4;
}

.vendor-detail-grid p.full-span {
    grid-column: 1 / -1;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

th,
td {
    border-bottom: 1px solid #e4d7c8;
    text-align: left;
    padding: 0.65rem;
    white-space: nowrap;
}

.stats-grid {
    margin-top: 1rem;
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    padding: 0.9rem;
}

.stat-card h4 {
    margin-bottom: 0.4rem;
}

.alert {
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
}

.alert.success {
    background: #ddf4e7;
    color: var(--ok);
    border: 1px solid #9ed3b4;
}

.alert.error {
    background: #ffe8e8;
    color: var(--bad);
    border: 1px solid #e8adad;
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100%;
        z-index: 20;
        transition: left 0.25s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        border: 0;
        background: rgba(19, 13, 8, 0.55);
        z-index: 19;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-block;
    }

    .content-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-topbar h1 {
        font-size: 1.5rem;
    }

    .section-card {
        padding: 0.85rem;
    }

    .grid-form,
    .grid-form.compact {
        grid-template-columns: 1fr;
    }

    .vendor-detail-grid {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow-x: auto;
        overflow-y: hidden;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
    }

    .responsive-table {
        min-width: 860px;
    }

    .dash-topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
