:root {
  --bg: #f4f5f7; --panel: #ffffff; --line: #e3e6ea; --line-2: #d3d8de;
  --text: #16191d; --muted: #646d78; --dim: #9aa3ad;
  --accent: #e8590c; --accent-2: #c94a06; --accent-bg: #fff1e8;
  --urgent: #d92d2d; --urgent-bg: #fdecec; --work: #b7791f; --work-bg: #fff6e0;
  --assigned: #1f6fd1; --assigned-bg: #e8f1fc; --ok: #138a4b; --ok-bg: #e5f6ec;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--assigned); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Bară de sus */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: #16191d; color: #fff; }
.topbar .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.topbar .logo i { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 14px; }
.topbar nav { display: flex; gap: 2px; margin-left: 12px; overflow-x: auto; }
.topbar nav button { background: none; border: 0; color: #b9c0c8; padding: 8px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.topbar nav button:hover { background: #262a30; color: #fff; }
.topbar nav button.on { background: #2c3138; color: #fff; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #b9c0c8; font-size: 14px; white-space: nowrap; }
.topbar .right button { background: #2c3138; border: 0; color: #fff; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.count { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sp { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Componente */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 15px; }
.panel-h .sp { margin-left: auto; }
.panel-b { padding: 14px 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g-dash { grid-template-columns: 1.15fr 1fr; }
@media (max-width: 900px) { .g2, .g-dash { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--urgent); border-color: var(--urgent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 14px 18px; font-size: 16px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }

label.f { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 15px; color: var(--text); }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.form-grid { display: grid; gap: 12px; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; border-right: 1px solid var(--line-2); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); }
.seg label:has(input:checked) { background: var(--accent-bg); }
.seg label.u:has(input:checked) { background: var(--urgent-bg); }
.seg label.u:has(input:checked) span { color: var(--urgent); }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.tag.urgent { background: var(--urgent); color: #fff; }
.tag.nou, .tag.cerut { background: #eef0f3; color: var(--muted); }
.tag.alocat, .tag.aprobat { background: var(--assigned-bg); color: var(--assigned); }
.tag.in_lucru, .tag.comandat { background: var(--work-bg); color: var(--work); }
.tag.rezolvat, .tag.livrat { background: var(--ok-bg); color: var(--ok); }
.tag.anulat, .tag.respins { background: #f1f1f1; color: var(--dim); text-decoration: line-through; }
.tag.liber { background: var(--ok-bg); color: var(--ok); }
.tag.ocupat { background: var(--work-bg); color: var(--work); }
.tag.absent { background: #eef0f3; color: var(--dim); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.liber { background: var(--ok); } .dot.ocupat { background: var(--work); } .dot.absent { background: var(--line-2); }

.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; }
.empty { color: var(--dim); text-align: center; padding: 26px 10px; }
.mono { font-variant-numeric: tabular-nums; }

/* Tabele / liste */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fafbfc; }
.tscroll { overflow-x: auto; }

.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .main { flex: 1; min-width: 0; }
.li .ttl { font-weight: 600; }
.li .sub { color: var(--muted); font-size: 13px; }

/* Card tehnician (dashboard) */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tm { border: 1px solid var(--line); border-radius: 9px; padding: 12px; display: grid; gap: 6px; background: #fff; }
.tm.absent { background: #fafbfc; }
.tm.absent .nm { color: var(--muted); }
.tm .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tm .ln { font-size: 13px; color: var(--muted); }
.tm .work { font-size: 13px; background: var(--work-bg); border-radius: 6px; padding: 5px 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.kpi.u .v { color: var(--urgent); }

.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-bg); border: 1px solid #ffd2b8; margin-bottom: 16px; flex-wrap: wrap; }
.notice.red { background: var(--urgent-bg); border-color: #f7c5c5; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { padding: 18px 20px 4px; font-size: 18px; }
.modal-body { padding: 12px 20px; display: grid; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* Notificări */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(420px, calc(100% - 32px)); }
.toast { background: #16191d; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; font-weight: 500; }
.toast.err { background: var(--urgent); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Autentificare */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #16191d; }
.auth .box { background: #fff; width: min(400px, 100%); border-radius: 16px; padding: 28px; display: grid; gap: 16px; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.auth .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.auth .logo i { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-style: normal; }
.err-msg { color: var(--urgent); font-size: 14px; min-height: 1em; }

@media (max-width: 700px) {
  main { padding: 14px 12px 80px; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; margin-left: 0; }
  .hide-m { display: none; }
}
