:root {
    --primary: #17365d;
    --primary-light: #254b78;
    --bg: #f3f5f8;
    --card: #ffffff;
    --text: #202938;
    --muted: #6b7280;
    --border: #e3e7ee;
    --success: #16804a;
    --danger: #c0392b;
}

- {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: 21px;
    margin-bottom: 5px;
}

h2 {
    font-size: 16px;
    margin-bottom: 10px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
}

button, .btn {
    border: 0;
    border-radius: 7px;
    padding: 10px 13px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 600;
}

button:hover, .btn:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: #e8edf4;
    color: var(--primary);
}

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

.login-card {
    background: var(--card);
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 24px;
    box-shadow: 0 5px 22px rgba(20, 35, 60, .06);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 15px;
}

.muted, .footer-note {
    color: var(--muted);
    font-size: 12px;
}

.footer-note {
    text-align: center;
    margin: 16px 0 0;
}

form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 12px 0 5px;
}

input, select, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    border: 1px solid #d5dbe5;
    background: white;
    color: var(--text);
    border-radius: 7px;
    padding: 9px 10px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-light);
}

form .btn {
    width: 100%;
    margin-top: 18px;
}

.alert {
    padding: 10px 12px;
    border-radius: 7px;
    background: #fff0ee;
    color: var(--danger);
    font-size: 12px;
    margin: 12px 0;
    overflow-wrap: anywhere;
}

.alert.success {
    background: #e9f8ef;
    color: var(--success);
}

.app-header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
}

.header-inner {
    max-width: 1150px;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.app-name {
    font-size: 15px;
    font-weight: 700;
}

.app-subtitle {
    font-size: 11px;
    color: #d8e4f4;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.header-user a {
    color: white;
    background: rgba(255,255,255,.12);
    border-radius: 6px;
    padding: 7px 9px;
}

.container {
    width: min(1150px, 100%);
    margin: auto;
    padding: 16px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.page-heading p {
    color: var(--muted);
    font-size: 12px;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card, .panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 13px;
    min-width: 0;
}

.stat-label {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: clamp(15px, 2vw, 21px);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.panel {
    margin-bottom: 14px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

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

th {
    background: #f7f8fa;
    font-size: 11px;
    font-weight: 700;
    color: #4b5563;
}

td.numeric, th.numeric {
    text-align: right;
}

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

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.menu-link {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
}

.menu-link strong {
    display: block;
    font-size: 12px;
    margin-bottom: 3px;
}

.menu-link span {
    color: var(--muted);
    font-size: 11px;
}

.empty-state {
    color: var(--muted);
    padding: 18px 8px;
    text-align: center;
    font-size: 12px;
}

@media (max-width: 700px) {
    body {
        font-size: 12px;
    }

    .app-header {
        padding: 10px 12px;
    }

    .app-name {
        font-size: 14px;
    }

    .container {
        padding: 11px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card, .panel {
        padding: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    .menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .menu-link {
        padding: 10px;
    }

    .header-user {
        gap: 6px;
        font-size: 11px;
    }

    .header-user a {
        padding: 6px 7px;
    }

    h1 {
        font-size: 19px;
    }

    th, td {
        padding: 8px 7px;
    }

    .login-card {
        padding: 20px;
    }
}

@media (max-width: 360px) {
    .app-subtitle {
        font-size: 10px;
    }

    .header-user {
        gap: 4px;
    }

    .header-user a {
        font-size: 10px;
    }

    .stat-value {
        font-size: 14px;
    }
}
