/* ============================================================
   BudMonitoring — дизайн-токени
   Ідея: "синька" (технічне креслення) + бетон + сигнальний
   помаранчевий (будівельна сигналізація/каски). Наскрізний
   елемент — тришаровий індикатор підтверджено/наближено/неповні,
   що повторює категорії реальних вихідних файлів інструменту.
   ============================================================ */

:root {
  --blueprint-900: #12213d;
  --blueprint-700: #24406b;
  --blueprint-500: #3d5f95;
  --paper: #eceef1;
  --card: #ffffff;
  --ink: #14171c;
  --muted: #5b6472;
  --line: #d7dbe0;
  --accent: #e8622c;
  --accent-dark: #c94f1e;
  --ok: #2f7d5b;
  --ok-bg: #e4f3ec;
  --approx: #c98a1d;
  --approx-bg: #fbf1de;
  --bad: #b33f3f;
  --bad-bg: #fbe9e9;

  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--blueprint-700); }
a:hover { color: var(--accent); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blueprint-500);
}

/* ---------- Auth pages: split screen ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 220px; }
}

.auth-visual {
  background:
    linear-gradient(180deg, rgba(18,33,61,0.94), rgba(18,33,61,0.98)),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(255,255,255,0.05) 28px),
    repeating-linear-gradient(90deg, transparent, transparent 27px, rgba(255,255,255,0.05) 28px);
  color: #eef1f6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3rem 2.5rem;
}

.auth-visual .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.auth-visual .brand span { color: var(--accent); }

.auth-visual .pitch h1 {
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  max-width: 22ch;
}
.auth-visual .pitch p {
  color: #c3cbdb;
  max-width: 40ch;
}

/* Мініатюра "рядка кошторису" — сигнатурний елемент */
.sheet-sample {
  margin-top: 2rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.sheet-sample .row {
  display: flex;
  justify-content: space-between;
  color: #dfe4ee;
  margin-bottom: 0.5rem;
}
.sheet-sample .row b { color: #fff; font-weight: 600; }

.share-bar {
  display: flex;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.12);
}
.share-bar .ok { background: #4fae82; }
.share-bar .approx { background: #e0aa4a; }
.share-bar .bad { background: #d97070; }

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 2.2rem 2rem;
}

.auth-card h2 { font-size: 1.4rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.92rem; }

.field { margin-bottom: 1.05rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: #fbfbfc;
}
.field input:focus {
  outline: 2px solid var(--blueprint-500);
  outline-offset: 1px;
  border-color: var(--blueprint-500);
}
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 5px;
  padding: 0.7rem 1.1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--blueprint-700); border: 1px solid var(--line); }

.error-box {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid #eecccc;
  border-radius: 5px;
  padding: 0.7rem 0.9rem;
  font-size: 0.87rem;
  margin-bottom: 1.1rem;
}

.switch-link { margin-top: 1.3rem; font-size: 0.88rem; color: var(--muted); text-align: center; }

/* ---------- App shell (dashboard) ---------- */

.topbar {
  background: var(--blueprint-900);
  color: #eef1f6;
  padding: 0.9rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.topbar .brand span { color: var(--accent); }
.topbar .who { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: #c3cbdb; }
.topbar form { display: inline; }
.topbar button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #eef1f6;
  border-radius: 5px;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.topbar button:hover { border-color: var(--accent); color: var(--accent); }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.8rem 4rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.4rem;
  margin-bottom: 1.6rem;
}
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem 1.6rem;
}

/* Бюджет-індикатор */
.budget-card .amounts {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-mono);
  margin: 0.6rem 0 0.7rem;
}
.budget-card .spent { font-size: 1.7rem; font-weight: 600; }
.budget-card .of { color: var(--muted); font-size: 0.95rem; }
.budget-gauge {
  height: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.budget-gauge > div {
  height: 100%;
  background: var(--blueprint-700);
}
.budget-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.6rem; }

/* Завантаження файлу */
.upload-card {
  border: 1.5px dashed var(--blueprint-500);
  background: #f6f8fb;
  text-align: center;
}
.upload-card h3 { font-size: 1.05rem; }
.upload-card p { color: var(--muted); font-size: 0.87rem; margin-bottom: 1.1rem; }
.file-input-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.file-input-row input[type="file"] {
  font-size: 0.85rem;
  max-width: 260px;
}

/* Таблиця запусків */
.runs-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
table.runs {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.runs th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 0 0.6rem 0.6rem 0;
}
table.runs td {
  padding: 0.8rem 0.6rem 0.8rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.runs td.num, table.runs th.num { font-family: var(--font-mono); }

.status-pill {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.status-pending { background: #eef0f3; color: var(--muted); }
.status-processing { background: var(--approx-bg); color: var(--approx); }
.status-done { background: var(--ok-bg); color: var(--ok); }
.status-error { background: var(--bad-bg); color: var(--bad); }

.mini-share {
  display: flex;
  width: 90px;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
}
.mini-share .ok { background: var(--ok); }
.mini-share .approx { background: var(--approx); }
.mini-share .bad { background: var(--bad); }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2.5rem;
}

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blueprint-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
