:root {
  --ramsak-red: #c0392b;
  --ramsak-dark: #2c3e50;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #dfe3e8;
  --text: #1f2a37;
  --muted: #6b7683;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--ramsak-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}
.brand-badge {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 8px;
  padding: 5px 12px;
  max-width: 100%;
}
.brand-logo { height: 40px; width: auto; display: block; flex-shrink: 0; }

.header-phone {
  color: rgba(255,255,255,0.9);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.header-phone:hover { color: white; text-decoration: underline; }
@media (max-width: 560px) { .header-phone { display: none; } }

.logout-link {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.logout-link:hover { background: rgba(255,255,255,0.1); }

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 16px 16px 90px;
}
.app-footer strong { color: var(--text); font-weight: 600; }

/* Process-steps bar, sits under the header, full width, click to jump
   between any step already reached (forward or back). */
.steps-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 9;
}
.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: default;
  white-space: nowrap;
}
.step-pill-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 0.7rem;
}
.step-pill.done { color: var(--ramsak-dark); border-color: var(--ramsak-dark); cursor: pointer; }
.step-pill.done .step-pill-num { background: var(--ramsak-dark); color: white; }
.step-pill.done:hover { background: #eef1f4; }
.step-pill.active { background: var(--ramsak-red); border-color: var(--ramsak-red); color: white; }
.step-pill.active .step-pill-num { background: rgba(255,255,255,0.3); color: white; }
.step-pill.todo { opacity: 0.5; }
.step-pill:disabled { cursor: default; }

.substeps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.substep-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
  cursor: pointer;
}
.substep-pill.active { background: var(--ramsak-red); border-color: var(--ramsak-red); color: white; }
.substep-pill.done { color: var(--ramsak-dark); border-color: var(--ramsak-dark); }
.substep-pill.done:hover, .substep-pill:not(.active):hover { background: #f1f3f5; }

.app { max-width: 960px; margin: 0 auto; padding: 24px 16px 90px; }

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p.muted, .muted { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(16,24,32,0.04);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 10px;
  border: none;
  background: var(--ramsak-red);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--ramsak-dark); }
.btn.ghost { background: transparent; color: var(--ramsak-dark); border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(0,0,0,0.03); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: white;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ramsak-red);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}
.field.wide textarea, .field.wide .choice-group { max-width: 640px; }

/* Wizard step fields laid out as a responsive grid instead of one full-width
   column stretching edge-to-edge on desktop. */
.question-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 20px;
}
@media (min-width: 720px) {
  .question-grid { grid-template-columns: 1fr 1fr; }
  .question-grid .field.wide { grid-column: 1 / -1; }
}

.bool-group, .choice-group { display: flex; gap: 8px; flex-wrap: wrap; }
.bool-group button, .choice-btn {
  flex: 1 1 auto;
  min-width: 84px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 46px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.bool-group button:hover, .choice-btn:hover { border-color: var(--ramsak-dark); }
.bool-group button.selected, .choice-btn.selected { background: var(--ramsak-red); color: white; border-color: var(--ramsak-red); }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge.status-none { background: #eceff1; color: var(--muted); }
.badge.status-osnutek { background: #eceff1; color: var(--text); }
.badge.status-poslano { background: #fff6ea; color: #9a6b00; }
.badge.status-sprejeto { background: #e6f4ea; color: #1e7e34; }
.badge.status-zavrnjeno { background: #fdecea; color: var(--ramsak-red); }
.badge.status-poteklo { background: #e9ecef; color: var(--muted); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.kpi-tile {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.kpi-tile:hover { border-color: var(--ramsak-dark); box-shadow: 0 2px 10px rgba(16,24,32,0.06); }
.kpi-tile:active { transform: translateY(1px); }
.kpi-tile.active { border-color: var(--ramsak-red); box-shadow: 0 0 0 2px rgba(192,57,43,0.15); }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--ramsak-dark); line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
@media (max-width: 560px) { .kpi-row { grid-template-columns: 1fr; } }

.badge.status-archived { background: #2c3e50; color: white; margin-left: 4px; }

.project-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.project-list-item:last-child { border-bottom: none; }

.tiers { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .tiers { grid-template-columns: repeat(3, 1fr); } }

.tier-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 20px 18px;
  background: white;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.tier-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,32,0.08); }
.tier-card.selected { border-color: var(--ramsak-red); box-shadow: 0 0 0 2px rgba(192,57,43,0.15); }
.tier-card h3 { margin: 0 0 4px; text-transform: capitalize; }
.tier-price { font-size: 1.5rem; font-weight: 700; color: var(--ramsak-dark); margin: 6px 0; }
.tier-card ul { padding-left: 18px; margin: 8px 0; font-size: 0.85rem; color: var(--muted); }

/* Featured/"premium" tier -- gold accent + ribbon so it visually stands out
   from the other two packages instead of all three looking identical. */
.tier-card.featured {
  border-color: var(--ramsak-red);
  background: linear-gradient(180deg, #fffaf4 0%, #ffffff 60%);
  box-shadow: 0 4px 20px rgba(192,57,43,0.1);
}
.tier-card.featured.selected { box-shadow: 0 0 0 2px rgba(192,57,43,0.15), 0 4px 20px rgba(192,57,43,0.12); }
.tier-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ramsak-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.explain-box {
  background: #fff6ea;
  border: 1px solid #f0dfb8;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.override-badge {
  display: inline-block;
  font-size: 0.7rem;
  background: #fdecea;
  color: var(--ramsak-red);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.quote-doc {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  font-size: 0.9rem;
}
.quote-doc .qd-header { display: flex; justify-content: space-between; border-bottom: 3px solid var(--ramsak-red); padding-bottom: 12px; margin-bottom: 16px; }
.quote-doc table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.quote-doc th, .quote-doc td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.quote-doc .totals { text-align: right; margin-top: 10px; }
.quote-doc .totals div { margin: 2px 0; }
.quote-doc .totals .grand { font-size: 1.2rem; font-weight: 700; color: var(--ramsak-dark); }

.ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--ramsak-red);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 20;
}

.ai-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(340px, calc(100vw - 40px));
  max-height: 60vh;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.ai-panel.hidden { display: none; }
.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.ai-panel-header button { border: none; background: none; font-size: 1rem; cursor: pointer; }
.ai-log { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 0.85rem; }
.ai-log .msg { margin-bottom: 10px; }
.ai-log .msg.user { color: var(--ramsak-dark); font-weight: 600; }
.ai-log .msg .tools { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.ai-form { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); }
.ai-form input { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.ai-form button { padding: 8px 12px; border: none; border-radius: 6px; background: var(--ramsak-red); color: white; }

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-wrap { width: min(380px, calc(100vw - 32px)); }
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
.login-logo { height: 88px; margin-bottom: 8px; }
.login-phone { margin: 0 0 18px; font-size: 0.95rem; }
.login-phone a { color: var(--ramsak-dark); font-weight: 600; text-decoration: none; }
.login-phone a:hover { text-decoration: underline; }
.login-title { margin: 0 0 4px; }
.login-hint { margin: 0 0 20px; }
.login-form { text-align: left; }
.login-form .btn { width: 100%; }
.login-error {
  background: #fdecea;
  color: var(--ramsak-red);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.login-error.hidden { display: none; }
