:root {
    --primary: #C8A96A;
    --primary-dark: #A77D47;
    --secondary: #3A2A1A;
    --background: #F6F2E8;
    --card: #FFFFFF;
    --text: #1B140E;
    --muted: #5A4B3B;
    --border: rgba(0,0,0,0.10);
    --danger: #B43A2E;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    background: var(--card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 16px 40px rgba(58, 42, 26, 0.14);
    border: 1px solid var(--border);
}

.logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 12px;
    font-size: 38px;
    font-weight: 800;
    color: var(--text);
}

.subtitle {
    color: var(--muted);
    font-size: 20px;
    margin-bottom: 32px;
}

.error-message,
.alert {
    background: rgba(180, 58, 46, 0.08);
    color: var(--danger);
    border: 1px solid rgba(180, 58, 46, 0.25);
    padding: 18px 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    font-size: 18px;
}

label {
    display: block;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
}

input,
.form-control {
    width: 100%;
    height: 60px;
    border-radius: 16px;
    border: 2px solid var(--border);
    padding: 0 20px;
    font-size: 20px;
    background: white;
    color: var(--text);
    margin-bottom: 24px;
}

input:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(200, 169, 106, 0.22);
}

button,
.btn,
.login-button {
    width: 100%;
    height: 64px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #1B140E;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
}

button:hover,
.btn:hover,
.login-button:hover {
    background: linear-gradient(180deg, #d1b577, #A77D47);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 32px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    white-space: nowrap;
}

.user-box a {
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
}

.user-box a:hover {
    text-decoration: underline;
}

.dashboard-page,
.dashboard-wrap {
    padding: 0 32px 32px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-card,
.kpi-card,
.brand-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(58, 42, 26, 0.10);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    padding: 20px 26px;
}

.kpi-card span {
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kpi-card strong {
    font-size: 26px;
    font-weight: 900;
    color: var(--secondary);
    margin-left: 4px;
}

.kpi-card small {
    color: var(--text);
    margin-left: 4px;
}

.brand-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-section {
    overflow: hidden;
}

.brand-section summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    padding: 18px 22px;
    font-weight: 900;
    color: var(--secondary);
    background: rgba(200,169,106,0.18);
    border-bottom: 1px solid var(--border);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 14px;
}

td, th {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

td:first-child,
th:first-child {
    text-align: left;
    font-weight: 800;
    color: var(--text);
}

.subtotal-row,
.total-row {
    font-weight: 900;
    background: rgba(200,169,106,0.10);
}

.positive {
    color: #007A4D;
    font-weight: 900;
}

.negative {
    color: var(--danger);
    font-weight: 900;
}

a {
    color: var(--primary-dark);
    font-weight: 700;
}

@media (max-width: 1024px) {
    .dashboard-page,
    .dashboard-wrap {
        padding: 0 20px 24px;
    }

    .topbar {
        padding: 24px 20px;
    }

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

    table {
        min-width: 1150px;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-box {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
    }

    .dashboard-page,
    .dashboard-wrap {
        padding: 0 14px 18px;
    }

    h1 {
        font-size: 32px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .kpi-card {
        padding: 18px;
    }

    .brand-section summary {
        font-size: 16px;
        padding: 14px 16px;
    }

    table {
        min-width: 1150px;
        font-size: 14px;
    }

    td, th {
        padding: 10px 12px;
    }

    .login-page {
        padding: 16px;
        align-items: flex-start;
    }

    .login-card {
        max-width: 100%;
        padding: 24px;
        border-radius: 20px;
    }

    input,
    .form-control,
    button,
    .btn,
    .login-button {
        height: 56px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 18px 14px;
    }

    h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 16px;
    }

    .kpi-card strong {
        font-size: 24px;
    }

    table {
        min-width: 1050px;
    }
}