/* BudgetBuilder Dom – app.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Playfair+Display:wght@500;600&family=Source+Serif+4:ital,wght@0,300;0,400;0,500;1,400&display=swap');

:root {
  --brand:        #1D9E75;
  --brand-light:  #E1F5EE;
  --brand-dark:   #085041;
  --amber:        #BA7517;
  --amber-light:  #FAEEDA;
  --blue:         #185FA5;
  --blue-light:   #E6F1FB;
  --coral:        #993C1D;
  --coral-light:  #FAECE7;
  --gray:         #888780;
  --gray-light:   #F1EFE8;
  --text:         #1a1a18;
  --text-muted:   #666460;
  --text-faint:   #999690;
  --bg:           #fafaf8;
  --bg-card:      #ffffff;
  --border:       rgba(0,0,0,.09);
  --border-hover: rgba(0,0,0,.18);
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 4px rgba(0,0,0,.06);
  --font-main:    'Source Serif 4', Georgia, serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.5rem;
  background: var(--bg-card);
  border-bottom: .5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.nav-logo-icon {
  width: 30px; height: 30px;
  background: var(--brand);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.nav-logo-icon svg { width: 16px; height: 16px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-link {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  font-family: var(--font-mono);
}
.nav-link:hover, .nav-link.active { background: var(--brand-light); color: var(--brand-dark); }
.nav-link-muted { color: var(--text-faint); }

/* ── Layout ── */
.main-content { flex: 1; padding: 2rem 1.5rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.site-footer { text-align: center; font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); padding: 1rem; border-top: .5px solid var(--border); }

/* ── Auth pages ── */
.auth-wrap { max-width: 420px; margin: 3rem auto; }
.auth-card {
  background: var(--bg-card);
  border: .5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-title { font-family: var(--font-display); font-size: 22px; margin-bottom: .25rem; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── Forms ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: .5px solid var(--border-hover);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,158,117,.12);
}
.field textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 11px; color: var(--text-faint); margin-top: 3px; font-style: italic; }

.field-error { font-size: 11px; color: #c0392b; margin-top: 3px; }
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 1rem; }
.alert-error { background: #fdf0ef; border: .5px solid #f5c6c4; color: #922b21; }
.alert-success { background: var(--brand-light); border: .5px solid #9fe1cb; color: var(--brand-dark); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: .5px solid var(--border-hover);
  background: transparent;
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  font-weight: 400;
}
.btn:hover { background: var(--gray-light); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { font-size: 12px; padding: 6px 12px; }
.btn-danger { color: #c0392b; border-color: #f5c6c4; }
.btn-danger:hover { background: #fdf0ef; }

/* ── Feature tags (onboarding) ── */
.feature-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.feature-tag {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: .5px solid var(--border-hover);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  background: var(--bg-card);
  user-select: none;
}
.feature-tag input { display: none; }
.feature-tag:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); }
.feature-tag.checked { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); font-weight: 500; }
.feature-tag .tag-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-hover); display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.feature-tag.checked .tag-check { background: var(--brand); border-color: var(--brand); color: #fff; font-size: 10px; }

/* ── Section titles ── */
.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 500; margin-bottom: .25rem; }
.section-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 1.5rem; font-style: italic; }

/* ── Step indicator ── */
.steps { display: flex; gap: 0; margin-bottom: 2rem; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12px; font-family: var(--font-mono); color: var(--text-faint); }
.step-num { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-hover); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.step.active .step-num { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.done .step-num { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.step.active { color: var(--text); }
.step-sep { flex: 1; height: 1px; background: var(--border); margin: 0 8px; min-width: 20px; }

/* ── Dashboard ── */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.inv-card {
  background: var(--bg-card);
  border: .5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
  display: block;
}
.inv-card:hover { border-color: var(--brand); box-shadow: 0 2px 12px rgba(29,158,117,.1); }
.inv-card-name { font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }
.inv-card-loc { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 12px; }
.inv-card-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-stat { font-size: 11px; font-family: var(--font-mono); background: var(--gray-light); padding: 3px 8px; border-radius: 4px; color: var(--gray); }

/* ── Budget table ── */
.budget-bar { background: var(--bg-card); border: .5px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.budget-nums { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.budget-lbl { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.budget-val { font-size: 24px; font-family: var(--font-display); font-weight: 500; letter-spacing: -.5px; }
.budget-total { font-size: 14px; font-family: var(--font-mono); color: var(--text-muted); }
.bar-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 3px; transition: width .4s; }
.bar-fill.over { background: #e24b4a; }

.filter-pills { display: flex; gap: 6px; margin-bottom: 1rem; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 5px 14px; border-radius: 20px;
  border: .5px solid var(--border-hover);
  background: transparent; cursor: pointer;
  font-family: var(--font-mono); color: var(--text-muted);
  transition: all .15s; text-decoration: none;
}
.pill:hover { border-color: var(--brand); color: var(--brand-dark); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.cost-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.cost-card {
  background: var(--bg-card);
  border: .5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  transition: border-color .15s;
}
.cost-card:hover { border-color: var(--border-hover); }
.cost-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.cost-card-name { font-family: var(--font-display); font-size: 14px; flex: 1; margin-right: 8px; line-height: 1.3; }
.cost-card-menu { background: none; border: none; cursor: pointer; color: var(--text-faint); font-size: 18px; padding: 0 2px; border-radius: 4px; line-height: 1; }
.cost-card-menu:hover { background: var(--gray-light); }
.cost-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.cat-badge { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-family: var(--font-mono); }
.cat-Stan-surowy { background: var(--amber-light); color: var(--amber); }
.cat-Wyko-czenie, .cat-Wykończenie { background: var(--blue-light); color: var(--blue); }
.cat-Instalacje-El { background: #FAC77525; color: #854F0B; }
.cat-Instalacje-San { background: var(--brand-light); color: var(--brand-dark); }
.cat-Inne { background: var(--gray-light); color: var(--gray); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-Planowany { background: #B4B2A9; }
.dot-Oferta { background: #EF9F27; }
.dot-W-toku, .dot-w-toku { background: #378ADD; }
.dot-Rozliczony { background: var(--brand); }
.status-lbl { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.cost-amount { font-family: var(--font-display); font-size: 19px; font-weight: 500; letter-spacing: -.3px; }
.cost-amount.zero { font-size: 13px; font-style: italic; font-family: var(--font-main); color: var(--text-faint); }
.cost-contractor { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.cost-date { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); margin-top: 8px; padding-top: 8px; border-top: .5px solid var(--border); }

/* Dropdown menu */
.dropdown-wrap { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: 28px;
  background: var(--bg-card);
  border: .5px solid var(--border-hover);
  border-radius: var(--radius-sm);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.dropdown-menu a,
.dropdown-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 14px;
  font-size: 13px; font-family: var(--font-main);
  color: var(--text); background: none; border: none;
  cursor: pointer; text-decoration: none;
  transition: background .1s;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover { background: var(--gray-light); }
.dropdown-menu .sep { height: .5px; background: var(--border); }
.dropdown-menu .danger { color: #c0392b; }

/* ── Modal ── */
.modal-bg {
  display: none;
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.45);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: .5px solid var(--border-hover);
  padding: 1.5rem;
  width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-title { font-family: var(--font-display); font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-faint); padding: 0 4px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-light); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; padding-top: 1rem; border-top: .5px solid var(--border); }

/* ── Admin table ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); padding: 8px 12px; border-bottom: .5px solid var(--border); text-align: left; font-weight: 400; }
.admin-table td { padding: 10px 12px; border-bottom: .5px solid var(--border); vertical-align: top; }
.admin-table tr:hover td { background: var(--brand-light); }
.admin-table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* ── Public offer page ── */
.public-wrap { max-width: 520px; margin: 2rem auto; }
.public-card { background: var(--bg-card); border: .5px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.token-url { font-family: var(--font-mono); font-size: 12px; word-break: break-all; background: var(--gray-light); padding: 8px 12px; border-radius: 6px; color: var(--brand-dark); margin: 8px 0; }
.req-list { list-style: none; }
.req-list li { font-size: 13px; padding: 3px 0; display: flex; align-items: center; gap: 8px; font-style: italic; }
.req-list li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.standards-box { background: var(--amber-light); border-radius: var(--radius-sm); padding: .875rem; font-size: 13px; line-height: 1.6; color: #633806; font-style: italic; margin-bottom: 1.25rem; }

/* ── Misc ── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 12px; }
.page-title { font-family: var(--font-display); font-size: 24px; }
.page-sub { font-size: 13px; color: var(--text-muted); font-style: italic; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { font-style: italic; margin-bottom: 1rem; }
.tag { display: inline-block; font-size: 11px; font-family: var(--font-mono); padding: 2px 8px; border-radius: 4px; background: var(--gray-light); color: var(--gray); margin: 2px; }
.divider { height: .5px; background: var(--border); margin: 1.5rem 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .main-content { padding: 1rem; }
  .field-row { grid-template-columns: 1fr; }
  .cost-grid { grid-template-columns: 1fr; }
  .inv-grid { grid-template-columns: 1fr; }
  .steps { gap: 0; }
  .step span.step-label { display: none; }
}
