/* ─────────────────────────────────────────────
   STUP OS — application UI
   Continuă paleta site-ului, dar mai densă.
   ───────────────────────────────────────────── */

:root {
  --honey:        #E8A330;
  --honey-deep:   #B87716;
  --honey-soft:   #F5C842;
  --honey-glow:   #FFD56B;
  --honey-50:     #FFF7E5;
  --black:        #141414;
  --black-soft:   #2A2520;
  --cream:        #FCF4E0;
  --cream-warm:   #F8EAC2;
  --cream-soft:   #FFFBED;
  --paper:        #FFFDF6;
  --ink:          #141414;
  --ink-mute:     #6B5D4A;
  --ink-faint:    #A89980;
  --line:         rgba(20, 20, 20, 0.08);
  --line-strong:  rgba(20, 20, 20, 0.16);
  --line-honey:   rgba(232, 163, 48, 0.30);

  --green:        #2E8B57;
  --green-soft:   #DDEFE4;
  --red:          #C9483D;
  --red-soft:     #FBE3DF;
  --blue:         #2A6FB0;
  --blue-soft:    #DCEAF6;

  --grad-honey:   linear-gradient(135deg, #F5C842 0%, #E8A330 55%, #B87716 100%);
  --shadow-card:  0 1px 2px rgba(20,20,20,0.04), 0 8px 24px -12px rgba(184, 119, 22, 0.18);
  --shadow-pop:   0 12px 36px -12px rgba(20, 20, 20, 0.18);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream-soft);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

::selection { background: var(--honey); color: var(--black); }

/* ───── LOGIN ───── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--cream);
}
.login-aside {
  background: var(--black);
  color: var(--cream);
  padding: 4rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(232,163,48,0.18), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(245,200,66,0.10), transparent 50%);
  pointer-events: none;
}
.login-aside > * { position: relative; }
.login-brand {
  display: flex; align-items: center; gap: 0.8rem;
  font-family: 'Manrope', sans-serif; font-weight: 800;
  font-size: 1.4rem;
}
.login-brand svg { width: 40px; height: 44px; }
.login-brand .sub { color: var(--honey-soft); font-weight: 500; font-style: italic; font-size: 1.1rem; }
.login-pitch h1 { font-size: clamp(1.8rem, 2.6vw, 2.6rem); margin-bottom: 1.2rem; }
.login-pitch h1 em { color: var(--honey-soft); font-style: normal; }
.login-pitch p { color: rgba(252,244,224,0.72); max-width: 38ch; line-height: 1.55; }
.login-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem;
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(252,244,224,0.12);
}
.login-stats div .num { font-family: 'Manrope'; font-weight: 800; font-size: 1.6rem; color: var(--honey-soft); display: block; }
.login-stats div .lab { color: rgba(252,244,224,0.6); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.login-foot { color: rgba(252,244,224,0.45); font-size: 0.78rem; }

.login-main {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 2rem;
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.login-card .sub { color: var(--ink-mute); margin-bottom: 2rem; }
.login-card label {
  display: block; font-weight: 600; font-size: 0.85rem;
  margin-bottom: 0.4rem; color: var(--black);
}
.login-card input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(232,163,48,0.15);
}
.login-card .btn-primary {
  width: 100%; padding: 0.95rem;
  background: var(--black); color: var(--cream);
  border: 0; border-radius: var(--r-sm);
  font-family: 'Manrope'; font-weight: 700; font-size: 0.95rem;
  transition: background .15s, transform .12s;
}
.login-card .btn-primary:hover { background: var(--black-soft); transform: translateY(-1px); }
.login-help {
  margin-top: 1.4rem; padding: 0.9rem 1rem;
  background: var(--honey-50); border: 1px solid var(--line-honey);
  border-radius: var(--r-sm); font-size: 0.82rem; color: var(--ink-mute);
  line-height: 1.45;
}
.login-help b { color: var(--honey-deep); }

@media (max-width: 880px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { padding: 2.5rem 2rem; }
  .login-stats { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
}

/* ───── APP SHELL ───── */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--cream-warm);
  border-right: 1px solid var(--line-honey);
  padding: 1.3rem 0.9rem;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.4rem 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line-honey);
  margin-bottom: 1rem;
}
.sb-brand svg { width: 32px; height: 36px; }
.sb-brand .name { font-family: 'Manrope'; font-weight: 800; font-size: 1.1rem; line-height: 1; }
.sb-brand .name small { display: block; font-weight: 500; font-style: italic; color: var(--honey-deep); font-size: 0.78rem; margin-top: 2px; }

.sb-context {
  padding: 0.7rem 0.9rem 1rem;
  font-size: 0.82rem;
}
.sb-context .lab { color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; font-weight: 600; }
.sb-context .name { font-weight: 700; margin-top: 2px; }
.sb-context select {
  margin-top: 0.5rem; width: 100%;
  padding: 0.5rem 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); font-size: 0.85rem;
}

.sb-nav {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}
.sb-nav .grp {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-faint); padding: 1rem 0.9rem 0.4rem;
}
.sb-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--r-sm);
  font-size: 0.92rem; color: var(--black);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.sb-nav a:hover { background: rgba(255,255,255,0.6); }
.sb-nav a.active {
  background: var(--black);
  color: var(--cream);
  font-weight: 600;
}
.sb-nav a.active svg { stroke: var(--honey-soft); }
.sb-nav svg {
  width: 17px; height: 17px;
  stroke: var(--ink-mute); stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.sb-nav .badge {
  margin-left: auto;
  background: var(--honey); color: var(--black);
  font-family: 'Manrope'; font-weight: 700;
  font-size: 0.7rem; padding: 1px 7px; border-radius: 999px;
  min-width: 20px; text-align: center;
}
.sb-nav a.active .badge { background: var(--honey-soft); }

.sb-user {
  margin-top: auto;
  padding: 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 0.6rem;
}
.sb-user .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--honey); color: var(--black);
  display: grid; place-items: center;
  font-family: 'Manrope'; font-weight: 800; font-size: 0.85rem;
  flex-shrink: 0;
}
.sb-user .who { flex: 1; min-width: 0; }
.sb-user .who .n { font-weight: 700; font-size: 0.85rem; line-height: 1.2; }
.sb-user .who .r { color: var(--ink-mute); font-size: 0.75rem; }
.sb-user button {
  background: transparent; border: 0; padding: 4px;
  color: var(--ink-mute); border-radius: 6px;
}
.sb-user button:hover { background: var(--cream-warm); color: var(--black); }

/* ───── MAIN ───── */
.main { padding: 1.6rem 2.2rem 4rem; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.7rem;
}
.topbar h1 { font-size: 1.7rem; }
.topbar .crumb {
  color: var(--ink-mute); font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
.topbar .actions { margin-left: auto; display: flex; gap: 0.55rem; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1rem;
  background: var(--black); color: var(--cream);
  border: 0; border-radius: var(--r-sm);
  font-family: 'Manrope'; font-weight: 700; font-size: 0.85rem;
  transition: background .15s, transform .12s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--black-soft); transform: translateY(-1px); }
.btn-honey { background: var(--honey); color: var(--black); }
.btn-honey:hover { background: var(--honey-deep); color: var(--cream); }
.btn-ghost {
  background: transparent; color: var(--black);
  border: 1.5px solid var(--line-strong);
}
.btn-ghost:hover { border-color: var(--black); background: var(--paper); transform: translateY(-1px); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Search bar in topbar */
.search {
  position: relative;
}
.search input {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 0.5rem 0.7rem 0.5rem 2rem;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  width: 240px;
}
.search input:focus { outline: none; border-color: var(--honey); }
.search svg {
  position: absolute; left: 0.6rem; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  stroke: var(--ink-mute); stroke-width: 2; fill: none;
}

/* ───── CARDS / KPI ───── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.2rem 1.3rem;
  position: relative;
  overflow: hidden;
}
.kpi .lab {
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-mute);
  font-weight: 600; margin-bottom: 0.6rem;
}
.kpi .val {
  font-family: 'Manrope'; font-weight: 800;
  font-size: 1.9rem; letter-spacing: -0.025em;
  line-height: 1.05;
}
.kpi .val .u { font-size: 0.75rem; font-weight: 600; color: var(--ink-mute); margin-left: 0.3rem; letter-spacing: 0; }
.kpi .delta {
  margin-top: 0.6rem; display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.kpi .delta.up { background: var(--green-soft); color: var(--green); }
.kpi .delta.down { background: var(--red-soft); color: var(--red); }
.kpi .delta.neut { background: var(--cream-warm); color: var(--ink-mute); }
.kpi.honey { background: var(--grad-honey); color: var(--black); border: 0; }
.kpi.honey .lab, .kpi.honey .val .u { color: rgba(20,20,20,0.7); }
.kpi.dark { background: var(--black); color: var(--cream); border: 0; }
.kpi.dark .lab { color: rgba(252,244,224,0.6); }
.kpi.dark .val .u { color: var(--honey-soft); }

/* Card */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.2rem 1.3rem;
}
.card-h {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}
.card-h h3 { font-size: 1rem; }
.card-h .sub { color: var(--ink-mute); font-size: 0.82rem; margin-top: 2px; }
.card-h .actions { margin-left: auto; display: flex; gap: 0.4rem; }

/* Grid layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.grid-2.eq { grid-template-columns: 1fr 1fr; }
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.8rem;
}
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ───── TABLE ───── */
.tbl-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.tbl-tools {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tbl-tools .chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.chip {
  background: var(--cream); color: var(--ink-mute);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: var(--black); }
.chip.on { background: var(--black); color: var(--honey-soft); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.tbl thead th {
  text-align: left;
  font-family: 'Manrope'; font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-mute);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--cream-soft);
}
table.tbl tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--cream-soft); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }
table.tbl .name-cell { display: flex; align-items: center; gap: 0.6rem; }
table.tbl .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--honey-50); color: var(--honey-deep);
  border: 1px solid var(--line-honey);
  display: grid; place-items: center;
  font-family: 'Manrope'; font-weight: 800; font-size: 0.72rem;
}
table.tbl .av.dark { background: var(--black); color: var(--honey-soft); border-color: var(--black); }

/* Tag / Status */
.tag {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.74rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--cream-warm); color: var(--ink-mute);
  white-space: nowrap;
}
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.honey { background: var(--honey-50); color: var(--honey-deep); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.dark { background: var(--black); color: var(--honey-soft); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ───── ALERTS ───── */
.alerts { display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.alert {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 0.9rem;
}
.alert .ic { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; stroke-width: 2; fill: none; }
.alert b { font-family: 'Manrope'; }
.alert .right { margin-left: auto; }
.alert.warn { background: var(--honey-50); border-color: var(--line-honey); color: var(--honey-deep); }
.alert.warn .ic { stroke: var(--honey-deep); }
.alert.info { background: var(--blue-soft); border-color: rgba(42,111,176,0.2); color: var(--blue); }
.alert.info .ic { stroke: var(--blue); }
.alert.danger { background: var(--red-soft); border-color: rgba(201,72,61,0.2); color: var(--red); }
.alert.danger .ic { stroke: var(--red); }

/* ───── DONUT / BAR ───── */
.donut-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: center;
}
.donut { position: relative; width: 100%; max-width: 220px; aspect-ratio: 1; margin: 0 auto; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .lbl {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
}
.donut .lbl .n {
  font-family: 'Manrope'; font-weight: 800;
  font-size: 1.5rem; line-height: 1;
}
.donut .lbl .u { color: var(--ink-mute); font-size: 0.78rem; }
.legend { list-style: none; }
.legend li { display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0; font-size: 0.88rem; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend .v { margin-left: auto; font-family: 'Manrope'; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Mini bar */
.mini-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--cream-warm);
}
.mini-bar > span { display: block; height: 100%; }

/* ───── CHART containers ───── */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 340px; }
.chart-wrap.short { height: 180px; }

/* ───── DETAIL PANEL ───── */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,20,0.35);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 50;
}
.detail-overlay.open { display: block; }
.detail-panel {
  position: fixed; top: 0; right: 0;
  width: min(540px, 92vw); height: 100vh;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 60;
  display: flex; flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }
.detail-panel .h {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 1rem;
}
.detail-panel .h h2 { font-size: 1.25rem; }
.detail-panel .h .sub { color: var(--ink-mute); font-size: 0.85rem; margin-top: 2px; }
.detail-panel .h .x {
  margin-left: auto; background: transparent; border: 0;
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-mute);
}
.detail-panel .h .x:hover { background: var(--cream-warm); color: var(--black); }
.detail-panel .b { flex: 1; overflow-y: auto; padding: 1.4rem; }
.detail-panel .f { padding: 1rem 1.4rem; border-top: 1px solid var(--line); display: flex; gap: 0.6rem; }

.dl { display: grid; grid-template-columns: 130px 1fr; gap: 0.55rem 0.9rem; }
.dl dt { color: var(--ink-mute); font-size: 0.85rem; }
.dl dd { font-weight: 600; font-size: 0.9rem; }

/* Misc */
.muted { color: var(--ink-mute); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.right { text-align: right; }
.no-wrap { white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }

/* Form bits */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 0.9rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(232,163,48,0.12);
}
.field .hint { color: var(--ink-mute); font-size: 0.8rem; margin-top: 0.3rem; }

/* Switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--line-strong); border-radius: 999px;
  transition: background .15s;
}
.switch .sl::before {
  content: ""; position: absolute; height: 16px; width: 16px;
  left: 3px; top: 3px; background: white; border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .sl { background: var(--honey); }
.switch input:checked + .sl::before { transform: translateX(16px); }

/* Map (production) */
.map {
  position: relative; aspect-ratio: 16/9;
  background: linear-gradient(180deg, #FFFAE3 0%, #F8EAC2 100%);
  border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line-honey);
}
.map .pin {
  position: absolute; width: 14px; height: 14px;
  background: var(--honey); border: 2px solid var(--black);
  border-radius: 50% 50% 50% 0; transform: translate(-50%, -100%) rotate(-45deg);
  cursor: pointer; transition: transform .12s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.map .pin:hover { transform: translate(-50%, -110%) rotate(-45deg) scale(1.15); }
.map .pin.school { background: var(--black); border-color: var(--honey); }
.map .pin .pop {
  position: absolute; bottom: 130%; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--black); color: var(--cream);
  padding: 0.4rem 0.7rem; border-radius: 6px;
  font-size: 0.78rem; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .12s;
}
.map .pin:hover .pop { opacity: 1; }

/* Mobile */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 248px;
    transform: translateX(-100%); z-index: 100;
    transition: transform .2s;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 1rem 1.1rem 3rem; }
  .topbar { flex-wrap: wrap; }
  .search input { width: 100%; }
  .mobile-toggle { display: inline-grid !important; }
}
.mobile-toggle {
  display: none;
  background: var(--paper); border: 1px solid var(--line-strong);
  width: 36px; height: 36px; border-radius: 8px;
  place-items: center;
}
.mobile-toggle svg { width: 18px; height: 18px; }

/* Print (rapoarte / facturi) */
@media print {
  .sidebar, .topbar .actions, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; }
  body { background: white; }
  .card, .tbl-wrap { border: 0; box-shadow: none; }
}

/* ───── ANIMAȚII ───── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.15); }
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

/* Loading skeleton */
.skel {
  background: linear-gradient(90deg, var(--cream-warm) 0%, var(--cream-soft) 50%, var(--cream-warm) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}

/* Apply page-load animation to main containers */
.kpi {
  animation: fadeUp .45s ease-out backwards;
}
.kpi-grid > .kpi:nth-child(1) { animation-delay: .02s; }
.kpi-grid > .kpi:nth-child(2) { animation-delay: .08s; }
.kpi-grid > .kpi:nth-child(3) { animation-delay: .14s; }
.kpi-grid > .kpi:nth-child(4) { animation-delay: .20s; }
.kpi-grid > .kpi:nth-child(5) { animation-delay: .26s; }

.card { animation: fadeUp .5s .12s ease-out backwards; }
.alert { animation: fadeUp .4s ease-out backwards; }
.alerts > .alert:nth-child(2) { animation-delay: .06s; }
.tbl-wrap { animation: fadeUp .55s .15s ease-out backwards; }

/* Hover lifts (small but feel-y) */
.kpi { transition: transform .18s ease, box-shadow .18s ease; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }

.card { transition: border-color .18s ease, box-shadow .18s ease; }
.card:hover { border-color: var(--line-honey); box-shadow: 0 8px 28px -16px rgba(184, 119, 22, 0.16); }

table.tbl tbody tr.clickable { transition: background .18s ease, transform .18s ease; }
table.tbl tbody tr.clickable:hover { transform: translateX(2px); }

/* Live pulsing dot (live indicators, online status) */
.tag.green .dot,
.tag.honey .dot {
  animation: pulseDot 2s ease-in-out infinite;
}

/* Sidebar nav active indicator slide */
.sb-nav a {
  position: relative;
  transition: background .15s ease, color .15s ease, padding-left .15s ease;
}
.sb-nav a:hover { padding-left: 1rem; }
.sb-nav a.active { transition: padding-left .25s ease, background .15s; }

/* Buttons — micro-bounce on click */
.btn:active { transform: translateY(0) scale(0.97); }

/* Smooth chart drawing */
.chart-wrap svg path[stroke]:not([fill]) {
  stroke-dasharray: 2000;
  animation: drawLine 1.2s ease-out forwards;
}

/* Number count-up wrapper (set via JS data-count) */
[data-count] {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Live (real-time) badge — soft glow */
.tag.green:has(.dot) {
  box-shadow: 0 0 0 0 rgba(46, 139, 87, 0);
  animation: liveGlow 2.4s ease-in-out infinite;
}
@keyframes liveGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 139, 87, 0); }
  50% { box-shadow: 0 0 0 4px rgba(46, 139, 87, 0.10); }
}

/* Honey KPI gradient breathing */
.kpi.honey {
  background-size: 200% 200%;
  animation: fadeUp .45s ease-out backwards, breath 8s ease-in-out infinite;
}
@keyframes breath {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Detail panel slide-in */
.detail-panel { will-change: transform; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Heatmap */
.heatmap { display: grid; gap: 2px; font-size: 0.7rem; }
.heatmap .row { display: grid; grid-template-columns: 50px repeat(24, 1fr); gap: 2px; align-items: center; }
.heatmap .row .lab { color: var(--ink-mute); font-size: 0.7rem; }
.heatmap .cell { aspect-ratio: 1; border-radius: 2px; background: var(--cream-warm); }
.heatmap .head .cell { background: transparent; color: var(--ink-faint); display: grid; place-items: center; aspect-ratio: auto; }

/* Bill (factura) */
.bill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 2.2rem 2.5rem;
  max-width: 780px;
  margin: 0 auto;
}
.bill .hd {
  display: flex; align-items: flex-start; gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--black);
  margin-bottom: 1.5rem;
}
.bill .hd .id { margin-left: auto; text-align: right; }
.bill .hd .id h2 { font-size: 1.5rem; }
.bill .hd .id .num { color: var(--ink-mute); font-size: 0.9rem; margin-top: 4px; }
.bill .blk { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.bill .blk h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin-bottom: 0.5rem; }
.bill table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: 0.92rem; }
.bill table th { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1.5px solid var(--black); font-family: 'Manrope'; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.bill table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); }
.bill table tfoot td { font-weight: 700; border-bottom: 0; padding-top: 0.8rem; }
.bill .total {
  margin-top: 1.5rem;
  background: var(--black); color: var(--cream);
  padding: 1rem 1.3rem;
  border-radius: var(--r-sm);
  display: flex; align-items: center;
}
.bill .total .lab { font-size: 0.9rem; color: var(--honey-soft); }
.bill .total .v { margin-left: auto; font-family: 'Manrope'; font-weight: 800; font-size: 1.6rem; }
.bill .foot { color: var(--ink-mute); font-size: 0.78rem; line-height: 1.5; margin-top: 1.5rem; }
