/* smwapp – stil de bază */
:root {
  --side: #16233A; --accent: #1F4FB8; --accent-d: #183f94; --orange: #F28C38;
  --bg: #F3F5F8; --card: #fff; --line: #DCE1E9; --line2: #EBEEF3;
  --text: #1B2433; --muted: #66758A; --radius: 12px;
  --ok: #1E6B3A; --ok-bg: #E3F3E8; --warn: #8A4A0F; --warn-bg: #FDEBD8; --er: #B3261E; --er-bg: #FBE7E6;
  --anaf-ok: #1E6B3A; --anaf-err: #B3261E; --anaf-muted: #66758A;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
body.noscroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 20px; } h3 { font-size: 16px; margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.nowrap { white-space: nowrap; } .grow { flex: 1; }

/* sidebar */
.sidebar { width: 240px; flex: none; background: var(--side); color: #C9D3E3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: block; font-size: 26px; font-weight: 700; color: #fff; padding: 22px 24px 26px; letter-spacing: -.5px; text-decoration: none !important; }
.logo span { color: var(--orange); }
.logo.dark { color: var(--side); padding: 0 0 4px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar nav a, .sidebar nav .soon { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; color: #C9D3E3; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar nav .soon { opacity: .45; cursor: default; }
.sidebar nav .soon em { margin-left: auto; font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; }
.sidebar svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; padding: 18px 24px; font-size: 12px; color: #7D8BA3; }

/* zona principală */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 20px; }
.user { display: flex; align-items: center; gap: 12px; text-align: right; }
.user small { display: block; color: var(--muted); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #E6ECF8; color: var(--accent); display: grid; place-items: center; font-weight: 600; }
.content { padding: 28px 32px 48px; max-width: 1860px; width: 100%; }

/* carduri, butoane, badge */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.card.pad, .pad { padding: 22px 24px; }
.card-title { padding: 16px 20px; font-weight: 600; font-size: 15px; border-bottom: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn.secondary:hover { border-color: #b9c3d3; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: #EEF1F5; }
.btn.danger-ghost { background: transparent; color: var(--er); }
.btn.danger-ghost:hover { background: var(--er-bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.blue { background: #E6ECF8; color: var(--accent); }
.badge.gray { background: #EEF1F5; color: #4A5668; }
.badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.orange { background: var(--warn-bg); color: var(--warn); }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: #E6ECF8; color: #1c3a7a; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.er { background: var(--er-bg); color: var(--er); }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--side); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,.2); }

/* formulare */
input, select, textarea { font: inherit; color: var(--text); width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,79,184,.12); }
input.bad, select.bad { border-color: var(--er); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=file] { height: auto; padding: 8px; }
.form label, label.fld { display: block; font-weight: 500; font-size: 13px; color: #3A4658; margin-bottom: 14px; }
.form label > input, .form label > select, label.fld > input, .form label > .suffix, label.fld > .row-inline { margin-top: 6px; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form.narrow, .narrow { max-width: 920px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.row-inline { display: flex; gap: 10px; align-items: center; }
.suffix { display: flex; align-items: center; }
.suffix input { border-radius: 8px 0 0 8px; }
.suffix span { height: 40px; display: grid; place-items: center; padding: 0 12px; background: #F3F5F8; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; color: var(--muted); }
.err { display: block; color: var(--er); font-size: 12px; font-weight: 400; min-height: 0; margin-top: 4px; }
.err:empty { display: none; }
.code { width: 100%; font: 12px/1.5 ui-monospace, Consolas, monospace; background: #F6F8FB; border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; max-height: 420px; overflow: auto; }
.logo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.logo-row img { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.logo-row label { margin: 0; }

/* bară de unelte și tabele */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.filters { display: flex; gap: 10px; align-items: center; flex: 1; }
.filters select { width: auto; min-width: 200px; }
.search { position: relative; flex: 1; max-width: 520px; }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { padding-left: 38px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #F8F9FB; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #F8FAFD; }
.tbl tr.inactive td { color: var(--muted); }
.tbl .empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.tbl.compact td { padding: 6px 8px; }
.tbl.compact th { padding: 8px; }
.actions .dot { color: #b9c3d3; margin: 0 6px; }
.actions .disabled { color: #A7B1C0; cursor: not-allowed; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager { display: flex; gap: 4px; }
.pager a { min-width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--text); text-decoration: none; }
.pager a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* fișa client */
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); }
.client-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.ch-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ch-actions { display: flex; gap: 10px; flex: none; }
.datagrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px 24px; }
.datagrid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.datagrid b { font-weight: 600; word-break: break-word; }
.datagrid b.normal { font-weight: 400; }
.datagrid .wide { grid-column: span 2; }
.datagrid .full { grid-column: 1 / -1; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat { padding: 18px 22px; }
.stat label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat b { font-size: 24px; font-weight: 700; }

/* tab-uri setări */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.split { display: grid; grid-template-columns: 1fr 400px; gap: 20px; align-items: start; }
.roles-help { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; line-height: 1.7; }

/* acasă */
.greet { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.greet h2 { font-size: 24px; }
.soon-card { max-width: 820px; }

/* pop-up */
.modal-back { position: fixed; inset: 0; background: rgba(15,24,40,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px; z-index: 50; overflow: auto; }
.modal-back[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; width: 680px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head .x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 20px 24px 6px; }
.modal-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #FAFBFC; border-radius: 0 0 14px 14px; }
.seg { display: inline-flex; background: #EEF1F5; border-radius: 9px; padding: 3px; margin-bottom: 18px; }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 500; padding: 7px 16px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
#client-form.is-pf .only-pj, #client-form.is-pj .only-pf { display: none !important; }
#client-form .lbl { display: inline-flex; align-items: center; gap: 6px; }
.tag-anaf { display: none; font-style: normal; font-size: 10px; font-weight: 700; color: var(--ok); background: var(--ok-bg); padding: 1px 6px; border-radius: 4px; letter-spacing: .3px; }
#client-form.anaf-filled .tag-anaf { display: inline-block; }
#client-form.is-pf .tag-anaf { display: none !important; }
#client-form .anaf-btn { flex: none; height: 40px; }
#client-form .anaf-msg { font-weight: 400; }

/* autentificare / instalare */
body.auth-page { align-items: center; justify-content: center; background: var(--side); padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; padding: 34px 36px; width: 420px; max-width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.auth-card h2 { font-size: 17px; margin: 18px 0 6px; }
.auth-card .logo { font-size: 30px; }

@media (max-width: 1100px) {
  .sidebar { width: 72px; }
  .sidebar nav a, .sidebar nav .soon { font-size: 0; justify-content: center; padding: 12px; }
  .sidebar nav .soon em { display: none; }
  .logo { font-size: 18px; padding: 20px 10px; text-align: center; }
  .side-foot { display: none; }
  .datagrid { grid-template-columns: repeat(2, 1fr); }
  .stats4 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .client-head, .toolbar { flex-direction: column; align-items: stretch; }
  .filters { flex-wrap: wrap; }
}
