/* Pametni razpisi — brand palette mirrors pdf_shared_css.py
   NAVY #221657 · GOLD #C9A961 · STEEL #3B2F7A · CREAM #FAF7F0 */
:root {
  --navy: #221657;
  --gold: #C9A961;
  --steel: #3B2F7A;
  --cream: #FAF7F0;
  --text: #1a1a1a;
  --muted: #6b7280;
  --table-even: #FAFBFC;
  --border: #E5E7EB;
  --bg: #f4f5f8;
  --high: #1B7A4A;
  --mid: #C27E0E;
  --low: #9aa0ac;
  --urgent: #c0392b;
  --shadow: 0 1px 3px rgba(34, 22, 87, 0.08), 0 1px 2px rgba(34, 22, 87, 0.04);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
small { font-size: 0.8em; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.85em; background: #f0f0f4; padding: 1px 5px; border-radius: 4px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: var(--navy); color: #fff;
  padding: 0 28px; height: 60px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark { font-weight: 800; font-size: 1.35rem; letter-spacing: 0.04em; color: #fff; }
.brand-sub { color: var(--gold); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; }
.mainnav { display: flex; gap: 4px; margin-left: 12px; flex: 1; }
.mainnav a {
  color: #cdc8e0; padding: 8px 14px; border-radius: 7px; font-weight: 500; font-size: 0.92rem;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.mainnav a.on { color: var(--navy); background: var(--gold); }
.userbox { display: flex; align-items: center; gap: 14px; }
.company-name { font-size: 0.88rem; color: #e7e3f2; font-weight: 500; }
.logout-form { margin: 0; }
.btn-logout {
  background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff;
  padding: 6px 13px; border-radius: 7px; cursor: pointer; font-size: 0.82rem; font-family: inherit;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); }

/* ---------- Layout ---------- */
.content { flex: 1; max-width: 1180px; width: 100%; margin: 0 auto; padding: 30px 28px 50px; }
.sitefooter {
  display: flex; justify-content: space-between; max-width: 1180px; width: 100%;
  margin: 0 auto; padding: 18px 28px; color: var(--muted); font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.kicker { color: var(--gold); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 4px; }
h1 { font-size: 1.7rem; font-weight: 800; color: var(--navy); letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
h3 { font-size: 0.95rem; font-weight: 700; color: var(--steel); margin: 14px 0 6px; }
.count { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: 6px; }
.breadcrumb { margin-bottom: 14px; font-size: 0.88rem; }

/* ---------- Stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-lbl { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }

/* ---------- Panels ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; }
.seeall { font-size: 0.82rem; }
.panel > table, .panel > .fit-bars { margin: 0; }
.panel .lead, .panel p { padding: 0 20px; }
.panel .lead { font-weight: 500; color: var(--navy); margin-top: 14px; }
.panel p { margin: 8px 0; }
.panel h3, .panel ul, .panel .callout { margin-left: 20px; margin-right: 20px; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  background: #fff; color: var(--muted); text-align: left; font-weight: 600;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 16px; border-bottom: 2px solid var(--border); cursor: default;
}
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]:hover { color: var(--navy); }
table.data td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { cursor: pointer; transition: background 0.08s; }
table.data tbody tr:hover { background: var(--cream); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.title-cell { max-width: 420px; }
.title-cell a { color: var(--navy); font-weight: 600; }
.title-cell small { display: block; font-weight: 400; margin-top: 1px; }

table.kv { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 6px 0; }
table.kv td { padding: 9px 20px; border-bottom: 1px solid var(--border); }
table.kv td:first-child { color: var(--muted); width: 38%; font-weight: 500; }

/* ---------- Badges / pills / tags ---------- */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 700; font-size: 0.9rem; color: #fff; }
.score-high { background: var(--high); }
.score-mid { background: var(--mid); }
.score-low { background: var(--low); }
.pill { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.pill-bid { background: #e8f5ee; color: var(--high); }
.pill-investigate { background: #fdf6e3; color: #8B5A00; }
.pill-skip { background: #eef0f3; color: var(--muted); }
.fit-tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 0.76rem; font-weight: 500; background: #ece9f6; color: var(--steel); }
.src-tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 0.74rem; background: #eef0f3; color: var(--muted); font-weight: 500; }
.deadline { font-variant-numeric: tabular-nums; white-space: nowrap; }
.deadline small { display: block; color: var(--muted); }
.dl-soon { color: var(--mid); } .dl-soon small { color: var(--mid); }
.dl-urgent { color: var(--urgent); font-weight: 600; } .dl-urgent small { color: var(--urgent); }
.dl-passed { color: var(--muted); text-decoration: line-through; }
.empty { color: var(--muted); padding: 24px 20px; text-align: center; }

/* ---------- Fit bars ---------- */
.fit-bars { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.fit-bar { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 12px; }
.fit-bar:hover { text-decoration: none; }
.fit-bar-lbl { font-size: 0.85rem; color: var(--navy); font-weight: 500; }
.fit-bar-track { background: #eceef2; height: 10px; border-radius: 6px; overflow: hidden; }
.fit-bar-fill { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.fit-bar-num { text-align: right; font-weight: 600; color: var(--navy); font-size: 0.85rem; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.filters input, .filters select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit;
  font-size: 0.88rem; background: #fff; color: var(--text);
}
.filters input[type=search] { min-width: 260px; flex: 1; }
.btn-primary { background: var(--navy); color: #fff; border: none; padding: 9px 18px; border-radius: 8px; font-weight: 600; cursor: pointer; font-family: inherit; font-size: 0.88rem; }
.btn-primary:hover { background: #2d1d6f; text-decoration: none; }
.btn-ghost { border: 1px solid var(--border); padding: 8px 15px; border-radius: 8px; color: var(--navy); font-size: 0.88rem; font-weight: 500; background: #fff; }
.btn-ghost:hover { background: var(--cream); text-decoration: none; }

/* Napredni filtri — zložljiva mreža znotraj .filters forme */
.filters .filters-more { width: 100%; margin-bottom: 0; }
.filters-adv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px; margin-top: 14px; padding: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}
.filters-adv label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 0.78rem; font-weight: 600; color: var(--navy);
}
.filters-adv label.inline-check {
  flex-direction: row; align-items: center; gap: 7px;
  font-weight: 500; align-self: end; white-space: normal;
}
.filters-adv input, .filters-adv select {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.88rem; font-weight: 400;
  background: #fff; color: var(--text);
}
.filters-adv label.inline-check input { width: auto; padding: 0; }
.btn-download { display: inline-block; background: var(--gold); color: var(--navy); padding: 6px 13px; border-radius: 7px; font-weight: 600; font-size: 0.8rem; }
.btn-download:hover { background: #d8bd7e; text-decoration: none; }

/* ---------- Detail ---------- */
.detail-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.detail-score .score-badge { width: 46px; height: 46px; font-size: 1.3rem; }
.detail-meta { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.callout { border-left: 3px solid var(--gold); background: var(--cream); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 12px 20px; }
.callout strong { color: var(--navy); }

/* ---------- Reveal ("Prikaži več") ---------- */
.more { margin-bottom: 22px; }
.more > summary {
  display: inline-block; list-style: none; cursor: pointer; user-select: none;
  background: var(--navy); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-weight: 600; font-size: 0.88rem;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::marker { content: ""; }
.more > summary:hover { background: #2d1d6f; }
.more[open] > summary { margin-bottom: 16px; }
.more > summary .more-open { display: none; }
.more[open] > summary .more-closed { display: none; }
.more[open] > summary .more-open { display: inline; }
.more-body .panel { margin-bottom: 18px; }
.ref-list { list-style: none; }
.ref-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ref-list li:last-child { border-bottom: none; }
details.raw { margin: 4px 20px 14px; }
details.raw > summary { cursor: pointer; color: var(--navy); font-weight: 600; padding: 6px 0; }
details.raw table.kv td:first-child { width: 32%; }

/* ---------- Calendar timeline ---------- */
.window-switch { display: flex; gap: 4px; }
.window-switch a { padding: 6px 12px; border-radius: 7px; font-size: 0.82rem; color: var(--muted); border: 1px solid var(--border); background: #fff; }
.window-switch a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.timeline { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 20px 22px; overflow: hidden; }
.timeline-head { position: relative; height: 22px; margin-left: 260px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.month-tick { position: absolute; font-size: 0.72rem; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.month-tick::after { content: ""; position: absolute; top: 18px; left: 50%; width: 1px; height: 9999px; background: #f0f0f4; z-index: 0; }
.timeline-rows { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.tl-row { display: grid; grid-template-columns: 250px 1fr; gap: 10px; align-items: center; padding: 4px 0; }
.tl-row:hover { text-decoration: none; }
.tl-row:hover .tl-label { color: var(--navy); }
.tl-label { font-size: 0.82rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 22px; background: linear-gradient(#f6f6fa,#f6f6fa) ; border-radius: 6px; }
.tl-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 13px; height: 13px; border-radius: 50%; background: var(--steel); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--steel); }
.tl-dot.collision { background: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.tl-dot.fit-energetska_sanacija { background: var(--high); box-shadow: 0 0 0 1px var(--high); }
.tl-dot.fit-infrastruktura { background: var(--mid); box-shadow: 0 0 0 1px var(--mid); }
.tl-date { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.legend { margin-top: 12px; font-size: 0.8rem; }
.dot-legend { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); vertical-align: middle; margin: 0 2px; }

/* ---------- Login ---------- */
.login-page { align-items: center; justify-content: center; background: linear-gradient(135deg, #221657 0%, #3B2F7A 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 38px 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); margin: auto; }
.login-brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 22px; }
.login-card .brand-mark { color: var(--navy); }
.login-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login-lead { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--navy); }
.login-form input { padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; font-size: 0.95rem; font-family: inherit; }
.login-form input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(59,47,122,0.12); }
.login-form .btn-primary { margin-top: 6px; padding: 12px; font-size: 0.95rem; }
.alert { background: #fdecea; color: #c0392b; padding: 10px 14px; border-radius: 9px; font-size: 0.85rem; margin-bottom: 16px; }
.login-foot { margin-top: 22px; color: rgba(255,255,255,0.65); font-size: 0.8rem; text-align: center; }
.error-card { text-align: center; }
.error-code { font-size: 3rem; color: var(--navy); }

/* ---------- Questionnaire ---------- */
.q-lead { max-width: 820px; margin-bottom: 18px; font-size: 0.9rem; }
.q-index {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--bg); padding: 10px 0; margin-bottom: 16px;
}
.q-index a {
  font-size: 0.78rem; padding: 5px 11px; border: 1px solid var(--border);
  border-radius: 7px; background: #fff; color: var(--steel); font-weight: 500;
}
.q-index a:hover { background: var(--cream); text-decoration: none; }
.q-section { margin-bottom: 18px; scroll-margin-top: 64px; }
.q-body { padding: 16px 20px 20px; display: grid; gap: 14px; }
.q-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.q-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--navy); }
.q-field input, .q-field select, .q-field textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; font-weight: 400; color: var(--text); background: #fff;
}
.q-field input:focus, .q-field select:focus, .q-field textarea:focus {
  outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(59,47,122,0.12);
}
.tristate { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.tristate legend { float: left; width: 100%; font-size: 0.82rem; font-weight: 600; color: var(--navy); padding: 0 0 4px; }
.tristate label { font-weight: 400; font-size: 0.86rem; display: inline-flex; align-items: center; gap: 5px; }
.inline-check { display: inline-flex; align-items: center; gap: 5px; font-size: 0.84rem; white-space: nowrap; }
.repeat-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeat-row-wrap { flex-wrap: wrap; }
.repeat-row input, .repeat-row select {
  flex: 1; min-width: 130px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: 0.86rem; background: #fff; color: var(--text);
}
.repeat-row input:focus, .repeat-row select:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(59,47,122,0.12); }
.tri-select { max-width: 130px; flex: 0 0 auto; }
.repeat-del {
  background: #fdecea; color: var(--urgent); border: none; width: 30px; height: 30px;
  border-radius: 7px; cursor: pointer; font-size: 1rem; line-height: 1; flex: 0 0 auto;
}
.repeat-del:hover { background: #f9d6d1; }
.repeat-add { margin-top: 2px; align-self: flex-start; }
.repeat-tpl { display: none; }
.q-actions {
  position: sticky; bottom: 0; background: var(--bg); padding: 16px 0; margin-top: 8px;
  display: flex; gap: 12px; border-top: 1px solid var(--border);
}
.flash-ok { background: #e8f5ee; color: var(--high); padding: 10px 14px; border-radius: 9px; font-size: 0.9rem; margin-bottom: 16px; }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Reports: analysis catalog + requests ---------- */
.report-sections > section { margin-bottom: 34px; }
.report-sections > section > p.muted { margin: -2px 0 14px; font-size: 0.86rem; }
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 8px; }
.analysis-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.analysis-title { font-weight: 700; color: var(--navy); font-size: 0.98rem; }
.analysis-desc { color: var(--muted); font-size: 0.84rem; margin: 6px 0 12px; flex: 1; }
.analysis-card .more { margin-bottom: 0; }
.analysis-card .more > summary { width: 100%; justify-content: center; text-align: center; font-size: 0.84rem; padding: 8px 14px; }
.req-form { display: grid; gap: 12px; margin-top: 12px; }
.req-form .q-field input, .req-form .q-field select, .req-form .q-field textarea { font-weight: 400; }
/* Status badges (reuse the .pill base) */
.status-pending { background: #fdf6e3; color: #8B5A00; }
.status-in_progress { background: #eef0f3; color: var(--steel); }
.status-done { background: #e8f5ee; color: var(--high); }
.status-rejected { background: #fdecea; color: var(--urgent); }
.admin-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.admin-upload input[type="file"] { font-size: 0.78rem; max-width: 190px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 12px; }
  .mainnav { order: 3; width: 100%; margin-left: 0; }
  .tl-row { grid-template-columns: 130px 1fr; }
  .timeline-head { margin-left: 140px; }
}
