/* Fidelia Evaluări — design neutru alb/gri, un singur accent */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #1f4fd1;
  --accent-hover: #1a43b3;
  --accent-soft: #eef3ff;

  --red: #b42318;      --red-soft: #fef3f2;    --red-border: #fecdca;
  --amber: #b54708;    --amber-soft: #fffaeb;  --amber-border: #fedf89;
  --green: #067647;    --green-soft: #ecfdf3;  --green-border: #abefc6;
  --gray: #475467;     --gray-soft: #f2f4f7;   --gray-border: #e4e7ec;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 650; overflow-wrap: anywhere; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
.alert ul { padding-left: 18px; list-style: disc; }
[hidden] { display: none !important; }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.strong { font-weight: 600; color: var(--text); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted-link { color: var(--text-2); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.req { color: var(--red); font-style: normal; }
.warning-text { color: var(--amber); }
.error-text { color: var(--red); }

/* ---------- topbar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  flex-shrink: 0;
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a, .nav .link-button {
  color: var(--text-2); padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px;
}
.nav a:hover, .nav .link-button:hover { background: var(--gray-soft); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-logout { margin: 0 0 0 8px; padding-left: 8px; border-left: 1px solid var(--border); }
.link-button { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-toggle { display: none; }

/* ---------- layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 64px; }
.auth-container { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head p { margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs { font-size: 13px; color: var(--text-3); margin-bottom: 8px; overflow-wrap: anywhere; }
.breadcrumbs a { color: var(--text-3); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  min-width: 0;
}
.card-title { margin-bottom: 14px; }
.card-title + p.small { margin: -6px 0 14px; }
.subhead { margin: 22px 0 10px; }
.section-title { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.stack-lg { display: grid; gap: 20px; min-width: 0; }
.stack, .stack-sm { display: grid; gap: 14px; }
.stack-sm { gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.span-2 { grid-column: span 2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 500 14px/1.2 var(--font);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--gray-soft); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(31, 79, 209, .25); outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.icon-button {
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-3); font-size: 18px; line-height: 1; cursor: pointer;
}
.icon-button:hover { background: var(--red-soft); color: var(--red); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel],
input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 15px/1.4 var(--font);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(31, 79, 209, .15); }
textarea { resize: vertical; }
input[type=date] { -webkit-appearance: none; appearance: none; }
input[type=file] {
  width: 100%; padding: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); font: 14px var(--font); color: var(--text-2);
}
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); font: 500 13px var(--font); cursor: pointer;
}
.hint { font-size: 12px; color: var(--text-3); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.error { font-size: 12px; color: var(--red); }
.form-card { max-width: 760px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.file-trigger { position: relative; cursor: pointer; }
.inline-upload { margin: 0; }

/* ---------- alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.alert-error { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.alert-info { background: var(--accent-soft); border-color: #c7d7fe; color: #1e3a8a; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; border: 1px solid; white-space: nowrap; vertical-align: middle;
}
.badge-expirat { color: var(--red); background: var(--red-soft); border-color: var(--red-border); }
.badge-de_reinnoit { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-border); }
.badge-la_zi { color: var(--green); background: var(--green-soft); border-color: var(--green-border); }
.badge-fara_raport, .badge-muted { color: var(--gray); background: var(--gray-soft); border-color: var(--gray-border); }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: #c7d7fe; }
.status-text-expirat { color: var(--red); }
.status-text-de_reinnoit { color: var(--amber); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  display: grid; gap: 2px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat-expirat::before { background: var(--red); }
.stat-de_reinnoit::before { background: var(--amber); }
.stat-fara_raport::before { background: #98a2b3; }
.stat-la_zi::before { background: var(--green); }
.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stat-value { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-3); font-weight: 500; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }

/* ---------- tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid var(--border);
}
.table th.num { text-align: right; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table td a.strong { overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafbfc; }
.table .badge + .badge { margin-left: 4px; }

/* ---------- lists ---------- */
.item-list > li + li { border-top: 1px solid var(--border); }
.item-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: inherit;
}
.item-link:hover { background: #fafbfc; text-decoration: none; }
.item-main { min-width: 0; overflow-wrap: anywhere; }
.item-side { flex-shrink: 0; text-align: right; }
.item-list.compact > li { padding: 10px 0; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.user-row > div { min-width: 0; overflow-wrap: anywhere; }

.details { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0; }
.details dt { font-size: 12px; color: var(--text-3); font-weight: 500; margin-top: 10px; }
.details dt:first-child { margin-top: 0; }
.details dd { margin: 0; overflow-wrap: anywhere; }

.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
aside > .danger-zone { border-top: 0; margin-top: 0; padding-top: 0; text-align: right; }

/* ---------- summary ---------- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; margin-bottom: 20px; }
.summary-item { display: grid; gap: 2px; align-content: start; padding: 16px 20px; min-width: 0; }
.summary-item + .summary-item { border-left: 1px solid var(--border); }
.summary-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.summary-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- reports & files ---------- */
.report-list > li + li { margin-top: 12px; }
.report { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.report.is-current { border-color: #c7d7fe; background: #fbfcff; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.report-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.report > p { margin-top: 8px; }
.report-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.report-actions form { margin: 0; }
.file-list { margin: 10px 0 12px; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-list form { margin: 0 0 0 auto; }
.file-link { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); font-size: 14px; }
.file-link:hover { color: var(--accent); }
.file-link { overflow-wrap: anywhere; }
.file-icon {
  flex-shrink: 0; font-size: 10px; font-weight: 700; color: var(--text-2);
  background: var(--gray-soft); border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px;
}

.log-list { display: grid; gap: 10px; }
.log-list li { display: grid; gap: 4px; justify-items: start; }

/* ---------- empty & auth ---------- */
.empty-state { text-align: center; padding: 48px 20px; display: grid; gap: 10px; justify-items: center; }
.empty-state.compact { padding: 24px 0 8px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 8px 24px rgba(16, 24, 40, .06); padding: 32px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 14px; border-radius: 10px; }
.auth-brand h1 { font-size: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .layout-side { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .container { padding: 18px 16px 48px; }
  .topbar-inner { padding: 0 16px; height: 56px; }
  h1 { font-size: 21px; }

  .nav-toggle {
    display: inline-grid; gap: 4px; margin-left: auto; padding: 10px; border: 0; background: none; cursor: pointer;
    border-radius: var(--radius-sm);
  }
  .nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
  .nav {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 12px 12px;
    box-shadow: 0 8px 16px rgba(16, 24, 40, .06);
  }
  .nav.is-open { display: flex; }
  .nav a, .nav .link-button { padding: 12px; font-size: 15px; text-align: left; width: 100%; }
  .nav-logout { margin: 4px 0 0; padding: 4px 0 0; border-left: 0; border-top: 1px solid var(--border); }

  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .filters input[type=search], .filters select { flex: 1 1 100%; }
  .filters .btn { flex: 1 1 auto; }

  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .field-spacer { display: none; }
  .form-actions .btn { flex: 1 1 auto; }
  .card { padding: 16px; }
  .card.table-card, .card.summary { padding: 0; }

  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item { padding: 14px 16px; }
  .summary-item + .summary-item { border-left: 0; }
  .summary-item:nth-child(even) { border-left: 1px solid var(--border); }
  .summary-item:nth-child(n+3) { border-top: 1px solid var(--border); }
  .summary-value { font-size: 16px; }

  /* tabelele devin carduri pe telefon */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 4px 0; border: 0; text-align: right;
  }
  .table.responsive td::before {
    content: attr(data-label); flex-shrink: 0; font-size: 12px; color: var(--text-3); font-weight: 500; text-align: left;
  }
  .table.responsive td:first-child { display: block; text-align: left; padding-bottom: 6px; font-size: 15px; }
  .table.responsive td:first-child::before { display: none; }
  .table.responsive td > * { min-width: 0; }
  .row-link:hover td { background: transparent; }
}

@media (max-width: 380px) {
  .stats { gap: 8px; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .summary-item:nth-child(even) { border-left: 0; }
  .summary-item + .summary-item { border-top: 1px solid var(--border); }
}
