/* PGT Railway Wagons Loading - one stylesheet, no framework */
:root {
    --bg: #f3f4f1;
    --paper: #ffffff;
    --ink: #1b2430;
    --ink-2: #445063;
    --muted: #6b7686;
    --line: #dde1e6;
    --line-2: #eceef1;
    --primary: #1f4e79;
    --primary-ink: #ffffff;
    --primary-soft: #e6eef6;
    --grain: #c8891b;
    --grain-soft: #fbf1dc;
    --ok: #2e7d4f;
    --ok-soft: #e4f3ea;
    --danger: #b42318;
    --danger-soft: #fde8e6;
    --select: #fff6d9;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 4px 16px rgba(20, 30, 45, .06);
    --font: "Source Sans 3", "Noto Sans Georgian", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 15px; }
h3 { font-size: 17px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); color: var(--ink);
    font: 600 14px var(--font); text-decoration: none; cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
    white-space: nowrap;
}
.btn:hover { border-color: #c2c9d2; background: #fafbfc; }
.btn:focus-visible, .icon-btn:focus-visible, .lang:focus-visible, .toplink:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: #193f63; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; height: 42px; font-size: 15px; }
.icon-btn {
    width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent;
    color: var(--ink-2); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 24px;
    background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { color: var(--grain); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: #aeb8c6; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.who { color: #d6dde6; font-size: 13.5px; }
.toplink { color: #fff; background: none; border: 0; font: 14px var(--font); cursor: pointer; text-decoration: none; padding: 4px 2px; opacity: .88; }
.toplink:hover { opacity: 1; text-decoration: underline; }
.langs { display: inline-flex; border: 1px solid rgba(255, 255, 255, .25); border-radius: 6px; overflow: hidden; }
.lang { background: transparent; color: #cfd7e1; border: 0; padding: 3px 9px; font: 600 12.5px var(--font); cursor: pointer; text-decoration: none; }
.lang.on { background: var(--grain); color: #1b2430; }

.content { padding: 22px 24px 40px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13.5px; text-decoration: none; margin-bottom: 4px; }
.back:hover { text-decoration: underline; }
.page-loading { padding: 40px; color: var(--muted); text-align: center; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 460px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { text-transform: uppercase; font-size: 12.5px; letter-spacing: .06em; color: var(--ink-2); }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 34px; font-weight: 700; line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.kpi.accent { border-top: 3px solid var(--grain); }
.kpi.warn .kpi-value { color: var(--grain); }

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 14px; }
.tile {
    display: flex; align-items: center; gap: 12px; padding: 16px 18px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    text-decoration: none; color: var(--ink); font-weight: 600; box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
.tile:hover { transform: translateY(-1px); border-color: var(--primary); }
.tile-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 19px; flex: none; }
.tile.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.tile.primary .tile-icon { background: rgba(255, 255, 255, .15); color: #fff; }
.tile.admin .tile-icon { background: var(--grain-soft); color: #8a5a07; }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 210px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 12px; color: var(--ink-2); height: 18px; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 6px 6px 0 0; }
.bar { width: 100%; background: #7b97b5; border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-col.today .bar { background: var(--grain); }
.bar-day { font-size: 12px; color: var(--muted); margin-top: 6px; }
.bar-col.today .bar-day { color: var(--ink); font-weight: 700; }
.oplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.op-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.op-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-num { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-num b { color: var(--ink); }
.op-track { height: 6px; background: var(--line-2); border-radius: 3px; margin-top: 4px; }
.op-bar { height: 100%; background: var(--primary); border-radius: 3px; }
.empty { margin: 8px 0; }

/* ---------- datasheet ---------- */
.sheet-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 290px); }
.sheet { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.sheet th {
    position: sticky; top: 0; z-index: 2; background: #f7f8f9;
    text-align: left; font-size: 11.5px; letter-spacing: .05em; font-weight: 700; color: var(--ink-2);
    padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom;
}
.sheet th small { display: block; font-size: 11px; letter-spacing: 0; font-weight: 600; color: var(--grain); margin-top: 2px; }
.sheet th.num { text-align: right; }
.sheet td { padding: 3px 6px; border-bottom: 1px solid var(--line-2); height: 40px; white-space: nowrap; }
.sheet.list td { padding: 8px 10px; }
.sheet tbody tr:hover td { background: #fafbfc; }
.sheet tr.current td { background: #f4f8fc; }
.sheet tr.selected td { background: var(--select); }
.sheet tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--grain); }
.sheet tr.inactive td { color: var(--muted); }
.sheet td.ro { color: var(--ink-2); padding-right: 10px; }
.sheet td.net { font-weight: 700; padding-right: 10px; }
.sheet td.net.over { color: var(--danger); background: var(--danger-soft); }
.sheet input:not([type=checkbox]), .sheet select {
    width: 100%; height: 32px; border: 1px solid transparent; border-radius: 6px;
    background: transparent; font: inherit; color: inherit; padding: 0 6px;
}
.sheet td.num input { text-align: right; }
.sheet input:hover, .sheet select:hover { border-color: var(--line); background: #fff; }
.sheet input:focus, .sheet select:focus { border-color: var(--primary); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.sheet input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--grain); cursor: pointer; }
.sheet input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.sheet input[type=number] { -moz-appearance: textfield; }
.c-id { width: 48px; } .c-date { width: 150px; } .c-wagon { width: 130px; }
.c-time { width: 128px; font-size: 13px; } .c-op { min-width: 170px; } .c-send { width: 56px; text-align: center; } .c-x { width: 40px; }
.sheet th.c-send { text-align: center; }
.ro-text { padding: 0 6px; }
.row-actions { text-align: right; white-space: nowrap; }
.empty-row td { text-align: center; color: var(--muted); padding: 30px !important; height: auto; }
.sheet-actions { display: flex; align-items: center; gap: 14px; margin: 12px 0; flex-wrap: wrap; }
.status-line { color: var(--ink-2); font-size: 13.5px; }
.sheet-footer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sheet-footer > div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: baseline; }
.sheet-footer span { font-size: 12px; letter-spacing: .05em; font-weight: 600; color: var(--muted); }
.sheet-footer b { font-size: 22px; font-variant-numeric: tabular-nums; }
.sheet-footer .hl { border-color: var(--grain); background: var(--grain-soft); }

.toolbar { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.search { height: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; font: inherit; min-width: 260px; background: #fff; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; margin-right: 4px; }
.tag.warn { background: var(--grain-soft); color: #8a5a07; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- forms & modals ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field select {
    height: 40px; border: 1px solid #ccd3db; border-radius: var(--radius); padding: 0 11px;
    font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input[readonly] { background: var(--line-2); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 13px; color: #8a5a07; background: var(--grain-soft); border-radius: 6px; padding: 7px 10px; margin-bottom: 12px; }
.hint:empty { display: none; }

.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(18, 26, 38, .45); display: grid; place-items: center; padding: 16px; }
.msgbox-back { z-index: 200; }
.modal { background: var(--paper); border-radius: 12px; padding: 20px 22px; width: min(480px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { width: min(720px, 100%); }
.modal h3 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.msgbox-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.msgbox-head h3 { margin: 0; }
.msgbox-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; background: var(--primary-soft); color: var(--primary); }
.msgbox.warning .msgbox-icon, .msgbox.question .msgbox-icon { background: var(--grain-soft); color: #8a5a07; }
.msgbox.error .msgbox-icon { background: var(--danger-soft); color: var(--danger); }
.msgbox-text { white-space: pre-line; color: var(--ink-2); }
.summary { white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--line-2); padding: 12px; border-radius: 8px; max-height: 50vh; overflow: auto; margin: 0; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { background: var(--ink); color: #fff; display: flex; align-items: flex-end; padding: 48px; position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 255, 255, .03) 46px 47px); }
.art-inner { position: relative; width: 100%; }
.art-kicker { color: var(--grain); font-weight: 700; letter-spacing: .3em; font-size: 14px; }
.art-title { font-size: 40px; font-weight: 700; line-height: 1.1; margin: 10px 0 8px; max-width: 12em; }
.art-sub { color: #aeb8c6; font-size: 16px; margin-bottom: 48px; }
.art-train { width: 100%; color: #2f3f55; display: block; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); background: var(--paper); position: relative; }
.login-form form { max-width: 380px; width: 100%; }
.login-form h1 { margin-bottom: 20px; font-size: 28px; }
.login-langs { position: absolute; top: 24px; right: 24px; border-color: var(--line); }
.login-langs .lang { color: var(--ink-2); }
.link-under { display: block; text-align: center; margin-top: 14px; font-size: 14px; }
.note { border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; max-width: 380px; white-space: pre-line; }
.note.error { background: var(--danger-soft); color: var(--danger); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--primary-soft); color: var(--primary); }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

/* ---------- report (paper) ---------- */
.paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 44px 52px; border: 1px solid var(--line); box-shadow: var(--shadow); font-family: "Segoe UI", var(--font); }
.paper-head h2 { font-size: 26px; color: var(--primary); font-weight: 600; }
.paper-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.paper-by { font-weight: 600; font-size: 14px; margin: 4px 0 18px; }
.paper-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.paper-table th { background: #eef2f6; color: var(--primary); font-size: 12px; font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1.5px solid var(--primary); }
.paper-table th.num { text-align: right; }
.paper-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.paper-table tfoot td { border-top: 1.5px solid var(--primary); border-bottom: 0; padding-top: 9px; font-weight: 600; }
.paper-table .lbl { color: var(--primary); font-size: 12px; }
.paper-table .total { font-size: 16px; }
.paper-sign { margin-top: 40px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 300; background: #fff7d6; padding: 10px 20px; box-shadow: 0 -1px 4px rgba(0, 0, 0, .15); }
#blazor-error-ui .reload { margin-left: 8px; }

@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .tiles { grid-template-columns: repeat(3, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .content { padding: 16px; }
    .topbar { padding: 10px 16px; flex-wrap: wrap; }
    .brand-text small { display: none; }
    .tiles { grid-template-columns: 1fr 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { padding: 28px 24px; min-height: 200px; }
    .art-title { font-size: 28px; }
    .art-sub { margin-bottom: 20px; }
    .login-form { padding: 64px 24px 40px; }
    .sheet-footer { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .paper { padding: 22px 18px; }
    .search { min-width: 0; width: 100%; }
}
@media print {
    .topbar, .no-print, #blazor-error-ui { display: none !important; }
    .content { padding: 0; }
    .paper { border: 0; box-shadow: none; padding: 0; }
}

/* fixes after visual review */
h1:focus, h1:focus-visible { outline: none; }
.form-grid > * { min-width: 0; }
.field input, .field select { width: 100%; min-width: 0; }
:lang(ka) .kpi-label, :lang(ka) .panel-head h2, :lang(ka) .sheet th, :lang(ka) .sheet-footer span { text-transform: none; letter-spacing: 0; }

/* 31.10: Access look - selected row light blue, Loading End green, others' wagons muted, shifts */
:root { --select: #e3effb; }
.sheet td.end-ok { color: var(--ok); font-weight: 600; }
.sheet td.net { color: var(--primary); }
.sheet td.net.over { color: var(--danger); }
.sheet tr.others td { color: var(--muted); }
.sheet tr.others td.net { color: var(--muted); }
.c-shift { width: 92px; }
.shift-day { color: #8a5a07; font-weight: 600; }
.shift-night { color: var(--primary); font-weight: 600; }
.shift-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; background: var(--grain-soft); color: #8a5a07; }
.shift-badge.night { background: var(--primary-soft); color: var(--primary); }
