:root {
  color-scheme: light;
  --surface-1: #ffffff;
  --surface-2: #F0F1F8;
  --page: #F6F7FB;
  --text-primary: #14161F;
  --text-secondary: #565A6E;
  --text-muted: #8C90A3;
  --gridline: #E6E7F0;
  --border: rgba(20, 22, 31, 0.08);
  --series-blue: #3B5BDB;
  --series-orange: #EA6B3D;
  --series-aqua: #12A38A;
  --series-violet: #6C4FE0;
  --status-good: #16A34A;
  --status-warning: #D89614;
  --status-serious: #E8734A;
  --status-critical: #DC3545;
  --shadow-sm: 0 1px 2px rgba(20, 22, 31, 0.06), 0 1px 1px rgba(20, 22, 31, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 22, 31, 0.10), 0 2px 8px rgba(20, 22, 31, 0.06);
  --shadow-lg: 0 16px 48px rgba(20, 22, 31, 0.14), 0 4px 12px rgba(20, 22, 31, 0.08);
  --brand-gradient: linear-gradient(135deg, var(--series-blue), var(--series-violet));
  --brand-gradient-soft: linear-gradient(135deg, color-mix(in srgb, var(--series-blue) 12%, transparent), color-mix(in srgb, var(--series-violet) 12%, transparent));
}
 
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --surface-1: #14161F;
    --surface-2: #1B1E2B;
    --page: #0B0C12;
    --text-primary: #F2F3F8;
    --text-secondary: #ABAFC4;
    --text-muted: #6E7288;
    --gridline: #262838;
    --border: rgba(255, 255, 255, 0.09);
    --series-blue: #6A87FF;
    --series-orange: #FF8556;
    --series-aqua: #2DD4A8;
    --series-violet: #A48AFF;
    --status-good: #34D168;
    --status-warning: #F2B33D;
    --status-serious: #FF9166;
    --status-critical: #FF6B6B;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --surface-1: #14161F;
  --surface-2: #1B1E2B;
  --page: #0B0C12;
  --text-primary: #F2F3F8;
  --text-secondary: #ABAFC4;
  --text-muted: #6E7288;
  --gridline: #262838;
  --border: rgba(255, 255, 255, 0.09);
  --series-blue: #6A87FF;
  --series-orange: #FF8556;
  --series-aqua: #2DD4A8;
  --series-violet: #A48AFF;
  --status-good: #34D168;
  --status-warning: #F2B33D;
  --status-serious: #FF9166;
  --status-critical: #FF6B6B;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 420px at 12% -8%, color-mix(in srgb, var(--series-blue) 7%, transparent), transparent 60%),
    radial-gradient(900px 380px at 100% 0%, color-mix(in srgb, var(--series-violet) 6%, transparent), transparent 55%),
    var(--page);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

button, input { font-family: inherit; }

h1, h2, h3 { font-family: "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: -0.01em; }

:focus-visible {
  outline: 2px solid var(--series-blue);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  gap: 16px;
  flex-wrap: wrap;
}

.topbar > div:first-child { display: flex; align-items: center; gap: 10px; }

.topbar .logo-mark {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-gradient);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--series-blue) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar .logo-mark svg { width: 17px; height: 17px; }

.topbar h1 {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar .sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 1px;
  font-weight: 500;
}

.topbar nav { display: flex; align-items: center; gap: 2px; }
.topbar nav a {
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: 7px;
  transition: color 0.15s ease, background 0.15s ease;
}
.topbar nav a:hover { color: var(--text-primary); background: var(--surface-2); }
.topbar nav a.active { color: var(--series-blue); background: color-mix(in srgb, var(--series-blue) 10%, transparent); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--series-blue); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--series-blue) 35%, transparent);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 4px 16px color-mix(in srgb, var(--series-blue) 45%, transparent); }

.range-picker { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1px solid var(--border); flex-wrap: wrap; }
.range-picker button {
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.range-picker button:hover { color: var(--text-primary); }
.range-picker button.active { background: var(--surface-1); color: var(--series-blue); box-shadow: var(--shadow-sm); }

.custom-range { display: none; align-items: center; gap: 6px; margin-left: 6px; }
.custom-range.visible { display: flex; }
.custom-range input {
  font: inherit; font-size: 13px; padding: 6px 9px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary);
}

.subnav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.subnav a {
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 10px 4px;
  margin-right: 16px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.subnav a:hover { color: var(--text-primary); }
.subnav a.active { color: var(--series-blue); border-bottom-color: var(--series-blue); }

main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  th, td { padding: 8px; }
}

.section { margin-bottom: 34px; }
.section h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 9px;
}
.section h2::before {
  content: "";
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--brand-gradient);
  flex: none;
}
.section h2 .badge {
  font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.group-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 22px;
  margin-bottom: 0;
}

.tile {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  cursor: default;
}
.tile::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gridline);
  border-radius: 12px 0 0 12px;
  transition: width 0.18s ease;
}
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tile:hover::before { width: 4px; }
.tile .label { font-size: 11.5px; color: var(--text-secondary); font-weight: 700; letter-spacing: 0.01em; }
.tile .value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 21px; font-weight: 600; margin: 5px 0 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* caption devine tooltip la hover, in loc sa stea mereu vizibil sub tile */
.tile .caption {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: 230px;
  background: var(--text-primary);
  color: var(--page);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  padding: 9px 12px;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
.tile .caption:empty { display: none; }
.tile .caption::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text-primary);
}
.tile:hover .caption {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}

.tile--blue::before { background: var(--series-blue); }
.tile--good::before { background: var(--status-good); }
.tile--warning::before { background: var(--status-warning); }
.tile--critical::before { background: var(--status-critical); }
.tile--violet::before { background: var(--series-violet); }
.tile--neutral::before { background: var(--gridline); }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.chart-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 20px 20px 8px;
  margin-bottom: 14px;
}
.chart-panel .chart-head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-bottom: 4px;
}
.chart-panel .chart-head .chart-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.chart-panel .chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.chart-panel .chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-panel .chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-panel canvas { max-width: 100%; }

.locked-panel {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-1);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.locked-panel .locked-icon { font-size: 20px; opacity: 0.6; line-height: 1; }
.locked-panel strong { display: block; font-size: 13px; margin-bottom: 4px; }
.locked-panel p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.locked-panel code { font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 13px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--gridline); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

tr.row-risk {
  background: color-mix(in srgb, var(--status-critical) 14%, var(--surface-1));
}
tr.row-risk:hover {
  background: color-mix(in srgb, var(--status-critical) 22%, var(--surface-1));
}
td.num, th.num { font-variant-numeric: tabular-nums; font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* coloane cu text liber (adresa, motive etc.) - se ingusteaza si trec textul pe mai multe randuri
   in loc sa forteze scroll orizontal pe tot tabelul */
td.wrap, th.wrap { white-space: normal; max-width: 240px; line-height: 1.4; }

td input[type="text"], td input[type="number"] {
  width: 100%;
  min-width: 70px;
  font: inherit;
  font-size: 13px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  text-align: inherit;
}
td input[type="text"]:hover, td input[type="number"]:hover,
td input[type="text"]:focus, td input[type="number"]:focus {
  border-color: var(--border);
  background: var(--surface-2);
}
td input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.placeholder-panel {
  background: var(--surface-1);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notice {
  background: color-mix(in srgb, var(--status-warning) 8%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--status-warning) 40%, var(--border));
  border-radius: 10px;
  padding: 11px 15px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.notice strong { color: var(--text-primary); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, color-mix(in srgb, var(--series-blue) 14%, transparent), transparent 45%),
    radial-gradient(circle at 85% 85%, color-mix(in srgb, var(--series-violet) 14%, transparent), transparent 45%),
    var(--page);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 350px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  font-size: 19px; font-weight: 800; margin: 0 0 4px;
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-card p { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus, .field select:focus { border-color: var(--series-blue); background: var(--surface-1); }
.error-msg { color: var(--status-critical); font-size: 13px; margin-bottom: 12px; }

.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; min-width: 120px; }

.text-muted { color: var(--text-muted); }
.hidden { display: none; }
.text-good { color: var(--status-good); }
.text-critical { color: var(--status-critical); }

.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 13px; padding: 4px; border-radius: 6px; }
.icon-btn:hover { color: var(--status-critical); background: color-mix(in srgb, var(--status-critical) 10%, transparent); }

/* selector tari (Setari) */
.country-picker .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.country-picker .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; font-size: 13px; font-weight: 600;
  border-radius: 999px; background: var(--brand-gradient-soft); border: 1px solid var(--border); color: var(--text-primary);
}
.country-picker .chip button {
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px;
}
.country-picker .chip button:hover { color: var(--status-critical); }
.country-picker .country-list {
  display: none; max-height: 220px; overflow-y: auto; margin-top: 4px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); box-shadow: var(--shadow-md);
}
.country-picker.open .country-list { display: block; }
.country-picker .country-list div { padding: 8px 11px; font-size: 14px; cursor: pointer; display: flex; justify-content: space-between; }
.country-picker .country-list div:hover, .country-picker .country-list div.active { background: var(--brand-gradient-soft); }
.country-picker .country-list .code { color: var(--text-muted); font-size: 12px; font-family: 'IBM Plex Mono', monospace; }
.country-picker .country-list .empty { color: var(--text-muted); cursor: default; }
