@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --ps-primary: #0875de;
  --ps-primary-hover: #0564be;
  --ps-navy: #0b3a67;
  --ps-navy-deep: #082f55;
  --ps-bg: #f4f8fc;
  --ps-surface: #ffffff;
  --ps-surface-muted: #eef5fb;
  --ps-text: #12243a;
  --ps-muted: #708198;
  --ps-border: #dfe8f1;
  --ps-success: #0b774a;
  --ps-success-soft: #e8f8f1;
  --ps-warning: #9a4d08;
  --ps-warning-soft: #fff3e7;
  --ps-danger: #b82e35;
  --ps-danger-soft: #fdecec;
  --ps-purple: #7656e8;
  --ps-purple-soft: #f0ecff;
  --ps-radius-sm: 6px;
  --ps-radius-md: 10px;
  --ps-radius-lg: 14px;
  --ps-shadow: 0 8px 28px rgba(30, 72, 112, .07);
  --ps-focus: 0 0 0 3px rgba(22, 135, 248, .25);
  --ps-sidebar: 248px;
  --ps-topbar: 68px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ps-text);
  background: var(--ps-bg);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--ps-focus); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--ps-sidebar) 1fr; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--ps-sidebar);
  display: flex; flex-direction: column; color: #fff; background: var(--ps-navy-deep);
  padding: 20px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 22px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--ps-primary); }
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-subtitle { display: block; margin-top: 2px; color: #9fc2df; font-size: 10px; font-weight: 600; }
.nav { display: grid; gap: 4px; }
.nav-link { min-height: 43px; display: flex; align-items: center; gap: 12px; border-radius: var(--ps-radius-md); padding: 0 12px; color: #b9d0e4; font-weight: 600; transition: background .18s ease, color .18s ease; }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: var(--ps-primary); box-shadow: 0 8px 20px rgba(22,135,248,.22); }
.sidebar-spacer { flex: 1; }
.sidebar-note { margin: 18px 3px 0; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: var(--ps-radius-lg); background: rgba(255,255,255,.06); }
.sidebar-note strong { display: block; margin-bottom: 5px; font-size: 13px; }
.sidebar-note span { color: #9fc2df; font-size: 11px; line-height: 1.5; }

.main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--ps-topbar); display: flex; align-items: center; gap: 20px; padding: 0 28px; border-bottom: 1px solid var(--ps-border); background: rgba(255,255,255,.96); }
.menu-button { display: none; width: 44px; height: 44px; border: 0; border-radius: var(--ps-radius-md); color: var(--ps-navy); background: var(--ps-surface-muted); cursor: pointer; }
.search { position: relative; width: min(440px, 48vw); }
.search svg { position: absolute; left: 14px; top: 50%; width: 17px; transform: translateY(-50%); color: var(--ps-muted); }
.search input { width: 100%; height: 42px; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-md); padding: 0 40px; color: var(--ps-text); background: var(--ps-bg); }
.search input::placeholder { color: #91a0b2; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-md); color: var(--ps-muted); background: #fff; cursor: pointer; }
.icon-button svg { width: 18px; }
.admin-link { min-height: 42px; display: flex; align-items: center; gap: 9px; border-radius: var(--ps-radius-md); padding: 0 13px; color: var(--ps-navy); background: var(--ps-surface-muted); font-weight: 700; }
.admin-avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ps-navy); font-size: 11px; }

.content { max-width: 1600px; margin: 0 auto; padding: 26px 28px 40px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: var(--ps-primary); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; letter-spacing: -.035em; }
.page-description { max-width: 680px; margin: 7px 0 0; color: var(--ps-muted); line-height: 1.55; }
.date-chip { display: flex; align-items: center; gap: 9px; min-height: 42px; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-md); padding: 0 13px; color: var(--ps-muted); background: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card, .panel { min-width: 0; overflow: hidden; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-lg); background: var(--ps-surface); box-shadow: var(--ps-shadow); }
.metric-card { min-height: 122px; display: grid; grid-template-columns: 48px 1fr; gap: 13px; align-items: start; padding: 18px; }
.metric-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; }
.metric-icon svg { width: 23px; height: 23px; }
.metric-icon.blue { color: var(--ps-primary); background: #e8f4ff; }
.metric-icon.green { color: var(--ps-success); background: var(--ps-success-soft); }
.metric-icon.orange { color: var(--ps-warning); background: var(--ps-warning-soft); }
.metric-icon.purple { color: var(--ps-purple); background: var(--ps-purple-soft); }
.metric-label { color: var(--ps-muted); font-size: 11px; font-weight: 700; }
.metric-value { margin-top: 4px; font-size: 25px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-support { margin-top: 7px; color: var(--ps-muted); font-size: 10px; line-height: 1.4; }
.metric-trend { color: var(--ps-success); font-weight: 800; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(290px, .8fr); gap: 14px; align-items: start; }
.column { display: grid; gap: 14px; min-width: 0; }
.panel-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--ps-border); }
.panel-title { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.panel-link { color: var(--ps-primary); font-size: 11px; font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { height: 39px; padding: 0 13px; text-align: left; color: var(--ps-muted); background: #f8fbfe; font-size: 10px; font-weight: 700; white-space: nowrap; }
td { height: 50px; padding: 0 13px; border-top: 1px solid #edf2f7; font-size: 11px; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f9fcff; }
.route-code { color: var(--ps-primary); font-weight: 800; }
.status { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; border-radius: 999px; padding: 0 8px; font-size: 9px; font-weight: 800; }
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.success { color: var(--ps-success); background: var(--ps-success-soft); }
.status.info { color: var(--ps-primary); background: #e8f4ff; }
.status.warning { color: var(--ps-warning); background: var(--ps-warning-soft); }
.capacity { color: var(--ps-muted); font-variant-numeric: tabular-nums; }
.empty-row td { height: 108px; text-align: center; color: var(--ps-muted); white-space: normal; }

.chart-panel { min-height: 245px; }
.chart-body { display: grid; grid-template-columns: 1.3fr .7fr; gap: 24px; padding: 20px; }
.chart-placeholder { min-height: 150px; display: flex; align-items: end; gap: 11px; border-bottom: 1px solid var(--ps-border); padding: 10px 12px 0; background: repeating-linear-gradient(to top, transparent 0 39px, #edf2f7 40px); }
.bar { flex: 1; min-width: 15px; border-radius: 5px 5px 0 0; background: #b8d9fa; }
.bar:nth-child(2) { height: 42%; }.bar:nth-child(3) { height: 58%; }.bar:nth-child(4) { height: 47%; }.bar:nth-child(5) { height: 70%; }.bar:nth-child(6) { height: 53%; }.bar:nth-child(7) { height: 82%; background: var(--ps-primary); }
.chart-empty { align-self: center; color: var(--ps-muted); font-size: 11px; line-height: 1.6; }
.donut { width: 132px; height: 132px; display: grid; place-items: center; margin: 0 auto; border-radius: 50%; background: conic-gradient(var(--ps-success) 0 0%, #e7edf3 0 100%); position: relative; }
.donut::after { content: ''; position: absolute; width: 88px; height: 88px; border-radius: 50%; background: #fff; }
.donut-value { z-index: 1; text-align: center; font-size: 23px; font-weight: 800; }
.donut-value span { display: block; margin-top: 2px; color: var(--ps-muted); font-size: 9px; font-weight: 700; }

.route-map { position: relative; height: 180px; overflow: hidden; background: #eaf5ef; }
.route-map svg { width: 100%; height: 100%; }
.map-label { position: absolute; padding: 4px 7px; border: 1px solid #d9e6ee; border-radius: 6px; background: rgba(255,255,255,.94); font-size: 9px; font-weight: 800; }
.map-label.moscow { left: 14%; bottom: 17%; }.map-label.petersburg { right: 9%; top: 12%; }
.route-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px 18px; }
.route-summary div { color: var(--ps-muted); font-size: 10px; }
.route-summary strong { display: block; margin-top: 3px; color: var(--ps-text); font-size: 13px; }

.departures { padding: 5px 18px 12px; }
.departure { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; min-height: 45px; border-bottom: 1px solid #edf2f7; }
.departure:last-child { border-bottom: 0; }
.departure time { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.departure-route { font-size: 10px; font-weight: 700; }
.departure-route span { color: var(--ps-muted); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px; }
.quick-action { min-height: 64px; display: flex; align-items: center; gap: 10px; border-radius: var(--ps-radius-md); padding: 11px; color: var(--ps-navy); background: var(--ps-surface-muted); font-size: 10px; font-weight: 800; transition: transform .18s ease, background .18s ease; }
.quick-action:hover { transform: translateY(-1px); background: #e2f0fb; }
.quick-action-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 9px; color: #fff; background: var(--ps-primary); }
.quick-action-icon svg { width: 17px; }
.quick-action.green .quick-action-icon { background: var(--ps-success); }.quick-action.purple .quick-action-icon { background: var(--ps-purple); }

.mobile-overlay { display: none; position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(5,34,61,.48); }

@media (max-width: 1180px) {
  :root { --ps-sidebar: 214px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(270px, .75fr); }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .column.secondary { grid-template-columns: 1fr 1fr; }
  .column.secondary .quick-panel { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .mobile-overlay { display: block; }
  .main { min-width: 0; }
  .topbar { padding: 0 12px; gap: 10px; }
  .menu-button { display: grid; place-items: center; flex: none; }
  .search { width: auto; flex: 1; }
  .search input { padding-right: 12px; }
  .admin-link span:last-child { display: none; }
  .content { padding: 20px 12px 30px; }
  .page-heading { align-items: start; }
  .date-chip { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 112px; grid-template-columns: 40px 1fr; padding: 14px; }
  .metric-icon { width: 40px; height: 40px; }
  .metric-value { font-size: 21px; }
  .column.secondary { grid-template-columns: 1fr; }
  .chart-body { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 98px; }
  .top-actions .icon-button { display: none; }
  .quick-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.auth-page { min-height:100vh; display:grid; place-items:center; padding:20px; background:var(--ps-bg); }
.auth-card { width:min(430px,100%); padding:32px; border:1px solid var(--ps-border); border-radius:var(--ps-radius-lg); background:#fff; box-shadow:var(--ps-shadow); }
.auth-brand { width:max-content; margin-bottom:30px; padding:0; color:var(--ps-text); }
.auth-brand .brand-subtitle { color:var(--ps-muted); }
.auth-form { display:grid; gap:17px; margin-top:25px; }
.auth-form label { display:grid; gap:7px; font-size:12px; font-weight:800; }
.auth-form input { min-height:46px; border:1px solid var(--ps-border); border-radius:var(--ps-radius-md); padding:0 13px; background:#f8fbfe; }
.auth-form button { min-height:46px; border:0; border-radius:var(--ps-radius-md); color:#fff; background:var(--ps-primary); font-weight:800; cursor:pointer; }
.auth-error { margin-top:18px; border-radius:var(--ps-radius-md); padding:12px; color:var(--ps-danger); background:var(--ps-danger-soft); font-size:12px; font-weight:700; }
.error-page { min-height:100vh; display:grid; place-items:center; padding:20px; background:var(--ps-bg); }
.error-card { width:min(560px,100%); padding:42px; border:1px solid var(--ps-border); border-radius:var(--ps-radius-lg); background:var(--ps-surface); box-shadow:var(--ps-shadow); text-align:center; }
.error-code { display:inline-grid; place-items:center; min-width:76px; min-height:42px; margin-bottom:24px; border-radius:999px; color:var(--ps-primary); background:var(--ps-surface-muted); font-size:18px; font-weight:800; letter-spacing:.08em; }
.error-card .page-description { margin:12px auto 0; }
.error-home { min-height:46px; display:inline-flex; align-items:center; justify-content:center; margin-top:26px; border-radius:var(--ps-radius-md); padding:0 22px; color:#fff; background:var(--ps-primary); font-weight:800; transition:background .18s ease; }
.error-home:hover { background:var(--ps-primary-hover); }
.manager-shell { min-height:100vh; }
.manager-header { min-height:74px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:10px 28px; color:#fff; background:var(--ps-navy-deep); }
.manager-brand { padding:0; }.manager-brand .brand-mark { overflow:hidden; background:transparent; }.manager-brand img { width:38px; height:38px; }
.manager-user { display:flex; align-items:center; gap:10px; }.manager-user>img { width:38px; height:38px; border-radius:50%; object-fit:cover; background:#fff; }.manager-user strong,.manager-user small { display:block; }.manager-user small { margin-top:2px; color:#9fc2df; font-size:10px; }
.manager-user form { margin-left:12px; }.manager-user button { min-height:38px; border:1px solid rgba(255,255,255,.2); border-radius:9px; padding:0 13px; color:#fff; background:rgba(255,255,255,.08); cursor:pointer; }
.manager-content { max-width:1100px; margin:0 auto; padding:42px 24px; }
.manager-empty { max-width:620px; margin-top:28px; padding:36px; border:1px solid var(--ps-border); border-radius:var(--ps-radius-lg); background:#fff; box-shadow:var(--ps-shadow); }
.manager-empty>span { width:48px; height:48px; display:grid; place-items:center; border-radius:12px; color:#fff; background:var(--ps-primary); font-weight:800; }.manager-empty h2 { margin:18px 0 6px; }.manager-empty p { margin:0; color:var(--ps-muted); line-height:1.6; }
@media(max-width:620px){.auth-card,.error-card{padding:24px}.manager-header{align-items:flex-start;padding:14px 16px}.manager-user>span{display:none}.manager-user form{margin-left:0}.manager-content{padding:30px 16px}.manager-brand .brand-subtitle{display:none}}
