:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #667085;
  --line: #e3e7ee;
  --nav: #2e3233;
  --nav-ink: #d3d6d6;
  --accent: #288a35;
  --accent-soft: #e6f3e8;
  --ok: #1f8a4c;
  --ok-soft: #e5f5ec;
  --warn: #b26b00;
  --warn-soft: #fff4e0;
  --bad: #c0362c;
  --bad-soft: #fdecea;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.nowrap { white-space: nowrap; }

/* layout */
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--nav) 228px, var(--bg) 228px); }
.sidebar { background: var(--nav); color: var(--nav-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 10px 16px; line-height: 1.25; }
.brand small { display: block; color: var(--nav-ink); font-weight: 400; font-size: 11px; opacity: .8; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 6px; }
.sidebar a { display: block; color: var(--nav-ink); padding: 7px 10px; border-radius: 7px; font-size: 13.5px; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar a.active { background: var(--accent); color: #fff; }
.sidebar .user-box { margin-top: 22px; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; }
.sidebar .user-box form { display: inline; }
.sidebar .user-box button { background: none; border: 0; color: var(--nav-ink); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-toggle { display: none; }

/* cards & grid */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 18px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .value { color: var(--bad); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
tr:hover td { background: #fafcff; }
tfoot td { font-weight: 650; background: #fafbfc; border-top: 2px solid var(--line); }
td.actions { white-space: nowrap; text-align: right; }

/* badges & bars */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #475467; white-space: nowrap; }
.b-in_lucru, .b-acceptata { background: var(--accent-soft); color: var(--accent); }
.b-contractat, .b-trimisa { background: #f1ecfd; color: #6941c6; }
.b-finalizat, .b-receptionat { background: var(--ok-soft); color: var(--ok); }
.b-suspendat, .b-ofertare, .b-draft { background: var(--warn-soft); color: var(--warn); }
.b-anulat, .b-respinsa, .b-late { background: var(--bad-soft); color: var(--bad); }
.progress { background: #edf0f4; border-radius: 999px; height: 8px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress.done > span { background: var(--ok); }
.prog-cell { display: flex; align-items: center; gap: 8px; }
.prog-cell .progress { flex: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* forms */
label { display: block; font-size: 12px; font-weight: 600; color: #344054; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=month],
select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd5df; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
input[type=color] { width: 60px; height: 36px; padding: 2px; border: 1px solid #cfd5df; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.form-grid .span4 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; }
.check input { width: 18px; height: 18px; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { min-width: 120px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > div { min-width: 140px; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd5df; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1f6f2a; }
.btn.danger { color: var(--bad); border-color: #f1c4c0; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; }
.btn.link.danger { color: var(--bad); }
form.inline { display: inline; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; border: 1px solid transparent; }
.flash.success { background: var(--ok-soft); color: #14653a; border-color: #bfe5cf; }
.flash.danger { background: var(--bad-soft); color: #962a22; border-color: #f4c7c3; }
.flash.warning { background: var(--warn-soft); color: #8a5300; border-color: #f6dcae; }
.flash.info { background: var(--accent-soft); color: #1d6528; }

/* detail list */
dl.details { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.details dt { color: var(--muted); font-size: 12.5px; }
dl.details dd { margin: 0; }

/* planning board */
.board { border-collapse: separate; border-spacing: 0; min-width: 900px; table-layout: fixed; }
.board th, .board td { border-right: 1px solid var(--line); vertical-align: top; }
.board th.day { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12px; }
.board th.day.off, .board td.off { background: #f6f7f9; }
.board th.day.today { background: var(--accent-soft); color: var(--accent); }
.board td.team { font-weight: 650; width: 150px; background: #fff; position: sticky; left: 0; z-index: 1; }
.board td.cell { height: 64px; padding: 4px; }
.chip { display: block; font-size: 11.5px; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board td.off .chip:not(.log) { opacity: .5; }
.chip.log { background: #fff; color: var(--ok); border: 1px dashed var(--ok); }
.chip.log.extra { color: var(--warn); border-color: var(--warn); }

/* gantt */
.gantt { position: relative; }
.gantt-row { display: grid; grid-template-columns: 260px 1fr; border-bottom: 1px solid var(--line); min-height: 38px; align-items: center; }
.gantt-row .name { padding: 6px 12px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 38px; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / 16) 100%; }
.gantt-bar { position: absolute; top: 9px; height: 20px; border-radius: 5px; background: var(--accent-soft); border: 1px solid #b8cdf4; overflow: hidden; }
.gantt-bar > span { display: block; height: 100%; background: var(--accent); opacity: .85; }
.gantt-bar.late { border-color: var(--bad); }
.gantt-head { display: grid; grid-template-columns: 260px 1fr; border-bottom: 1px solid var(--line); background: #fafbfc; }
.gantt-weeks { display: grid; grid-template-columns: repeat(16, 1fr); font-size: 11px; color: var(--muted); }
.gantt-weeks div { padding: 6px 4px; border-left: 1px solid var(--line); }
.today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .6; z-index: 2; pointer-events: none; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars .bar span { display: block; width: 100%; max-width: 46px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .bar small { font-size: 11px; color: var(--muted); margin-top: 4px; }
.bars .bar em { font-style: normal; font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }

.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--nav); }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 360px; }
.login-card h1 { margin-bottom: 4px; }
.login-card .field { margin-top: 14px; }

/* mobile (șef echipă) */
.mobile { max-width: 640px; margin: 0 auto; padding: 0 0 80px; }
.mobile-top { background: var(--nav); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 5; }
.mobile-top a, .mobile-top button { color: #fff; font-size: 13px; }
.mobile-top button { background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.mobile-body { padding: 14px; }
.mobile .card { padding: 14px; }
.big-btn { display: block; width: 100%; text-align: center; padding: 15px; font-size: 16px; font-weight: 700; border-radius: 10px; background: var(--accent); color: #fff; border: 0; cursor: pointer; }
.big-btn:hover { text-decoration: none; background: #1f6f2a; }
.mobile input, .mobile select, .mobile textarea { font-size: 16px; padding: 11px 12px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.person-row label.check { flex: 1; font-size: 15px; margin: 0; }
.person-row input[type=number] { width: 90px; text-align: center; }
.log-item { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.log-item:hover { text-decoration: none; background: #fafcff; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; height: 30px; }
.range-row output { font-weight: 700; font-size: 18px; min-width: 52px; text-align: right; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span3 { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 20; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .btn.menu-toggle { display: inline-flex; }
  .layout { background: var(--bg); }
  .main { padding: 14px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-grid .span3 { grid-column: auto; }
  dl.details { grid-template-columns: 120px 1fr; }
}
@media print {
  .sidebar, .topbar .actions, .filters, .no-print { display: none !important; }
  .layout { display: block; }
  .card { break-inside: avoid; }
}

td.proj-col { min-width: 230px; }

/* operațiuni */
.ops-group { margin-bottom: 10px; }
.ops-stage { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 10px 0 4px; }
label.check.op { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
label.check.op.done { color: var(--muted); }
.mobile label.check.op { font-size: 15px; padding: 11px 0; }
.mobile label.check.op input { width: 22px; height: 22px; flex: none; }

/* PWA tehnicieni */
body.tech { background: var(--bg); }
body.tech .mobile { padding-bottom: 90px; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; max-width: 640px; margin: 0 auto; }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 9px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tabbar a span { display: block; font-size: 20px; line-height: 1.2; }
.tabbar a.on { color: var(--accent); }
.tabbar a:hover { text-decoration: none; }
.big-btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.alert-card { border-color: #f4c7c3; background: var(--bad-soft); }
.steps { margin-top: 12px; display: grid; gap: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; }
.step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #e4e8ee; color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.step.done .n { background: var(--ok); color: #fff; }
.step.bad .n { background: var(--bad); color: #fff; }
.yn { padding: 10px 0; border-bottom: 1px solid var(--line); }
.yn .q { font-size: 15px; margin-bottom: 8px; }
.yn-btns { display: flex; gap: 8px; }
.yn-btns label { flex: 1; margin: 0; }
.yn-btns input { position: absolute; opacity: 0; }
.yn-btns span { display: block; text-align: center; padding: 10px; border: 1px solid #cfd5df; border-radius: 9px; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer; }
.yn-btns input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.yn-btns label.no input:checked + span { background: var(--bad); border-color: var(--bad); }
.quiz-q .q-text { font-size: 16px; font-weight: 650; margin: 6px 0 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; font-size: 15px; font-weight: 500; cursor: pointer; }
.choice input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.person-row label.check > span { flex: 1; }

.brand img { display: block; width: 168px; height: auto; margin-bottom: 4px; }
.login-card .logo { display: block; width: 220px; margin: 0 auto 14px; }
.mobile-top .app-icon { width: 26px; height: 26px; vertical-align: middle; margin-right: 8px; border-radius: 50%; }
.center { text-align:center; }
.stage-tpl td { vertical-align: top; }
.stage-tpl textarea { min-width: 320px; font-size: 13px; }
.flash.info { background: #eef5ff; color: #1d4f8a; border-color: #c9dcf5; }
.cal { width: 100%; table-layout: fixed; border-collapse: collapse; }
.cal th { font-size: 11px; color: var(--muted); padding: 2px; text-align: center; }
.cal td { border: 1px solid var(--line); height: 46px; vertical-align: top; padding: 2px 3px; font-size: 11px; }
.cal td .dn { font-weight: 700; font-size: 12px; }
.cal td .pc { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 2px; margin-top: 2px; font-size: 9.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal td.off { background: #f1f2f4; }
.cal td.past { opacity: .45; }
.cal td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal td.empty { border: none; }
