:root {
    --background: #f5f6f8;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #161616;
    --muted: #747474;
    --gold: #b58a2a;
    --gold-dark: #8b681d;
    --success: #16794a;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text);
}

.topbar {
    min-height: 88px;
    padding: 20px 40px;

    background: var(--surface);
    border-bottom: 1px solid var(--border);

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.topbar span {
    color: var(--muted);
    font-size: 13px;
}

.status {
    padding: 9px 14px;
    border-radius: 999px;
    background: #f2f4f7;
    font-size: 13px;
}

.status.online {
    background: #e8f7ef;
    color: var(--success);
}

.status.offline {
    background: #feeceb;
    color: var(--danger);
}

.container {
    width: min(1450px, calc(100% - 48px));
    margin: 30px auto 60px;
}

.summary {
    display: flex;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 28px;
}

.summary-card {
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
}

.summary-card span {
    color: var(--muted);
    font-size: 13px;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
}

.secondary-button {
    margin-left: auto;
    padding: 0 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    font-weight: 600;
}

.secondary-button:hover {
    border-color: var(--gold);
}

.section-title {
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 19px;
}

.section-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.table-wrapper {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1150px;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    background: #fafafa;
}

td {
    font-size: 14px;
}

.product-name {
    font-weight: 700;
}

.money {
    font-variant-numeric: tabular-nums;
}

.price-input {
    width: 115px;
    padding: 9px 10px;

    border: 1px solid var(--border);
    border-radius: 9px;

    font-size: 14px;
}

.price-input:focus {
    outline: none;
    border-color: var(--gold);
}

.action-group {
    display: flex;
    gap: 7px;
}

.save-button,
.reset-button {
    padding: 8px 12px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.save-button {
    border: 0;
    color: white;
    background: var(--gold-dark);
}

.reset-button {
    border: 1px solid var(--border);
    background: white;
}

.manual {
    color: var(--gold-dark);
    font-weight: 700;
}

.logs-section {
    margin-top: 30px;
}

.log-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.log-item {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.log-item:last-child {
    border-bottom: 0;
}

.log-item small {
    color: var(--muted);
}

.loading {
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;

    padding: 13px 18px;
    border-radius: 11px;

    background: #161616;
    color: white;

    opacity: 0;
    transform: translateY(15px);
    transition: 0.2s;

    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.login-view {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        linear-gradient(
            135deg,
            #f4f5f7,
            #ffffff
        );
}

.login-card {
    width: 100%;
    max-width: 410px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 20px;

    padding: 36px;

    box-shadow:
        0 20px 60px rgba(0,0,0,.08);
}

.login-brand {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 22px;

    border-radius: 16px;

    background: #111;
    color: #d7ad4b;

    font-weight: 800;
    font-size: 20px;
}

.login-card h1 {
    margin: 0;
    font-size: 26px;
}

.login-card > p {
    margin: 5px 0 28px;
    color: var(--muted);
}

.login-card label {
    display: block;
    margin: 16px 0 7px;

    font-size: 13px;
    font-weight: 600;
}

.login-input {
    width: 100%;

    padding: 12px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 15px;
}

.login-input:focus {
    outline: none;
    border-color: var(--gold);
}

.login-button {
    width: 100%;

    margin-top: 22px;
    padding: 13px;

    border: 0;
    border-radius: 10px;

    background: var(--gold-dark);
    color: white;

    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}

.login-error {
    min-height: 20px;
    margin-top: 12px;

    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 14px;

    padding-left: 15px;

    border-left: 1px solid var(--border);
}

.user-box small {
    display: block;
    color: var(--muted);
}

.user-box strong {
    display: block;
    margin-top: 2px;
}

.logout-button {
    padding: 8px 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: white;

    cursor: pointer;
}

.status-badge {
    display: inline-block;

    padding: 6px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
}

.status-badge.manual {
    color: #8b681d;
    background: #fff4d6;
}

.status-badge.auto {
    color: #286142;
    background: #e9f7ef;
}

.last-update {
    font-size: 15px !important;
}

.mode-select {
    min-width: 115px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-weight: 700;
    background: white;
    cursor: pointer;
}

.mode-select.mode-auto {
    color: #286142;
    background: #e9f7ef;
}

.mode-select.mode-adjustment {
    color: #805b15;
    background: #fff4d6;
}

.mode-select.mode-manual {
    color: #8b3a16;
    background: #fff0e8;
}

.price-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}
