/* ============================================================
 * Wariant 2: Warm (przyjazny, prowadzący za rękę)
 * Top tabs, ciepłe kolory, większe fonty, wizard, animacje.
 * ============================================================ */

:root {
  --bg: #faf6ee;          /* ciepły kremowy */
  --bg-card: #ffffff;
  --bg-soft: #f3ecdf;
  --bg-hover: #efe7d6;
  --border: #e8ddc6;
  --border-strong: #d4c4a4;
  --text: #2a241a;
  --text-sub: #6b5f4d;
  --text-mute: #9a8c75;
  --accent: #8a1f2a;       /* burgund */
  --accent-soft: #a4323e;
  --accent-text: #ffffff;
  --secondary: #2d5566;    /* spokojny niebieski */
  --yellow: #f5c200;
  --success: #4a7c2e;
  --danger: #b13030;
  --warn: #b8731f;
  --shadow-sm: 0 2px 4px rgba(70,50,20,.06);
  --shadow-md: 0 8px 24px rgba(70,50,20,.10);
  --shadow-lg: 0 16px 48px rgba(70,50,20,.14);
  --radius: 14px;
  --radius-sm: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* ---- App shell ---- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar-w {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-sm);
}
.topbar-w .brand-block { display: flex; align-items: center; gap: 14px; }
.topbar-w .brand-block img { max-width: 130px; }
.topbar-w .brand-block .brand-text { font-size: 12px; color: var(--text-sub); text-transform: uppercase; letter-spacing: 1px; }

.tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.tabs .tab {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  transition: background .15s, color .15s;
}
.tabs .tab:hover { background: var(--bg-soft); color: var(--text); }
.tabs .tab.active { background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-sm); }

.topbar-w .file-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--text-sub);
  margin-left: 8px;
}
.topbar-w .user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.topbar-w .user-pill-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.topbar-w .user-pill-name::before {
  content: '👤';
  margin-right: 6px;
  opacity: .7;
}
.topbar-w .user-pill[hidden] { display: none; }

/* ---- Content ---- */
.content {
  flex: 1;
  padding: 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.page-head {
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}
.page-head .page-sub { font-size: 16px; color: var(--text-sub); margin-top: 6px; }

/* ---- Primitives ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border-strong);
  transition: transform .12s, background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn-yellow { background: var(--yellow); color: #2a241a; border-color: var(--yellow); }
.btn-yellow:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-sub); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: #fbe9e9; border-color: #e8b6b6; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-xl { padding: 22px 44px; font-size: 19px; border-radius: 999px; }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(138,31,42,.10);
}
.textarea { min-height: 80px; resize: vertical; font-family: inherit; line-height: 1.4; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text-sub); }
.field .hint { font-size: 13px; color: var(--text-mute); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ---- Hero (dashboard) ---- */
.hero {
  background: linear-gradient(135deg, #fef9eb 0%, #f5e9c8 100%);
  border-radius: 20px;
  padding: 40px 36px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 200px;
  height: 200px;
  background: var(--yellow);
  border-radius: 50%;
  opacity: .25;
}
.hero h2 { font-size: 28px; margin: 0 0 8px; font-weight: 800; }
.hero p { font-size: 16px; color: var(--text-sub); margin: 0 0 4px; max-width: 480px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat .stat-label {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-mute);
  letter-spacing: .8px;
  font-weight: 700;
}
.stat .stat-value { font-size: 32px; font-weight: 800; margin-top: 6px; color: var(--accent); }
.stat .stat-sub { font-size: 13px; color: var(--text-sub); margin-top: 4px; }

/* ---- Tabela ---- */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  background: var(--bg-soft);
  font-weight: 700;
  color: var(--text-sub);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table .row-actions { display: flex; gap: 6px; }

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.tag.green { background: #e6f0d8; color: var(--success); }
.tag.amber { background: #fdf0d6; color: var(--warn); }
.tag.red { background: #fbe0e0; color: var(--danger); }

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.toolbar .pill.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---- Welcome ---- */
.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #faf6ee 0%, #f5e9c8 100%);
}
.welcome .panel {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 48px;
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.welcome img.brand { max-width: 200px; margin: 0 auto 24px; }
.welcome h1 { font-size: 32px; margin: 0 0 8px; font-weight: 800; }
.welcome p { color: var(--text-sub); margin: 0 0 28px; font-size: 17px; }
.welcome .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.welcome .dropzone {
  margin-top: 24px;
  border: 3px dashed var(--border-strong);
  border-radius: 16px;
  padding: 32px;
  color: var(--text-mute);
  font-size: 15px;
  transition: background .15s, border-color .15s;
}
.welcome .dropzone.over { background: rgba(245,194,0,.12); border-color: var(--yellow); color: var(--text); }

#loginScreen .panel { max-width: 420px; padding: 36px 36px 28px; }
#loginScreen form .field { margin-bottom: 14px; }
#loginScreen .login-error {
  background: #fdecec;
  color: #a02525;
  border: 1px solid #f3b9b9;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  text-align: left;
}

/* ---- Modal ---- */
.modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: calc(100vh - 60px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 920px; }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal .modal-sub { color: var(--text-sub); margin: 0 0 24px; font-size: 15px; }
.modal .modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* ---- Wizard ---- */
.wizard {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.wizard-step {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mute);
  border-bottom: 4px solid transparent;
  margin-bottom: -2px;
  position: relative;
}
.wizard-step.done { color: var(--success); }
.wizard-step.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 13px;
  font-weight: 800;
  margin-right: 8px;
  vertical-align: middle;
}
.wizard-step.active .step-num { background: var(--accent); color: var(--accent-text); }
.wizard-step.done .step-num { background: var(--success); color: #fff; }
.wizard-body { min-height: 360px; }
.wizard-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ---- Tooltip ---- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-card);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 100;
}

/* ---- Confirm screen ---- */
.confirm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.confirm-layout .pdf-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow: auto;
  max-height: calc(100vh - 260px);
}
/* zoom przesuwa również layout (Safari/Chrome) - dzięki temu kontener
   ma realną szerokość dokumentu * zoom, brak pustego miejsca pod spodem */
.confirm-layout .pdf-preview .wz-doc {
  zoom: 0.92;
  margin: 0 auto;
}
@media (max-width: 1400px) {
  .confirm-layout .pdf-preview .wz-doc { zoom: 0.82; }
}
@media (max-width: 1200px) {
  .confirm-layout .pdf-preview .wz-doc { zoom: 0.72; }
}

.empty { text-align: center; padding: 60px 20px; color: var(--text-sub); }
.empty h2 { font-size: 22px; margin: 0 0 8px; color: var(--text); font-weight: 700; }
.empty p { margin: 0 0 20px; font-size: 16px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .confirm-layout { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; }
}
