[hidden] { display: none !important; }
:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1c2430; --muted: #6b7684; --line: #dfe3e8;
  --accent: #e8730c; --accent-ink: #fff; --side: #1f2733; --side-ink: #cfd6df;
  --ok: #0a7d38; --err: #b42318; --warn: #b54708;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: #0b5cad; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 14px; }
h1 small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 6px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
code { background: #eceff3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.side { position: fixed; inset: 0 auto 0 0; width: 210px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; }
.brand { padding: 18px 18px 14px; font-weight: 700; color: #fff; font-size: 17px; border-left: 4px solid var(--accent); }
.side nav { flex: 1; overflow-y: auto; }
.side nav a { display: block; padding: 10px 18px; color: var(--side-ink); border-left: 4px solid transparent; }
.side nav a:hover { background: #2a3442; text-decoration: none; }
.side nav a.on { background: #2a3442; color: #fff; border-left-color: var(--accent); }
.who { padding: 14px 18px; border-top: 1px solid #323d4c; font-size: 14px; }
main { margin-left: 210px; padding: 22px 26px 60px; max-width: 1500px; }
main.solo { margin: 0 auto; padding-top: 8vh; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.card.narrow { max-width: 420px; margin: 0 auto; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head h1 { margin: 0; }
.muted { color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #c4cbd3; border-radius: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #f7c9a0; border-color: var(--accent); }
input[type=checkbox], input[type=file] { display: inline-block; width: auto; margin: 0 6px 0 0; padding: 0; border: 0; }
label.check { display: inline-flex; align-items: center; margin: 0; }
.form { max-width: 620px; }
.grid { max-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.grid .wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.inline select { width: auto; margin: 0; }

.btn, button.btn { display: inline-block; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid #c4cbd3; border-radius: 6px; cursor: pointer; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #cf650a; }
.btn.danger { color: var(--err); border-color: #e6b3ad; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: #8fbbe8; cursor: pointer; }
.stopbtns button.link { color: #0b5cad; margin-right: 14px; }

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; margin-top: 2px; }
.filters input[type=search] { min-width: 280px; }
.filters label { margin: 0; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.off td { color: #9aa3ae; }
td.right, th.right { text-align: right; }

.st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #e8ebef; color: #3d4753; }
.st-planificat { background: #dbe9fb; color: #0b4a8f; }
.st-in_curs, .st-ajuns { background: #fdebc8; color: #8a5300; }
.st-finalizat, .st-gata { background: #d5f1df; color: #0a6130; }
.st-anulat { background: #f8dcd9; color: #8f1d14; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; background: #d5f1df; color: #0a6130; }
.flash.err { background: #f8dcd9; color: #8f1d14; }
.flash.info { background: #dbe9fb; color: #0b4a8f; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; color: var(--muted); }
.tile .n { font-size: 24px; font-weight: 700; color: var(--ink); }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.docs { padding-left: 18px; }
.pager a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; margin: 0 2px 4px 0; background: #fff; }
.pager a.on { background: var(--side); color: #fff; }
#map { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; z-index: 0; }

.chat { display: grid; grid-template-columns: 250px 1fr; gap: 14px; }
.chatlist { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: start; }
.chatlist a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.chatlist a.on { background: #fdf1e5; }
.msgs { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; max-height: 55vh; overflow-y: auto; }
.msg { max-width: 70%; padding: 8px 12px; border-radius: 10px; background: #eef1f4; margin-bottom: 8px; }
.msg.me { margin-left: auto; background: #fdebd6; }
.msg small { color: var(--muted); font-size: 11px; }
.send { display: flex; gap: 10px; margin-top: 10px; align-items: end; }
.send textarea { margin: 0; }

@media (max-width: 820px) {
  .side { position: static; width: auto; }
  .side nav { display: flex; flex-wrap: wrap; }
  main { margin-left: 0; padding: 16px; }
  .chat { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}
@media print {
  .side, .noprint, .flash { display: none !important; }
  main { margin: 0; padding: 0; }
  body { background: #fff; }
}
