:root {
  --navy: #081A2E; --navy2: #0E2A48; --navy3: #1A3A5E;
  --orange: #E8632B; --green: #2E7D4F; --blue: #3E81C5; --blue2: #1768AC;
  --bg: #F6F3EE; --card: #FFFFFF; --ink: #081A2E; --muted: #5B6B7D; --line: #E3DED6; --sel: #E6EAED; --red: #C0392B;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
#app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
#meniu { background: var(--navy); color: #fff; position: sticky; top: 0; height: 100vh; overflow: auto; }
#meniu .logo { padding: 18px 18px 14px; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.08); }
#meniu .logo .ai { background: var(--orange); border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
#meniu .logo small { opacity: .6; font-weight: 600; margin-left: 4px; }
#arbore details { border-bottom: 1px solid rgba(255,255,255,.05); }
#arbore summary { list-style: none; cursor: pointer; padding: 11px 18px; font-weight: 600; font-size: 14px; color: #fff; }
#arbore summary::-webkit-details-marker { display: none; }
#arbore summary::before { content: "▸"; display: inline-block; width: 16px; opacity: .6; transition: transform .15s; }
#arbore details[open] summary::before { transform: rotate(90deg); }
#arbore a { display: block; padding: 8px 18px 8px 38px; color: rgba(255,255,255,.82); text-decoration: none; font-size: 14px; }
#arbore a:hover { background: var(--navy3); color: #fff; }
#arbore a.activ { background: var(--navy2); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
#arbore a.single { padding-left: 18px; font-weight: 600; }
#corp { min-width: 0; display: flex; flex-direction: column; }
#sus { display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#titlu { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cautare { width: min(420px, 45vw); padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); }
#btn-meniu { display: none; }
.icon { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--navy); }
main { padding: 20px 22px 90px; outline: none; }
#jos { display: none; }

/* Aktionsleiste wie SoftOne */
.bara { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.btn { border: 0; border-radius: 9px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--blue); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.prim { background: var(--orange); }
.btn.ok { background: var(--green); }
.btn.sec { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.per { background: #fff; color: var(--red); border: 1px solid #F0C9C4; }
.btn:disabled { opacity: .5; cursor: default; }
.filtre { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filtre select, .filtre input, .f input, .f select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi div { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-size: 22px; }
.kpi span { color: var(--muted); font-size: 13px; }

table.t { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.t th, .t td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { background: #FBFAF7; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.t td.n, .t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover { background: var(--sel); }
.t tfoot td { font-weight: 700; background: #FBFAF7; }
.st { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.st.ciorna { background: #FFF1E9; color: #B0461A; }
.st.emis { background: #E7F3EC; color: var(--green); }
.st.anulat { background: #EEE; color: #666; }
.cards { display: none; }

.cap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; }
.cap label { display: block; font-size: 12px; color: var(--muted); }
.cap div > span { font-weight: 600; }
.lant { display: flex; flex-wrap: wrap; gap: 0; align-items: center; margin: 4px 0 2px; }
.lant a { text-decoration: none; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.lant a.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.lant a.ciorna { border-style: dashed; }
.lant i { width: 18px; height: 2px; background: var(--line); display: inline-block; }
.tot { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 4px 24px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.tot b { text-align: right; }
.harta-w { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.harta-w svg { width: 100%; height: auto; display: block; }
.leg { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin-top: 8px; }
.leg i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.leg i.r { border-radius: 2px; transform: rotate(45deg); }
dialog { border: 0; border-radius: 14px; padding: 20px; width: min(440px, 92vw); box-shadow: 0 30px 60px -20px rgba(8,26,46,.45); }
dialog::backdrop { background: rgba(8,26,46,.45); }
.f { display: grid; gap: 10px; margin: 12px 0 16px; }
.f label { font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: 90vw; }
#toast.on { opacity: 1; }
#toast.err { background: var(--red); }
.gol { color: var(--muted); padding: 30px; text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: var(--r); }
.muted { color: var(--muted); }

/* Handy: Menü unten, Listen als Karten */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #meniu { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-105%); transition: transform .2s; height: 100%; }
  #app.meniu-deschis #meniu { transform: none; box-shadow: 0 0 0 100vmax rgba(8,26,46,.4); }
  #btn-meniu { display: block; }
  #sus { padding: 10px 14px; flex-wrap: wrap; }
  #cautare { width: 100%; order: 3; }
  main { padding: 14px 14px 96px; }
  #jos { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
  #jos a { text-align: center; text-decoration: none; color: var(--muted); font-size: 11px; padding: 7px 0 8px; font-weight: 600; }
  #jos a span { display: block; font-size: 20px; line-height: 1.2; }
  #jos a.activ { color: var(--orange); }
  table.t.lista { display: none; }
  .cards { display: grid; gap: 10px; }
  .cards a { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: inherit; text-decoration: none; }
  .cards .r1 { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
  .cards .r2 { color: var(--muted); font-size: 13px; margin-top: 3px; }
  .btn { padding: 11px 14px; }
  .t.linii th:nth-child(1), .t.linii td:nth-child(1), .t.linii th:nth-child(5), .t.linii td:nth-child(5) { display: none; }
}
.cap select, .cap input, .t td input, .t td select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff; }
.t td input.q, .t td input.d { max-width: 80px; text-align: right; }
.t td input.p { max-width: 130px; text-align: right; }
@media print { #meniu, #jos, #sus input, .bara, #btn-meniu { display: none !important; } #app { display: block; } main { padding: 0; } }

#cont { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; }
.btn.mic { padding: 6px 10px; font-size: 13px; }
.mic { font-size: 13px; }
.btn.mare { width: 100%; justify-content: center; padding: 14px; font-size: 16px; margin: 8px 0; }
#app.login { grid-template-columns: 1fr; }
#app.login #meniu, #app.login #jos, #app.login #sus { display: none; }
.login-card { max-width: 420px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 26px; box-shadow: 0 30px 60px -40px rgba(8,26,46,.5); }
.login-card h2 { margin: 6px 0 8px; }
.logo-mare { font-weight: 800; font-size: 18px; color: var(--navy); }
.logo-mare .ai { background: var(--orange); color: #fff; border-radius: 7px; padding: 2px 7px; margin-right: 4px; }
@media (max-width: 860px) { #cont .muted { display: none; } }
