* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
    font-size: 15px;
}
a { color: #0f5f8f; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    background: #17324d;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.brand img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 4px; padding: 3px; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; color: #dce7f2; font-size: 13px; margin-top: 2px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
nav a {
    color: #fff;
    padding: 8px 10px;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
}
nav a:hover { background: rgba(255,255,255,0.16); text-decoration: none; }
.container { max-width: 1180px; margin: 24px auto; padding: 0 18px; }
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
h1 { margin: 0; font-size: 24px; color: #172b3a; }
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stats div, .login-box, .form-grid, .filter {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.stats div { padding: 16px; }
.stats strong { display: block; font-size: 26px; color: #0b7285; }
.stats span { color: #52606d; }
.filter {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    margin-bottom: 16px;
}
label { display: block; font-weight: 700; color: #334e68; }
input, select, button, .button {
    width: 100%;
    min-height: 38px;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid #bcccdc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 15px;
    background: #fff;
}
.select-search {
    margin-bottom: 6px;
}
.prefixed-input {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    margin-top: 6px;
}
.prefixed-input span {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    border: 1px solid #bcccdc;
    border-right: 0;
    border-radius: 4px 0 0 4px;
    color: #243b53;
    font-weight: 700;
}
.prefixed-input input {
    margin-top: 0;
    border-radius: 0 4px 4px 0;
}
.date-selects {
    display: grid;
    grid-template-columns: 0.8fr 1.3fr 1fr;
    gap: 6px;
    margin-top: 6px;
}
.date-selects select {
    margin-top: 0;
    min-width: 0;
}
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    background: #0f5f8f;
    color: #fff;
    border-color: #0f5f8f;
    cursor: pointer;
}
button:hover, .button:hover { background: #0b4f76; text-decoration: none; }
.button.muted { background: #eef2f7; color: #243b53; border-color: #cbd5e1; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #d9e2ec;
}
.data-table th, .data-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e4ebf2;
    text-align: left;
    vertical-align: top;
}
.data-table th { background: #e9f2f9; color: #243b53; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .actions { white-space: nowrap; }
.data-table .actions a { margin-right: 8px; }
.data-table .actions .danger { color: #b42318; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    margin-bottom: 18px;
}
.form-grid.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.success, .alert {
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 14px;
}
.success { background: #e3fcec; color: #135d35; border: 1px solid #a7e3bd; }
.alert { background: #ffe8e8; color: #9b1c1c; border: 1px solid #f5b5b5; }
.hint { color: #52606d; }
.login-box { max-width: 420px; margin: 80px auto; padding: 22px; }
.login-box h1 { margin-bottom: 16px; }
.login-box label { margin-top: 12px; }
.logo-preview img { max-width: 140px; max-height: 90px; background: #fff; border: 1px solid #d9e2ec; padding: 4px; }
.footer {
    max-width: 1180px;
    margin: 20px auto 30px;
    padding: 12px 18px;
    color: #52606d;
    text-align: center;
    line-height: 1.6;
}
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0;
}
.chart-box {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chart-box h2 {
    margin: 0 0 12px;
    font-size: 18px;
    color: #172b3a;
}
.chart-row {
    display: grid;
    grid-template-columns: 82px 1fr 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.chart-row.single {
    grid-template-columns: minmax(160px, 240px) 1fr;
}
.chart-label {
    color: #334e68;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chart-label.wide {
    font-size: 13px;
}
.chart-track {
    position: relative;
    min-height: 28px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #d9e2ec;
}
.chart-track .bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    min-width: 2px;
}
.chart-track .bar.in { background: #2f9e44; }
.chart-track .bar.out { background: #e67700; }
.chart-track .bar.top { background: #0f5f8f; }
.chart-track span {
    position: relative;
    display: block;
    padding: 5px 8px;
    color: #172b3a;
    font-size: 13px;
    white-space: nowrap;
}
@media (max-width: 860px) {
    .topbar { display: block; }
    nav { justify-content: flex-start; margin-top: 12px; }
    .stats, .filter, .form-grid, .form-grid.wide, .chart-grid, .chart-row, .chart-row.single { grid-template-columns: 1fr; }
    .date-selects { grid-template-columns: 1fr 1fr 1fr; }
    .page-title { display: block; }
}
