:root {
  --bg: #f1f5f9; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --brand: #0f172a;
  --accent: #0284c7; --ok: #16a34a; --warn: #d97706; --err: #dc2626; --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
small, .muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* layout */
.top { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #e2e8f0; padding-top: env(safe-area-inset-top); }
.top .bar { display: flex; align-items: center; gap: .75rem; max-width: 1500px; margin: 0 auto; padding: .55rem 1rem; }
.top .logo { color: #fff; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.top .logo span { color: #38bdf8; }
.top nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.top nav a { color: #cbd5e1; padding: .4rem .65rem; border-radius: 8px; white-space: nowrap; font-size: .92rem; }
.top nav a:hover { background: #1e293b; text-decoration: none; }
.top nav a.on { background: #1e293b; color: #fff; }
.top .me { color: #94a3b8; font-size: .85rem; white-space: nowrap; }
.top .me a { color: #cbd5e1; }
main { max-width: 1500px; margin: 0 auto; padding: 1rem 1rem 6rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 2rem; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }

/* bottom tab bar on phones */
.tabs { display: none; }
@media (max-width: 760px) {
  .top nav, .top .me .name { display: none; }
  .tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
          padding-bottom: env(safe-area-inset-bottom); }
  .tabs a { flex: 1; text-align: center; padding: .55rem 0 .5rem; color: var(--muted); font-size: .75rem; }
  .tabs a b { display: block; font-size: 1.25rem; line-height: 1.2; }
  .tabs a.on { color: var(--accent); }
  main { padding: .75rem .75rem 6rem; }
}

/* controls */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600;
  padding: .55rem .95rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  text-decoration: none; min-height: 40px; }
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok, button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn, button.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.danger, button.danger { background: #fff; border-color: #fecaca; color: var(--err); }
.btn.big, button.big { min-height: 52px; font-size: 1.05rem; padding: .7rem 1.2rem; }
.btn.sm, button.sm { min-height: 32px; padding: .3rem .6rem; font-size: .85rem; }
.btn.block, button.block { width: 100%; }
input, select, textarea { font: inherit; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink);
  min-height: 42px; width: 100%; }
input[type=checkbox] { width: auto; min-height: 0; transform: scale(1.25); }
input[type=color] { padding: 2px; width: 48px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #7dd3fc; border-color: var(--accent); }
label { display: block; font-size: .85rem; color: #334155; font-weight: 600; margin-bottom: .2rem; }
.field { margin-bottom: .8rem; }
.fields { display: grid; gap: 0 .9rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.inline { display: inline; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* flash + badges */
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash.ok { background: #dcfce7; color: #14532d; }
.flash.warn { background: #fef3c7; color: #78350f; }
.flash.err { background: #fee2e2; color: #7f1d1d; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge.programat { background: #e0f2fe; color: #075985; }
.badge.sosit { background: #fef3c7; color: #92400e; }
.badge.descarcare { background: #ede9fe; color: #5b21b6; }
.badge.finalizat { background: #dcfce7; color: #166534; }
.badge.neprezentat { background: #fee2e2; color: #991b1b; }
.badge.anulat { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.badge.alert { background: #fee2e2; color: #991b1b; }
.badge.tag { color: #fff; }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; vertical-align: middle; }

/* tables */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.off td { opacity: .5; }

/* week plan */
.week { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.day { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 200px; }
.day.today { outline: 2px solid var(--accent); }
.day.free { background: repeating-linear-gradient(135deg, #f8fafc 0 10px, #f1f5f9 10px 20px); }
.day header { padding: .65rem .75rem .5rem; border-bottom: 1px solid var(--line); }
.day header .d { font-weight: 700; }
.load { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: .35rem; }
.load i { display: block; height: 100%; background: var(--ok); }
.load i.mid { background: var(--warn); }
.load i.full { background: var(--err); }
.slots { padding: .5rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.slot { display: block; border-left: 4px solid var(--c, #64748b); background: #f8fafc; border-radius: 8px; padding: .4rem .55rem; color: var(--ink); font-size: .86rem; }
.slot:hover { text-decoration: none; background: #f1f5f9; }
.slot .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .f { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.finalizat { opacity: .65; }
.slot.anulat, .slot.neprezentat { opacity: .45; text-decoration: line-through; }
.slot.has-alert { background: #fff1f2; }
.lunch { font-size: .75rem; color: var(--muted); text-align: center; border: 1px dashed #cbd5e1; border-radius: 6px; padding: .15rem; }
.add { margin: .25rem .5rem .6rem; }

/* timeline */
.timeline { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.tl-grid { display: grid; grid-template-columns: 110px 1fr; min-width: 900px; }
.tl-label { padding: .5rem; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .85rem; }
.tl-lane { position: relative; border-bottom: 1px solid var(--line); min-height: 56px; }
.tl-hours { position: relative; height: 26px; border-bottom: 1px solid var(--line); }
.tl-hours span { position: absolute; font-size: .72rem; color: var(--muted); transform: translateX(-50%); top: 5px; }
.tl-lane .h { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #eef2f7; }
.tl-item { position: absolute; top: 6px; bottom: 6px; background: var(--c, #64748b); color: #fff; border-radius: 6px; padding: 2px 5px;
  font-size: .72rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.25; }
.tl-item:hover { text-decoration: none; filter: brightness(1.1); z-index: 2; }
.tl-item.ghost { background: repeating-linear-gradient(45deg, #cbd5e1 0 6px, #e2e8f0 6px 12px); color: #334155; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); z-index: 3; }

/* receptie (mobil) */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem; text-align: center; }
.kpi b { display: block; font-size: 1.4rem; }
.kpi small { font-size: .75rem; }
.truck { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .75rem; border-left: 6px solid var(--c, #64748b); }
.truck summary { list-style: none; padding: .75rem .9rem; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; align-items: center; }
.truck summary::-webkit-details-marker { display: none; }
.truck .time { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.truck .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.truck .meta { grid-column: 2 / 4; font-size: .85rem; color: var(--muted); }
.truck .body { padding: 0 .9rem .9rem; border-top: 1px solid var(--line); }
.truck.late { box-shadow: 0 0 0 2px #fca5a5, var(--shadow); }
.truck .actions { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; margin-top: .75rem; }
.truck .actions .wide { grid-column: 1 / -1; }
.obs { display: flex; flex-wrap: wrap; gap: .4rem; }
.obs label { margin: 0; }
.obs input { display: none; }
.obs span { display: inline-block; padding: .45rem .75rem; border: 1px solid #cbd5e1; border-radius: 999px; font-weight: 500; cursor: pointer; }
.obs input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.2rem 0 .5rem; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.fab { position: fixed; right: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 25; border-radius: 999px; box-shadow: 0 6px 18px rgba(2, 132, 199, .35); }
@media (min-width: 761px) { .fab { bottom: 1.5rem; } }

/* dialogs */
dialog { border: 0; border-radius: 16px; padding: 1.25rem; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #0f172a, #0c4a6e); padding: 1rem; }
.login .card { width: min(380px, 100%); }
.login h1 { text-align: center; }

/* reports */
.bar-h { height: 8px; border-radius: 4px; background: #e2e8f0; overflow: hidden; min-width: 60px; }
.bar-h i { display: block; height: 100%; background: var(--ok); }
.stat { font-size: 1.6rem; font-weight: 800; }
.install { display: none; }
.install.show { display: inline-flex; }
@media print { .top, .tabs, .no-print, .fab { display: none !important; } main { padding: 0; } .card, .day { box-shadow: none; border: 1px solid #ccc; } }

/* sub-meniu administrare */
.subnav { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0 0 1rem; }
.subnav a { padding: .35rem .75rem; border-radius: 999px; background: #e2e8f0; color: var(--ink); text-decoration: none; font-size: .9rem; }
.subnav a.on { background: var(--ink); color: #fff; }
.perm-grid { display: grid; gap: .35rem; margin: .5rem 0 .75rem; }
textarea { width: 100%; }
