:root {
    --bg: #eef7fb;
    --panel: #ffffff;
    --text: #122736;
    --muted: #5f7382;
    --line: #c8dce8;
    --accent: #00a8df;
    --accent-strong: #0077a6;
    --nav: #053b64;
    --nav-2: #075b8f;
    --danger: #b42318;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
input, select, button {
    font: inherit;
}
input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    background: #fff;
}
label {
    display: grid;
    gap: 6px;
    color: #394150;
    font-size: 14px;
}
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}
.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-strong);
}
.topbar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: linear-gradient(90deg, var(--nav), var(--nav-2));
    color: #fff;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}
.brand img {
    width: 92px;
    height: auto;
    display: block;
}
.topbar nav {
    display: flex;
    gap: 14px;
    align-items: center;
}
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-panel {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
}
.login-panel h1 { margin: 0 0 4px; }
.login-panel p { margin: 0 0 22px; color: var(--muted); }
.login-logo {
    width: 170px;
    max-width: 80%;
    display: block;
    margin-bottom: 18px;
}
.login-logo.centered {
    margin-left: auto;
    margin-right: auto;
}
.compact-logo {
    width: 150px;
}
.centered-auth {
    text-align: center;
}
.centered-auth form {
    text-align: left;
}
.auth-link {
    margin: 16px 0 0;
    text-align: center;
}
.auth-link a {
    color: var(--accent-strong);
    font-weight: 700;
}
.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 52px);
}
.sidebar {
    background: #062f4f;
    color: #dfe7ef;
    padding: 16px;
}
.sidebar nav {
    display: grid;
    gap: 6px;
}
.sidebar a {
    padding: 10px 12px;
    border-radius: 6px;
}
.sidebar a.active, .sidebar a:hover {
    background: rgba(255,255,255,.12);
}
.content {
    padding: 24px;
    min-width: 0;
}
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}
.page-title h1 { margin: 0 0 4px; }
.page-title p { margin: 0; color: var(--muted); }
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
}
.metric-grid article, .panel, .empty {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}
.metric-grid strong {
    display: block;
    font-size: 28px;
}
.metric-grid span { color: var(--muted); }
.actions-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.stack {
    display: grid;
    gap: 12px;
}
.panel h2 {
    margin: 0;
    font-size: 18px;
}
.wide-panel {
    margin-top: 16px;
}
.narrow-panel {
    max-width: 520px;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
}
.help-grid span {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    background: #f8fcff;
}
.help-grid strong {
    display: block;
    color: var(--accent-strong);
}
.rules-table, .table-wrap {
    overflow: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border-bottom: 1px solid var(--line);
    padding: 9px;
    text-align: left;
    vertical-align: top;
}
th {
    background: #eef1f5;
    font-weight: 700;
}
.check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.check input {
    width: auto;
}
.alert {
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.alert.ok { background: #e8f6ef; color: #14532d; }
.alert.error { background: #fee4e2; color: var(--danger); }
.danger {
    color: #fff;
    background: var(--danger);
    border-color: #8f1d14;
}
.load-header {
    display: grid;
    grid-template-columns: 120px repeat(2, minmax(180px, 1fr));
    gap: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}
.fixed-field {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fcff;
    padding: 8px 10px;
}
.fixed-field span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}
.fixed-field strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
}
.mesa-check {
    display: grid;
    grid-template-columns: minmax(160px, 240px) auto;
    gap: 10px;
    align-items: end;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}
.mesa-check input {
    font-size: 24px;
    font-weight: 700;
}
.mini-list {
    display: grid;
    gap: 8px;
}
.mini-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px;
    background: #f8fcff;
}
.entry-table input {
    min-width: 88px;
}
.entry-table .special td {
    background: #fbfbfc;
    font-weight: 700;
}
.muted { color: var(--muted); }
@media (max-width: 800px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .sidebar nav { grid-template-columns: repeat(5, 1fr); }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .load-header, .mesa-check { grid-template-columns: 1fr; }
    .brand img { width: 74px; }
}
