:root {
    --color-bg: #fdf3ec;
    --color-primary: #c8577a;
    --color-primary-dark: #a8405f;
    --color-accent: #e8a33d;
    --color-text: #3a2e2c;
    --color-text-soft: #7a6a66;
    --color-white: #ffffff;
    --color-success: #2e9e5b;
    --color-danger: #d64545;
    --shadow-soft: 0 10px 30px rgba(58, 46, 44, 0.10);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --font-main: 'Quicksand', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
}

a { text-decoration: none; }

button {
    font-family: var(--font-main);
    cursor: pointer;
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-weight: 700;
    font-size: 15px;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 8px 18px rgba(200, 87, 122, 0.35);
}

.btn-primary:hover { background: var(--color-primary-dark); }

.btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-soft);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-white);
    padding: 16px 28px;
    box-shadow: var(--shadow-soft);
}

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

.topbar .brand img {
    height: 38px;
    width: auto;
}

.topbar .brand span {
    font-weight: 800;
    font-size: 19px;
    color: var(--color-primary);
}

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-soft);
    font-weight: 600;
    font-size: 14px;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 14px;
}

.table-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    overflow-x: auto;
    margin-bottom: 24px;
}

.table-card:last-child {
    margin-bottom: 0;
}

.table-card h2 {
    font-size: 16px;
    margin: 0 0 16px;
    color: var(--color-text);
}

table.sales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.sales-table th {
    text-align: left;
    color: var(--color-text-soft);
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-bg);
    white-space: nowrap;
}

table.sales-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-bg);
    white-space: nowrap;
}

table.sales-table td.editing {
    padding: 6px 8px;
}

table.sales-table input.edit-input {
    width: 90px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 2px solid #f1e2e8;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 13px;
}

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

.row-actions button {
    border: none;
    background: var(--color-bg);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
}

.row-actions button.action-delete {
    color: var(--color-danger);
}

.row-actions button.action-save {
    color: var(--color-white);
    background: var(--color-success);
}

.empty-state {
    text-align: center;
    color: var(--color-text-soft);
    padding: 30px 0;
}

@media (max-width: 768px) {
    .table-card {
        overflow-x: visible;
    }

    table.sales-table, table.sales-table thead, table.sales-table tbody,
    table.sales-table tr, table.sales-table th, table.sales-table td {
        display: block;
        width: 100%;
    }

    table.sales-table thead {
        position: absolute;
        left: -9999px;
    }

    table.sales-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    table.sales-table tr {
        border: 1px solid var(--color-bg);
        border-radius: var(--radius-sm);
        padding: 4px 14px;
        margin: 0;
    }

    table.sales-table td {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px 16px;
        padding: 10px 0;
        border-bottom: 1px solid var(--color-bg);
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: right;
    }

    table.sales-table tr td:last-child {
        border-bottom: none;
    }

    table.sales-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--color-text-soft);
        text-align: left;
        flex-shrink: 0;
    }

    table.sales-table td.editing {
        padding: 10px 0;
    }

    table.sales-table .row-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}
