:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #e9edf7;
  background: #0b1020;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 70% -20%, #243a62 0%, #0b1020 48%);
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { max-width: 1550px; margin: auto; padding: 28px 32px 70px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2.7px; color: #88a8ec; }
h1 { font-size: 30px; margin: 7px 0 6px; letter-spacing: -1px; }
.sub { color: #96a5bf; font-size: 13px; }
.brand {
  border: 1px solid #344565;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
}
.top-side { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav button, .session button, .filters button, .form-actions button, .ghost, .danger {
  background: #293a58;
  border: 1px solid #44597b;
  border-radius: 10px;
  color: white;
  padding: 11px 15px;
  font-weight: 700;
}
.nav button.active, .filters button.primary, .form-actions button.primary, .login-card button {
  background: #3d5f9a;
  border-color: #6d91d4;
}
.nav button:hover, .filters button:hover, .session button:hover, .ghost:hover { background: #385177; }
.session { display: flex; align-items: center; gap: 10px; color: #c5d2e8; font-size: 13px; }
.filters, .panel, .card, .login-card, .dialog {
  background: #151e31;
  border: 1px solid #293650;
  border-radius: 17px;
  box-shadow: 0 8px 26px #03091826;
}
.filters { display: flex; flex-wrap: wrap; gap: 12px; padding: 18px; margin-bottom: 18px; align-items: end; }
.filter, label.field { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 145px; }
.filter label, .field span, .section-title { font-size: 11px; font-weight: 750; color: #9eacc6; text-transform: uppercase; letter-spacing: .8px; }
select, input, textarea {
  background: #0c1526;
  color: #edf2fa;
  border: 1px solid #35435e;
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 41px;
  outline: none;
  width: 100%;
  font-size: 13px;
}
select:focus, input:focus, textarea:focus { border-color: #7c9de8; }
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.card { padding: 20px 19px; }
.card .label { font-size: 12px; color: #a3b2ca; }
.card .value { font-size: 26px; letter-spacing: -.9px; font-weight: 800; margin: 13px 0 6px; white-space: nowrap; }
.card .foot { font-size: 11px; color: #7795c8; }
.grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-top: 16px; }
.panel { padding: 21px; min-width: 0; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.hint { font-size: 12px; color: #8193b0; margin-bottom: 18px; }
.bars { display: flex; align-items: end; gap: 8px; height: 230px; padding: 14px 4px 30px; border-bottom: 1px solid #35415a; overflow-x: auto; }
.barcol { flex: 1; min-width: 28px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; gap: 7px; }
.bar { background: linear-gradient(180deg, #78b9f8, #4663cf); border-radius: 7px 7px 2px 2px; width: min(100%, 42px); min-height: 2px; }
.barcol small { font-size: 10px; color: #a0b0c8; position: absolute; bottom: -24px; white-space: nowrap; }
.rank { display: flex; flex-direction: column; gap: 13px; }
.rankrow { display: grid; grid-template-columns: 150px 1fr 110px; gap: 10px; align-items: center; font-size: 12px; }
.rankrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { height: 9px; border-radius: 10px; background: #293a54; overflow: hidden; }
.fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #5576d8, #78c3ed); }
.rankrow strong { text-align: right; font-size: 11px; }
.tabletop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.tabletop input { max-width: 320px; }
.scroll { overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th { text-align: left; position: sticky; top: 0; background: #1e2b42; color: #a6b8d1; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 13px 12px; cursor: pointer; white-space: nowrap; }
td { border-bottom: 1px solid #28364e; padding: 12px; color: #d6dfed; font-size: 12px; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr:hover td { background: #1c2a40; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { background: #243c57; color: #a9d4f6; border-radius: 7px; padding: 5px 7px; font-size: 11px; }
.footer { font-size: 11px; color: #788aa6; margin-top: 20px; }
.empty { color: #9fb0ca; padding: 25px; }
.table-panel { margin-top: 16px; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 4px 0; }
.login-card button { margin-top: 6px; }
.login-hint { margin-top: 8px; padding-top: 12px; border-top: 1px solid #2a3a56; color: #9aabc4; font-size: 12px; display: grid; gap: 6px; }
.login-hint strong { color: #d5e2f6; margin-right: 6px; }
.error { color: #ffb4b4; font-size: 13px; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; align-items: start; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields .wide { grid-column: 1 / -1; }
.routes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.summary { position: sticky; top: 16px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #2a3b56; font-size: 13px; }
.summary .line strong { font-variant-numeric: tabular-nums; }
.summary .total { font-size: 22px; font-weight: 800; margin-top: 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.danger { background: #6a3140; border-color: #a15b6d; }
.section { margin-top: 18px; }
.tariff-table { width: 100%; min-width: 0; }
.tariff-table td, .tariff-table th { cursor: default; }
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1d4d38;
  color: #e7fff3;
  border: 1px solid #3e8f68;
  border-radius: 12px;
  padding: 12px 16px;
  z-index: 30;
  max-width: 360px;
}
.modal { position: fixed; inset: 0; background: #050912cc; display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 20; }
.modal[hidden], .toast[hidden], [hidden] { display: none !important; }
.dialog { width: min(820px, 100%); max-height: 86vh; overflow: auto; padding: 22px; }
.detail { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: 13px; }
.detail dt { color: #93a6c4; }
.detail dd { margin: 0; }
.actions-inline { display: flex; gap: 8px; }
body.entry { height: 100vh; overflow: hidden; }
body.entry #app {
  height: 100vh;
  max-width: none;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
}
body.entry .top { margin-bottom: 8px; align-items: center; }
body.entry h1 { font-size: 20px; margin: 0; }
body.entry .sub, body.entry .footer, body.entry .eyebrow { display: none; }
body.entry #view { flex: 1; min-height: 0; overflow: hidden; }
body.entry .entry-screen { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
body.entry .form-grid { height: auto; flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) 270px; gap: 10px; align-items: stretch; }
body.entry .entry-main { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
body.entry .recent { flex: 1 1 auto; min-height: 180px; display: flex; flex-direction: column; overflow: hidden; margin: 0; }
body.entry .recent .tabletop { margin-bottom: 8px; }
body.entry .recent h2 { margin: 0; }
body.entry .recent .hint { margin: 2px 0 0; }
body.entry .recent .scroll { flex: 1; min-height: 0; max-height: none; }
body.entry .recent table { min-width: 860px; }
body.entry .recent th, body.entry .recent td { padding: 7px 8px; }
body.entry .recent td.route { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.entry .recent .actions-inline button { padding: 6px 10px; }
body.entry tr.editing td { background: #243656; }
body.entry .editing-banner { margin-top: 8px; color: #d7ecff; font-size: 12px; font-weight: 700; }
body.entry .panel { padding: 12px 14px; }
body.entry .hint { margin: 8px 0 0; }
body.entry .fields.dense { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
body.entry select, body.entry input { min-height: 34px; padding: 6px 8px; }
body.entry .summary { position: static; display: flex; flex-direction: column; }
body.entry .summary .line { padding: 6px 0; }
body.entry .summary .total { margin-top: 8px; }
body.entry .form-actions { margin-top: auto; }
.route-box { margin-top: 10px; }
.route-row { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; align-items: end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 32px; }
.chip {
  background: #243c57;
  color: #d7ecff;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.muted-inline { color: #8ea0bb; font-size: 12px; }
.field .mini { align-self: flex-start; min-height: 32px; padding: 6px 10px; background: #293a58; border: 1px solid #44597b; border-radius: 10px; color: white; font-weight: 700; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: #c5d2e8; font-size: 13px; }
.pager button { background: #293a58; border: 1px solid #44597b; border-radius: 10px; color: white; padding: 6px 12px; font-weight: 700; }
.pager button:disabled { opacity: .4; }
@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .grid, .form-grid { grid-template-columns: 1fr; }
  body.entry .form-grid { grid-template-columns: minmax(0, 1fr) 250px; height: auto; }
  .summary { position: static; }
}
@media (max-width: 650px) {
  .shell { padding: 18px 12px; }
  .cards, .fields, .routes { grid-template-columns: 1fr; }
  .card .value { font-size: 21px; }
  .rankrow { grid-template-columns: 90px 1fr 75px; }
  .top { flex-direction: column; }
}
