/* ============== Preiscale CRM — Hi-Fi tokens ============== */
:root {
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Display", "Inter", system-ui, sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-serif: "Fraunces", "New York", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Surfaces */
  --bg: #0C0B10;
  --bg-1: #131218;
  --bg-2: #1A1922;
  --bg-3: #22202B;

  /* Lines */
  --line: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.10);
  --line-3: rgba(255,255,255,0.16);

  /* Text */
  --text: #ECEAF2;
  --text-2: #9C9AA8;
  --text-3: #6A6878;
  --text-4: #4A4856;

  /* Accent (warm amber — z wariantu C) */
  --accent: #E8B26B;
  --accent-2: #FFD699;
  --accent-soft: rgba(232,178,107,0.12);

  /* Semantic */
  --pos: #7BCFA1;
  --pos-soft: rgba(123,207,161,0.12);
  --warn: #E0B86F;
  --warn-soft: rgba(224,184,111,0.12);
  --neg: #E07A6F;
  --neg-soft: rgba(224,122,111,0.12);
  --info: #8FA8E0;
  --info-soft: rgba(143,168,224,0.12);

  /* Pipeline colors (subtle, harmonized) */
  --p1: #B8A5FF;
  --p2: #84E0B8;
  --p3: #E8B26B;
  --p4: #FF9B8A;
  --p5: #84C2E0;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Shadows */
  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px -12px rgba(0,0,0,0.5);
}

/* Aurora background (toggle-able via .no-aurora on app) */
.app-bg {
  background:
    radial-gradient(900px 700px at -10% -10%, rgba(184,165,255,0.14), transparent 60%),
    radial-gradient(900px 800px at 110% 0%, rgba(132,194,224,0.10), transparent 60%),
    radial-gradient(1100px 900px at 50% 130%, rgba(232,178,107,0.10), transparent 60%),
    var(--bg);
}
.app-bg.no-aurora { background: var(--bg); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-text);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  color-scheme: dark;
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.022em; }
.serif { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.02em; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); background-clip: content-box; border: 2px solid transparent; }

/* Utilities */
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.micro { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.num { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -0.015em; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }

/* Card */
.card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card-tight { border-radius: var(--r-md); }
.hairline { border-top: 1px solid var(--line); }

/* Tag / badge */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--line-2); color: var(--text-2);
  background: rgba(255,255,255,0.02);
}
.tag-pos { color: var(--pos); border-color: rgba(123,207,161,0.25); background: var(--pos-soft); }
.tag-warn { color: var(--warn); border-color: rgba(224,184,111,0.25); background: var(--warn-soft); }
.tag-neg { color: var(--neg); border-color: rgba(224,122,111,0.25); background: var(--neg-soft); }
.tag-info { color: var(--info); border-color: rgba(143,168,224,0.25); background: var(--info-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 9px;
  font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--line-2);
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease, box-shadow 140ms ease;
}
.btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--line-3);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -6px rgba(0,0,0,0.4);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary {
  background: var(--accent);
  color: #1A1208;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: 0 6px 16px -6px rgba(232,178,107,0.5);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); transform: none; box-shadow: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; gap: 5px; border-radius: 7px; }
.btn-icon { padding: 7px; aspect-ratio: 1; justify-content: center; }

/* Icons */
.icn { flex: none; stroke-width: 1.5; }

/* Checkbox */
.cb { width: 17px; height: 17px; border: 1.5px solid var(--text-3); border-radius: 5px; flex: none; cursor: pointer; transition: all 120ms; }
.cb:hover { border-color: var(--text-2); background: rgba(255,255,255,0.03); }
.cb.checked { background: var(--accent); border-color: var(--accent); }

/* Inputs */
.input {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 100%;
}
.input:focus { border-color: var(--accent); background: rgba(255,255,255,0.05); }

/* Custom Select (zamiennik natywnego <select>) */
.select-trigger {
  user-select: none;
  text-align: left;
}
.select-trigger:hover:not(:disabled) {
  border-color: var(--line-3);
  background: rgba(255,255,255,0.04);
}
.select-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: rgba(255,255,255,0.05);
}

.select-menu {
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line-3);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 16px 36px -12px rgba(0,0,0,0.7),
    0 0 0 1px rgba(0,0,0,0.4);
  overflow-y: auto;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-text);
  animation: select-in 120ms ease-out;
}
@keyframes select-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
  transition: background 80ms ease, color 80ms ease;
}
.select-option.is-active {
  background: rgba(255,255,255,0.06);
}
.select-option.is-selected {
  color: var(--accent);
}
.select-option.is-active.is-selected {
  background: var(--accent-soft);
}
.select-option:active {
  background: var(--accent-soft);
}

/* Tabs */
.tabs { display: flex; gap: 2px; padding: 3px; background: rgba(255,255,255,0.04); border-radius: 9px; border: 1px solid var(--line); }
.tab { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; border: none; background: transparent; color: var(--text-2); transition: background 140ms ease, color 140ms ease; }
.tab:hover:not(.active) { background: rgba(255,255,255,0.04); color: var(--text); }
.tab.active { background: rgba(255,255,255,0.07); color: var(--text); }

/* Kbd */
.kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-2);
  color: var(--text-2);
}

/* ============== HOVER AFFORDANCE (globalne) ============== */
/* Wszystko co klikalne ma wyraźny wskaźnik. */

/* Każdy button (wbudowany lub niezalezny od klasy .btn) ma pointer */
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

/* Linki z onclick lub href — cursor pointer (browser daje to dla href, ale dla onclick też) */
a { cursor: pointer; }

/* Inputy / select / textarea — text/dropdown cursor (przywróć po button) */
input, textarea { cursor: text; }
select, .input[type="date"], input[type="date"], input[type="datetime-local"] { cursor: pointer; }
input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; }

/* Generyczny "klikalny" element (np. divy z onClick) — opt-in przez klasę */
.clickable {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}
.clickable:hover { background: rgba(255,255,255,0.04); }

/* Karta z onClick (inline) — dodaj klasę .card-clickable żeby dostać hover */
.card-clickable {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.card-clickable:hover {
  border-color: var(--accent);
  background: rgba(255,255,255,0.04);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -10px rgba(0,0,0,0.4);
}

/* Tag jeśli klikalny (np. plakietka etapu w nagłówku klienta) */
.tag-clickable { cursor: pointer; transition: background 140ms ease, border-color 140ms ease; }
.tag-clickable:hover { background: rgba(255,255,255,0.06); border-color: var(--line-3); }

/* Linki w nagłówku/breadcrumb/oś czasu — wyraźniejsza zmiana koloru */
.link, a.link {
  color: var(--text-2);
  cursor: pointer;
  transition: color 140ms ease;
}
.link:hover { color: var(--text); }

/* Ikony "więcej / kosz / edycja" w wierszach — rozjaśnij przy hover */
.icn { transition: color 140ms ease, opacity 140ms ease; }
button:hover .icn, .clickable:hover .icn, .card-clickable:hover .icn { color: var(--text); }

/* Checkboxes — już mają hover, dodaj transition */
.cb { transition: border-color 120ms ease, background 120ms ease; }

/* Focus ring — accessibility (klawiatura) */
button:focus-visible,
a:focus-visible,
.input:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.clickable:focus-visible,
.card-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Usuń niepotrzebny outline na klikach myszą */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* Reduced motion — szanuj preferencje */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .btn:hover, .card-clickable:hover { transform: none !important; }
}
