/* ============================================================================
   SelfPay — tema vizuala
   --------------------------------------------------------------------------
   REBRAND RAPID: schimba doar variabilele din blocul `:root` de mai jos
   (--brand-1, --brand-2, --accent) cu codurile de brand flexiom.tech si tot
   site-ul se reculege. Restul fisierului nu trebuie atins.
   ============================================================================ */

:root {
  /* >>> CULORI DE BRAND — schimba aici cand ai hex-urile flexiom.tech <<< */
  --brand-1: #6366f1;   /* indigo */
  --brand-2: #06b6d4;   /* cyan   */
  --accent:  #22d3ee;   /* accent luminos */
  --ok:      #10b981;
  --warn:    #f59e0b;
  --err:     #ef4444;

  --grad-brand: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -12px rgba(0,0,0,.55);
  --trans: .35s cubic-bezier(.22,1,.36,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

/* ---------- TEMA DARK (implicita) ---------- */
:root, [data-theme="dark"] {
  --bg:        #0b0e1a;
  --bg-2:      #0f1424;
  --surface:   rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.07);
  --border:    rgba(255,255,255,.10);
  --text:      #e8ecf6;
  --text-dim:  #97a0b8;
  --glass-blur: 16px;
  --grid-line: rgba(255,255,255,.06);
}

/* ---------- TEMA LIGHT ---------- */
[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg-2:      #eef1f8;
  --surface:   rgba(255,255,255,.75);
  --surface-2: #ffffff;
  --border:    rgba(20,30,60,.10);
  --text:      #131a2c;
  --text-dim:  #5b6478;
  --glass-blur: 12px;
  --grid-line: rgba(20,30,60,.07);
  --shadow: 0 18px 45px -16px rgba(40,55,110,.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--trans), color var(--trans);
  overflow-x: hidden;
}

/* fundal aurora animat */
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -2;
  background:
    radial-gradient(40% 40% at 15% 20%, color-mix(in srgb, var(--brand-1) 55%, transparent), transparent 70%),
    radial-gradient(40% 40% at 85% 15%, color-mix(in srgb, var(--brand-2) 50%, transparent), transparent 70%),
    radial-gradient(45% 45% at 70% 90%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%);
  filter: blur(60px) saturate(120%);
  opacity: .55;
  animation: drift 22s ease-in-out infinite alternate;
}
[data-theme="light"] body::before { opacity: .35; }
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, transparent, var(--bg) 85%);
  pointer-events: none;
}
@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(0,-4%,0) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- LAYOUT APP: SIDEBAR + COLOANA ---------- */
.app { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 1.05rem; letter-spacing: .2px;
  text-decoration: none; color: var(--text);
  padding: 6px 8px 18px;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--grad-brand);
  display: grid; place-items: center;
  color: white; font-weight: 900; font-size: 1.05rem;
  box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--brand-1) 70%, transparent);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt small { font-weight:500; font-size:.66rem; color:var(--text-dim); letter-spacing:.5px; text-transform:uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.navlink {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); text-decoration: none; font-weight: 600; font-size: .93rem;
  padding: 11px 13px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; background: none; font-family: var(--font);
  width: 100%; text-align: left; transition: var(--trans); position: relative;
}
.navlink svg, .navlink .ico-slot { width: 20px; height: 20px; flex: none; }
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active {
  color: var(--text);
  background: color-mix(in srgb, var(--brand-1) 16%, transparent);
  border-color: color-mix(in srgb, var(--brand-1) 35%, transparent);
}
.navlink.active::before {
  content:""; position:absolute; left:0; top:18%; bottom:18%; width:3px;
  border-radius: 3px; background: var(--grad-brand);
}

/* grup Istoric (colapsabil) */
.nav-group { border-radius: 12px; }
.nav-group summary { list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary .chev { width: 16px; height: 16px; margin-left: auto; transition: var(--trans); }
.nav-group[open] summary .chev { transform: rotate(180deg); }
.subnav { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 10px; padding-left: 12px; border-left: 1px solid var(--border); }
.navlink.sub { padding: 8px 12px; font-size: .88rem; font-weight: 600; }
.navlink.sub.active { color: var(--text); background: color-mix(in srgb, var(--brand-1) 14%, transparent); }
.navlink.sub.disabled { color: var(--text-dim); opacity: .6; cursor: default; }

.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.theme-link .ico-slot { display: grid; place-items: center; }

/* TOPBAR (doar Ieșire, dreapta) */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 12px 22px; min-height: 60px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
}
.logout {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text-dim); text-decoration: none; font-weight: 700; font-size: .9rem;
  padding: 9px 15px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); transition: var(--trans);
}
.logout svg { width: 19px; height: 19px; }
.logout:hover {
  color: color-mix(in srgb, var(--err) 92%, white);
  border-color: color-mix(in srgb, var(--err) 45%, transparent);
  background: color-mix(in srgb, var(--err) 12%, transparent);
  transform: translateY(-1px);
}

.wrap { max-width: 1120px; width: 100%; margin: 0 auto; padding: 26px 26px 0; }

/* responsive: pe ecran mic, sidebar devine bară de iconițe */
@media (max-width: 820px) {
  .app { grid-template-columns: 66px 1fr; }
  .sidebar { padding: 16px 8px; }
  .brand-txt, .navlink span:not(.ico-slot), .theme-label { display: none; }
  .brand { justify-content: center; padding: 6px 0 16px; }
  .navlink { justify-content: center; padding: 12px 0; }
  .navlink.active::before { display: none; }
  .wrap { padding: 20px 16px 0; }
}

/* ---------- BUTOANE ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 12px; border: none; cursor: pointer;
  font-weight: 700; font-size: .95rem; font-family: var(--font);
  color: #fff; background: var(--grad-brand);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--brand-1) 80%, transparent);
  transition: var(--trans); text-decoration: none;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); }

/* ---------- CARDURI ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
  padding: 22px;
}

/* grid KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 26px 0; }
@media (max-width: 880px){ .kpis { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px){ .kpis { grid-template-columns: 1fr; } }

.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  backdrop-filter: blur(var(--glass-blur));
  transition: var(--trans);
  animation: rise .6s var(--trans) both;
}
.kpi:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.kpi::after {
  content:""; position:absolute; right:-30px; top:-30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--grad-brand); opacity:.13; filter: blur(8px);
}
.kpi .label { color: var(--text-dim); font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.kpi .value { font-size: 2rem; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }
.kpi .value .u { font-size: .95rem; color: var(--text-dim); font-weight: 600; }
.kpi .sub { margin-top: 6px; font-size: .82rem; color: var(--text-dim); }
.kpi .sub.up { color: var(--ok); } .kpi .sub.down { color: var(--err); }

@keyframes rise { from { opacity:0; transform: translateY(14px);} to {opacity:1; transform:none;} }
.kpi:nth-child(2){animation-delay:.06s} .kpi:nth-child(3){animation-delay:.12s} .kpi:nth-child(4){animation-delay:.18s}

/* layout dashboard */
.grid-main { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; }
@media (max-width: 920px){ .grid-main { grid-template-columns: 1fr; } }

.card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.card .muted { color: var(--text-dim); font-size: .85rem; margin-bottom: 14px; }

/* lista top locatii */
.loc-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.loc-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--text);
  transition: var(--trans); position: relative;
}
.loc-row:hover { background: var(--surface-2); }
.loc-row .nm { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-row .nm small { color: var(--text-dim); font-weight: 500; }
.loc-row .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.bar {
  grid-column: 1 / -1; height: 5px; border-radius: 4px; margin-top: 2px;
  background: var(--grad-brand); opacity:.8;
  transform-origin: left; animation: grow .8s var(--trans) both;
}
@keyframes grow { from { transform: scaleX(0);} to {transform: scaleX(1);} }

/* grila carduri locatii (cate un grafic-linie per locatie) */
.loc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 8px; }
@media (max-width: 760px){ .loc-grid { grid-template-columns: 1fr; } }
.loc-card { display: block; text-decoration: none; color: var(--text); transition: var(--trans); animation: rise .5s var(--trans) both; }
.loc-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.loc-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.loc-card-head h2 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-total { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); flex: none; }
.mini-chart { position: relative; height: 180px; margin-top: 10px; }
.loc-card { cursor: pointer; }
.expand-hint { float: right; font-size: .76rem; font-weight: 700; color: var(--accent); opacity: 0; transition: var(--trans); }
.loc-card:hover .expand-hint { opacity: 1; }

/* modal marire locatie */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: none; place-items: center;
  padding: 24px; background: rgba(5,8,18,.66);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: fadein .25s ease both;
}
.modal-backdrop.open { display: grid; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(920px, 96vw); max-height: 92vh; overflow: auto; position: relative;
  animation: rise .35s var(--trans) both; }
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 38px; height: 38px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; transition: var(--trans);
}
.modal-close:hover { background: var(--surface-2); transform: rotate(90deg); }
.modal-chart { position: relative; height: min(56vh, 460px); margin-top: 14px; }
.modal .loc-card-head { padding-right: 52px; }

/* alerta zile lipsa */
.alert {
  display: flex; gap: 14px; align-items: flex-start;
  border-radius: var(--radius); padding: 16px 18px; margin: 22px 0;
  border: 1px solid; backdrop-filter: blur(var(--glass-blur));
}
.alert .ico { width: 26px; height: 26px; flex: none; }
.alert.danger { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.alert.good   { background: color-mix(in srgb, var(--ok) 12%, transparent);  border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert h3 { font-size: .98rem; margin-bottom: 3px; }
.alert p  { font-size: .87rem; color: var(--text-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  background: color-mix(in srgb, var(--err) 20%, transparent);
  color: color-mix(in srgb, var(--err) 90%, white);
}
.chip.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: color-mix(in srgb, var(--warn) 92%, white); }

/* flash messages */
.flashes { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 4px; }
.flash {
  padding: 13px 16px; border-radius: 12px; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface);
  animation: rise .4s var(--trans) both;
}
.flash.success { border-color: color-mix(in srgb, var(--ok) 40%, transparent);  background: color-mix(in srgb, var(--ok) 12%, transparent); }
.flash.error   { border-color: color-mix(in srgb, var(--err) 40%, transparent); background: color-mix(in srgb, var(--err) 12%, transparent); }
.flash.warning { border-color: color-mix(in srgb, var(--warn) 40%, transparent);background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* ---------- LOGIN ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 410px; padding: 38px 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur));
  animation: rise .6s var(--trans) both;
}
.theme-btn {
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center;
  transition: var(--trans);
}
.theme-btn:hover { transform: translateY(-2px); background: var(--surface-2); }
.theme-btn svg { width: 18px; height: 18px; }

.login-card .logo-big {
  width: 60px; height: 60px; border-radius: 16px; background: var(--grad-brand);
  display: grid; place-items: center; color:#fff; font-weight:900; font-size:1.5rem;
  margin: 0 auto 18px; box-shadow: 0 12px 30px -8px color-mix(in srgb,var(--brand-1) 70%, transparent);
}
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-dim); font-size: .9rem; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  font-size: .98rem; font-family: var(--font); transition: var(--trans);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn.block { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- UPLOAD (dropzone) ---------- */
.drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 46px 24px; text-align: center; cursor: pointer;
  transition: var(--trans); background: var(--surface);
}
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.drop .ico { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--accent); }
.drop h3 { font-size: 1.05rem; margin-bottom: 5px; }
.drop p { color: var(--text-dim); font-size: .88rem; }
.drop .fname { margin-top: 14px; font-weight: 700; color: var(--accent); }
input[type=file] { display: none; }

.page-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 2px; }
.page-sub { color: var(--text-dim); margin-bottom: 8px; }

.foot { text-align: center; color: var(--text-dim); font-size: .8rem; padding: 40px 0 26px; }

/* cheltuieli: formular + tabel */
.exp-form { display: grid; grid-template-columns: 160px 1fr 160px auto; gap: 14px; align-items: end; }
.exp-form-2 { grid-template-columns: 150px 1fr 140px 150px auto; }
.exp-form select { font-family: var(--font); font-size: .98rem; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 12px; cursor: pointer; transition: var(--trans); height: 46px; }
.exp-form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
@media (max-width: 820px){ .exp-form-2 { grid-template-columns: 1fr; } }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
@media (max-width: 820px){ .twocol { grid-template-columns: 1fr; } }
.progress { height: 12px; border-radius: 8px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; border-radius: 8px; background: var(--grad-brand); transition: width .8s var(--trans); }
.exp-form .field { margin-bottom: 0; }
.exp-form .btn { height: 46px; }
@media (max-width: 720px){ .exp-form { grid-template-columns: 1fr; } .exp-form .btn { width: 100%; justify-content: center; } }
.exp-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.exp-table th { text-align: left; color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.exp-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
.exp-table tr:hover td { background: var(--surface-2); }
.exp-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.exp-table tfoot td { border-bottom: none; padding-top: 14px; font-size: 1rem; }
.exp-table tfoot .r strong { color: var(--accent); }
.del-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 1.1rem; line-height: 1; cursor: pointer; transition: var(--trans); }
.del-btn:hover { color: color-mix(in srgb, var(--err) 92%, white); border-color: color-mix(in srgb, var(--err) 45%, transparent); background: color-mix(in srgb, var(--err) 12%, transparent); }
.exp-table form { margin: 0; }
.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.month-pick { font-size: .85rem; color: var(--text-dim); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.month-pick select {
  font-family: var(--font); font-size: .9rem; font-weight: 600; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; transition: var(--trans);
}
.month-pick select:hover { border-color: var(--accent); }
.month-pick select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.chart-box { position: relative; height: 320px; }
.back-link { color: var(--text-dim); text-decoration: none; font-weight: 600; font-size: .9rem; }
.back-link:hover { color: var(--text); }
