:root {
  --navy: #10243d;
  --navy-2: #173454;
  --ink: #1c2b3a;
  --muted: #5d6b7c;
  --gold: #a56b2b;
  --gold-2: #f4e7d1;
  --paper: #eef3f7;
  --card: #ffffff;
  --line: #d5e0ea;
  --teal: #1d6b66;
  --good: #1e7a4d;
  --wait: #8d6414;
  --bad: #9d3b34;
  --new: #2d5f8a;
  --late: #8a3d12;
  --shadow: 0 10px 30px rgba(16, 36, 61, .06);
  --sidebar: 272px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px; z-index: 9; }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy), #0b1b30); color: #e8eef5; padding: 18px 14px 28px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 16px; }
.mark { width: 42px; height: 42px; border: 1px solid rgba(245, 214, 168, .7); display: grid; place-items: center; font-weight: 700; letter-spacing: .04em; color: #f3d7a6; }
.brand strong { display: block; font-size: 18px; letter-spacing: .12em; }
.brand span { color: #b7c6d6; font-size: 12px; }
.nav a, .nav summary { color: #d5e2ef; text-decoration: none; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.08); color: white; }
.nav-group { margin: 4px 0 8px; }
.nav-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: transparent; border: 0; color: #f0d7ae; font: inherit; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 10px 10px 6px; cursor: pointer; border-radius: 8px; }
.nav-group.is-current > .nav-toggle, .nav-group.is-open > .nav-toggle { color: white; background: rgba(255,255,255,.06); }
.chevron { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s ease; flex: 0 0 auto; }
.nav-group.is-open .chevron { transform: rotate(45deg); }
.nav-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav-group.is-open .nav-sub { grid-template-rows: 1fr; }
.nav-sub-inner { overflow: hidden; }
.nav-group a { font-size: 14px; padding-left: 14px; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 22px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar form, .who { display: flex; gap: 10px; align-items: center; }
.who small { color: var(--muted); display: block; }
.content { padding: 22px; }
.banner, .tour, .flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.banner { background: var(--gold-2); color: #6b4a16; border: 1px solid #e4d0ae; }
.tour { background: #e7f3f2; border: 1px solid #b7ddd9; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
dialog { border: 0; border-radius: 16px; padding: 18px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 18px 50px rgba(15, 35, 64, .25); }
dialog::backdrop { background: rgba(15, 35, 64, .45); }
dialog h3 { margin-top: 0; }
.flash.ok { background: #e8f6ee; color: #14613a; }
.flash.error { background: #fdeceb; color: #8d2e28; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions, .filters, .inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.stat-grid, .split, .module-grid, .inst-grid { display: grid; gap: 12px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stat span, .stat em { display: block; color: var(--muted); font-style: normal; font-size: 13px; }
.stat strong { display: block; font-size: 26px; margin: 6px 0; letter-spacing: -.03em; }
.split { grid-template-columns: 1.4fr .8fr; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th a { color: var(--muted); text-decoration: none; }
tr:hover td { background: #f7fafc; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: #e8eef5; color: var(--new); }
.tone-nou { background: #e7f0f8; color: var(--new); }
.tone-in-lucru { background: #e7f4f3; color: var(--teal); }
.tone-asteptare { background: #f8f1df; color: var(--wait); }
.tone-aprobat { background: #e5f6ec; color: var(--good); }
.tone-respins { background: #fdeceb; color: var(--bad); }
.tone-finalizat { background: #eceff3; color: #3e4c5e; }
.tone-intarziat { background: #fde8dc; color: var(--late); }
.btn, button, .topbar select, .filters input, .filters select, .form input, .form select, .form textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px;
}
.sidebar .nav-toggle { background: transparent; border: 0; color: #f0d7ae; padding: 10px 10px 6px; border-radius: 8px; }
.btn { display: inline-flex; text-decoration: none; color: var(--ink); cursor: pointer; }
.btn.primary, button.primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn.ghost { background: transparent; }
.btn.warn { background: #fdeceb; color: var(--bad); border-color: #f3c7c3; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .wide, .form .actions { grid-column: 1 / -1; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form textarea { min-height: 110px; }
.pager { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bars { display: grid; gap: 8px; }
.bars.usage .bar { grid-template-columns: 180px 1fr auto; }
.bar { display: grid; grid-template-columns: 140px 1fr 48px; gap: 8px; align-items: center; text-decoration: none; color: inherit; font-size: 13px; }
.bar i { display: block; height: 10px; background: linear-gradient(90deg, var(--teal), var(--navy)); border-radius: 99px; }
.tree, .tree ul { list-style: none; padding-left: 16px; }
.tree { padding-left: 0; }
.osm-map { height: 560px; border-radius: 16px; background: #e7eef2; }
.road-key { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 0 0 14px; font-size: 14px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; background: #7d8b99; }
.swatch.blocked { background: #d64545; }
.swatch.slow { background: #e0a100; }
.swatch.work { background: #f3d27a; }
.swatch.snow { background: #d7e7f5; }
.swatch.cam { background: #10243d; }
.road-pin, .cam-pin { background: transparent; border: 0; }
.road-badge { display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 50%; background: #fff; border: 2px solid #10243d; font-size: 18px; }
.cam-pin { text-align: center; }
.cam-count { display: inline-block; min-width: 28px; padding: 1px 6px; border-radius: 8px; background: #10243d; color: #fff; font-size: 12px; font-weight: 700; }
.cam-body { display: flex; width: 28px; height: 22px; margin: 3px auto 0; border-radius: 4px; background: #1d6b66; align-items: center; justify-content: center; }
.leaflet-popup-content img { display: block; width: 240px; max-width: 100%; height: auto; margin-top: 8px; border-radius: 8px; }
.osm-note { color: var(--muted); margin: 0 0 10px; }
.leaflet-popup-content { margin: 10px 12px; line-height: 1.4; }
.leaflet-popup-content a { color: var(--navy); }
.chat { display: grid; gap: 10px; }
.bubble { padding: 12px 14px; border-radius: 14px; background: #f4f7fa; }
.bubble.user { background: #e7eef8; }
.note { color: var(--muted); font-size: 13px; }
.public { background: #f6f8fb; color: var(--ink); }
.hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: 28px; padding: 48px 7vw 24px; align-items: end; }
.hero h1 { font-size: 52px; line-height: .95; letter-spacing: -.04em; margin: 0 0 12px; }
.kicker { letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-size: 12px; }
.public-nav { display: flex; justify-content: space-between; padding: 18px 7vw; align-items: center; }
.public-nav a { margin-left: 14px; text-decoration: none; }
.section { padding: 10px 7vw 28px; }
.module-grid, .inst-grid { grid-template-columns: repeat(3, 1fr); }
.module-grid article, .inst-grid article { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-copy { background: var(--navy); color: white; padding: 64px; }
.login-copy h1 { font-size: 46px; line-height: 1; letter-spacing: -.04em; }
.login-panel { padding: 48px; }
.accounts { display: grid; gap: 6px; font-size: 13px; }
footer.site { padding: 28px 7vw 40px; color: var(--muted); }
.menu-btn { display: none; }
@media (max-width: 1100px) {
  .stat-grid, .module-grid, .inst-grid { grid-template-columns: 1fr 1fr; }
  .hero, .login-wrap, .split { grid-template-columns: 1fr; }
  .hero h1 { font-size: 38px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 8; transform: translateX(-105%); width: min(84vw, 320px); transition: .2s transform; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .stat-grid, .form, .module-grid, .inst-grid, .bar { grid-template-columns: 1fr; }
  .topbar, .page-head, .tour { flex-direction: column; align-items: stretch; }
  .content, .hero, .section, .login-copy, .login-panel { padding: 18px; }
  .osm-map { height: 70vh; }
}
