:root {
    --bg: #f5f1e8;
    --panel: #fcfaf5;
    --panel-2: #f0eadc;
    --text: #2f2a25;
    --muted: #6e655a;
    --line: #d7c9a8;

    --brass: #b8892d;
    --brass-dark: #8b6a24;
    --oxblood: #7b2323;
    --blue: #2f5f8f;
    --green: #2f6b3f;
    --red: #9f2f2f;
    --gray: #6b6258;

    --radius: 12px;
    --shadow: 0 8px 24px rgba(47, 42, 37, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(184,137,45,.14), transparent 28%),
        linear-gradient(180deg, #f8f4eb, var(--bg));
    color: var(--text);
}

.app {
    max-width: 1320px;
    margin: 24px auto;
    padding: 20px;
}

h1, h2 {
    margin-top: 0;
    color: var(--text);
}

h1 {
    text-align: left;
    font-size: 34px;
    letter-spacing: .02em;
}

h2 {
    font-size: 23px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

/* User Bar */

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: #2f2a25;
    color: #f8f4eb;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.user-bar strong {
    color: #f1c76a;
}

/* Navigation */

.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
}

.nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 8px;
}

.nav a:hover {
    background: var(--panel-2);
}

.nav a.active {
    background: linear-gradient(180deg, var(--brass), var(--brass-dark));
    color: white;
}

/* Cards */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

/* Layout */

.dashboard-grid,
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-two-column {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 22px;
}

/* Metrics */

.metric-card {
    background: linear-gradient(180deg, #fffdf8, #f3ead8);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}

.metric-label {
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--brass-dark);
}

/* Forms */

label {
    display: block;
    font-weight: 700;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fffefb;
    color: var(--text);
    font-size: 16px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(184,137,45,.22);
}

.sale-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
    align-items: end;
}

.form-actions,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Buttons */

button,
.button,
.button-link {
    border: none;
    background: linear-gradient(180deg, var(--brass), var(--brass-dark));
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    font-size: 15px;
}

button:hover,
.button:hover,
.button-link:hover {
    filter: brightness(.96);
}

button.secondary,
.button.secondary {
    background: var(--gray);
}

button.danger,
.danger,
.btn-void {
    background: var(--red);
}

.btn-edit {
    background: var(--blue);
}

.btn-refund {
    background: var(--brass-dark);
}

.sale-actions a {
    display: inline-flex;
    margin-right: 5px;
    padding: 7px 11px;
    border-radius: 7px;
    color: white;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #fffefb;
    border-radius: var(--radius);
    overflow: hidden;
}

thead {
    background: #efe4cf;
}

th,
td {
    padding: 13px;
    border-bottom: 1px solid #e5dcc8;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

tbody tr:hover {
    background: #faf4e8;
}

/* Status */

[class^="status-"] {
    font-weight: 800;
}

.status-active,
.status-available,
.status-received {
    color: var(--green);
}

.status-sold,
.status-voided,
.status-suspended {
    color: var(--red);
}

.status-hold,
.status-returned,
.status-refunded,
.status-paid_out {
    color: var(--brass-dark);
}

/* Search dropdowns */

.vendor-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fffefb;
    border: 1px solid var(--line);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 9999;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.vendor-result {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #eee2cc;
}

.vendor-result:hover,
.vendor-result.selected {
    background: #f3ead8;
}

.vendor-name {
    font-weight: 800;
}

.vendor-business {
    color: var(--muted);
    font-size: 14px;
}

/* Totals */

.totals {
    margin-top: 20px;
    max-width: 420px;
    margin-left: auto;
}

.totals p {
    display: flex;
    justify-content: space-between;
    margin: 9px 0;
}

.totals .grand,
.grand {
    font-size: 24px;
    font-weight: 900;
    border-top: 2px solid var(--line);
    padding-top: 10px;
}

/* Messages */

.error {
    color: var(--red);
    font-weight: 800;
}

.success {
    color: var(--green);
    font-weight: 800;
}

/* Admin Tools */

.admin-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.admin-tools-grid .button-link {
    display: flex;
    padding: 16px;
}

/* Receipt */

.receipt {
    max-width: 460px;
    margin: 0 auto;
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.receipt h1,
.receipt p {
    text-align: center;
}

.receipt-actions {
    text-align: center;
    margin-top: 20px;
}

/* Theme action buttons */

.btn-edit,
.btn-view,
.sale-actions .btn-edit,
.sale-actions .btn-view,
td .btn-edit,
td .btn-view {
    background: linear-gradient(180deg, var(--brass), var(--brass-dark));
    color: #fff !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    border: none;
    cursor: pointer;
}

.btn-edit:hover,
.btn-view:hover {
    filter: brightness(.95);
    text-decoration: none;
}

td a.btn-edit,
td a.btn-view {
    color: #fff !important;
}

/* Responsive */

@media (max-width: 900px) {
    .dashboard-two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app {
        margin: 0;
        padding: 12px;
    }

    .user-bar {
        flex-direction: column;
        text-align: center;
    }

    .nav {
        flex-direction: column;
    }

    .nav a {
        text-align: center;
    }

    .form-actions,
    .actions {
        flex-direction: column;
    }

    button,
    .button,
    .button-link {
        width: 100%;
    }

    .admin-tools-grid {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Print */

@media print {
    .nav,
    .user-bar,
    .receipt-actions,
    .actions {
        display: none !important;
    }

    body {
        background: white;
    }

    .app {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: none;
    }
}
/* Super admin and authentication additions */

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

.auth-card {
    width: min(520px, 100%);
    margin: 0;
}

.auth-heading {
    margin-bottom: 22px;
}

.auth-heading h1 {
    margin-bottom: 8px;
}

.auth-heading p {
    margin: 0;
    color: var(--muted);
}

.platform-kicker {
    color: var(--brass-dark);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.message-box {
    padding: 13px 15px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
}

.success-box {
    color: #235b32;
    background: #e8f4eb;
    border-color: #a8c9b0;
}

.error-box {
    color: #7d2020;
    background: #f8e8e8;
    border-color: #d6a3a3;
}

.warning-box {
    color: #6b4d12;
    background: #fff4d8;
    border-color: #d9bc72;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.status-badge.status-active {
    color: #235b32;
    background: #e5f2e8;
    border: 1px solid #a9c9b0;
}

.status-badge.status-trial {
    color: #6b4d12;
    background: #fff1cc;
    border: 1px solid #d9ba68;
}

.status-badge.status-suspended {
    color: #7d2020;
    background: #f7e4e4;
    border: 1px solid #d4a0a0;
}

.section-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading-row h2 {
    margin-bottom: 6px;
}

.section-heading-row p {
    margin: 0;
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 22px;
}

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

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

.full-width-field {
    grid-column: 1 / -1;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) auto;
    gap: 16px;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.compact-card {
    max-width: 760px;
}

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

.detail-list div {
    padding: 13px 15px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.detail-list dd {
    margin: 5px 0 0;
    font-weight: 800;
}

.inline-form {
    display: inline-flex;
    margin: 0 0 0 5px;
    vertical-align: middle;
}

.inline-form button {
    padding: 8px 12px;
    font-size: 13px;
}

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

@media (max-width: 900px) {
    .three-column-form,
    .two-column-form,
    .equal-columns,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .section-heading-row {
        flex-direction: column;
    }

    .section-heading-row .button,
    .section-heading-row .button-link {
        width: 100%;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .inline-form {
        display: flex;
        margin: 8px 0 0;
    }
}


/* Signed-in application footer */

.app-legal-footer {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    margin-top: 30px;
    padding: 18px 22px;
    overflow: hidden;
    border: 1px solid rgba(184, 137, 45, 0.58);
    border-radius: var(--radius);
    background:
        radial-gradient(
            circle at top center,
            rgba(241, 199, 106, 0.12),
            transparent 42%
        ),
        linear-gradient(135deg, #39322b, #24201c);
    color: #e9e1d5;
    box-shadow: var(--shadow);
    font-size: 13px;
}

.app-legal-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--brass),
        transparent
    );
}

.app-legal-footer > span {
    color: #f8f4eb;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.app-legal-footer nav {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(241, 199, 106, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.app-legal-footer a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    color: #f1c76a;
    font-weight: 800;
    text-decoration: none;
    transition:
        background 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.app-legal-footer a:hover {
    background: rgba(241, 199, 106, 0.13);
    color: #fff4d6;
    text-decoration: none;
    transform: translateY(-1px);
}

.app-legal-footer a:focus-visible {
    outline: 2px solid #f1c76a;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .app-legal-footer {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 12px;
        padding: 18px 14px;
        text-align: center;
    }

    .app-legal-footer nav {
        grid-column: 1;
        justify-self: center;
        max-width: 100%;
        flex-wrap: wrap;
        border-radius: 12px;
    }
}

/* Six-card summary rows */

.six-card-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.six-card-summary-grid .metric-card {
    min-width: 0;
    padding: 18px 14px;
}

.six-card-summary-grid .metric-label {
    min-height: 36px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.3;
}

.six-card-summary-grid .metric-value {
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .six-card-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .six-card-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .six-card-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Vendor Dashboard navigation-style link */

.vendor-navbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 18px;
    border: 1px solid var(--brass-dark);
    border-radius: 8px;
    background: var(--brass);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(47, 42, 37, 0.12);
}

.vendor-navbar-link:hover {
    border-color: var(--brass-dark);
    background: var(--brass-dark);
    color: #ffffff;
    filter: none;
}

.vendor-navbar-link:focus-visible {
    outline: 2px solid var(--brass-dark);
    outline-offset: 3px;
}

/* Vendor Dashboard heading alignment */

.vendor-dashboard-heading-card {
    text-align: right;
}

.vendor-dashboard-heading-card h2 {
    text-align: right;
}

.vendor-dashboard-heading-card .actions {
    justify-content: flex-end;
}
