/* ============================================================
   System Pozycjonujacy GEO — style panelu (bez zaleznosci, FTP-friendly)
   Kolorystyka wzorowana na super-grupa.pl: granat wiodacy + zloty akcent.
   Granat = struktura i akcje (przyciski, aktywna nawigacja, focus).
   Zloto  = wyroznienie (kluczowe liczby, odznaki, ikona aktywnej pozycji).
   ============================================================ */

:root {
    --bg:         #f6f6f9;
    --sidebar:    #ffffff;
    --panel:      #ffffff;
    --ink:        #1b1c28;
    --ink-soft:   #484859;
    --muted:      #69727d;
    --line:       #e4e6ec;   /* obramowania kart */
    --line-2:     #eef0f4;   /* delikatne separatory wewnetrzne */
    --accent:     #293f66;   /* granat — kolor wiodacy */
    --accent-2:   #1d2e4d;   /* hover akcentu */
    --accent-soft:#eaeef5;   /* jasne tlo w odcieniu granatu */
    --accent-line:#c6cfe0;   /* obramowanie w odcieniu granatu */
    --gold:       #a8916f;   /* zloty akcent uzupelniajacy */
    --gold-2:     #82694b;   /* ciemniejsze zloto — tekst; kontrast AA na bialym i na --gold-soft */
    --gold-soft:  #f4f0e9;   /* jasne tlo w odcieniu zlota */
    --gold-line:  #e0d6c4;
    --ok:         #16a34a;
    --ok-solid:   #12b76a;
    --warn:       #d97706;
    --err:        #dc2626;
    --info:       #2563eb;
    --pink:       #db2777;   /* status "wymaga poprawy" */
    --dark-pill:  #22314c;   /* ciemny "keyword" pill (granat) */
    --radius:     14px;
    --radius-lg:  16px;
    --shadow:     0 1px 2px rgba(16,24,40,.05);
    --shadow-md:  0 2px 8px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Znak marki (logo) ---------- */
.brand-mark {
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3d5a8f, var(--accent));
    color: #fff; display: grid; place-items: center;
    font-size: 17px; line-height: 1;
    box-shadow: 0 2px 6px rgba(41,63,102,.35);
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px;
    flex: 0 0 252px;
    background: var(--sidebar);
    color: var(--ink-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--line);
}
.sidebar .brand {
    padding: 18px 20px 14px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: .1px;
    display: flex; align-items: center; gap: 11px;
}

/* profil uzytkownika u gory sidebaru */
.side-profile {
    margin: 4px 14px 8px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex; align-items: center; gap: 11px;
    background: #fff;
}
.side-avatar {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 50%;
    background: #eef0f3; color: var(--ink);
    display: grid; place-items: center;
    font-weight: 700; font-size: 15px;
}
.side-meta { min-width: 0; }
.side-name { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-plan {
    display: inline-block; margin-top: 3px;
    font-size: 11px; font-weight: 600;
    background: var(--gold-soft); color: var(--gold-2);
    padding: 2px 8px; border-radius: 999px;
}

.sidebar nav { padding: 8px 12px; overflow-y: auto; flex: 1; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px;
    margin: 2px 0;
    border-radius: 9px;
    color: var(--ink-soft);
    font-size: 14px;
    transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: #f4f5f7; color: var(--ink); text-decoration: none; }
.sidebar nav a.active { background: #eef0f3; color: var(--ink); font-weight: 600; }
.sidebar nav a.active .ico { color: var(--gold); }
.sidebar nav a .ico { width: 20px; text-align: center; opacity: .95; font-size: 15px; color: var(--muted); }
.sidebar nav .group-label { color: var(--ink); font-weight: 700; font-size: 12.5px; letter-spacing: .1px; padding: 16px 11px 5px; }

.sidebar .foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.side-logout {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    font-size: 14px; font-weight: 600; font-family: inherit;
    transition: border-color .12s, color .12s, background .12s;
}
.side-logout:hover { border-color: var(--accent-line); color: var(--accent-2); background: #f7f9fc; }
.side-foot-note { margin-top: 10px; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 62px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(150%) blur(6px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px;
    padding: 0 26px;
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.2px; color: var(--ink); }
.topbar-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; font-size: 17px; }

.content { padding: 26px; flex: 1; }

/* ---------- Karty statystyk ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.card .value { font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -1px; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.card .value.accent { color: var(--gold-2); }

/* ---------- Panele ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.panel .panel-head { padding: 16px 22px; border-bottom: 1px solid var(--line-2); font-weight: 700; font-size: 15.5px; display: flex; align-items: center; justify-content: space-between; }
.panel .panel-body { padding: 22px; }

/* ---------- Odznaki / statusy ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.phase { background: var(--gold-soft); color: var(--gold-2); border: 1px solid var(--gold-line); }
.badge.info { background: #eff6ff; color: var(--info); }
.badge.warn { background: #fffbeb; color: var(--warn); }
.badge.crit { background: #fef2f2; color: var(--err); }
.badge.ok   { background: #f0fdf4; color: var(--ok); }

/* solidne "pigulki" statusu w stylu konkurencji */
.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.pill.excellent { background: var(--ok-solid); }
.pill.good      { background: var(--info); }
.pill.needs     { background: var(--pink); }
.pill.bad       { background: var(--err); }

/* ciemny "keyword" pill */
.kw { display: inline-block; background: var(--dark-pill); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; }

/* ---------- Tabele ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .ico { font-size: 34px; opacity: .35; margin-bottom: 10px; }

.muted { color: var(--muted); }
.flex { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

.alert-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.alert-line:last-child { border-bottom: 0; }

/* ---------- Login (guest) ---------- */
.guest {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(1100px 520px at 15% -10%, #e3e9f4 0%, rgba(227,233,244,0) 55%),
        radial-gradient(900px 500px at 110% 20%, #f2ece1 0%, rgba(242,236,225,0) 50%),
        var(--bg);
    padding: 20px;
}
.login-card { width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: 0 18px 50px rgba(16,24,40,.10); }
.login-card .logo { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 19px; margin-bottom: 6px; color: var(--ink); }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.form-control { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff; color: var(--ink); }
.form-control:focus { outline: 3px solid rgba(41,63,102,.18); border-color: var(--accent); }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%; transition: background .12s; }
.btn:hover { background: var(--accent-2); }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--err); border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 16px; }

/* ---------- Pole hasla z ikona oka ---------- */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px; color: var(--muted); border-radius: 6px; }
.pw-toggle:hover { color: var(--ink); background: #f1f5f9; }

/* ---------- Toolbar (naglowek sekcji z akcja) ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.toolbar .t-title { font-size: 15px; color: var(--muted); }

/* ---------- Przyciski w tresci ---------- */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid transparent; border-radius: 10px;
    padding: 9px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
    text-decoration: none; line-height: 1;
    transition: background .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: #cfd2d8; background: #fafbfc; text-decoration: none; }
.btn-danger { background: #fff; color: var(--err); border-color: #fecaca; }
.btn-danger:hover { background: var(--err); color: #fff; text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font-size: 13px; padding: 0; }
.inline-form { display: inline; margin: 0; }

/* ---------- Formularze w tresci ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.input, .select, textarea.input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus, .select:focus, textarea.input:focus { outline: 3px solid rgba(41,63,102,.18); border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 70px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.check input { width: auto; accent-color: var(--accent); }

/* ---------- Komunikaty flash w tresci ---------- */
.flash { border-radius: 10px; padding: 11px 15px; margin-bottom: 18px; font-size: 14px; }
.flash.ok  { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.flash.err { background: #fef2f2; border: 1px solid #fecaca; color: var(--err); }
.flash.err ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Drobne ---------- */
.chip { display: inline-block; background: #f1f3f5; border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; font-size: 12px; margin: 2px 3px 2px 0; color: var(--ink-soft); }
.status-active   { color: var(--ok); font-weight: 600; }
.status-paused   { color: var(--warn); font-weight: 600; }
.status-archived { color: var(--muted); font-weight: 600; }
td.actions { text-align: right; white-space: nowrap; }
.subhead { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.subhead h3 { margin: 0; font-size: 15px; }
a.row-link { font-weight: 600; color: var(--ink); }
a.row-link:hover { color: var(--accent-2); }

/* ---------- Kanban (zadania) ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kcol { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-weight: 600; }
.kcol-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.kcard-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.kcard-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; line-height: 1.35; }
.kcard-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.kcard-url { font-size: 12px; color: var(--accent-2); word-break: break-all; display: block; margin-bottom: 10px; }
.kcard-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- Segmentowany przelacznik (wykres) ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: #fff; color: var(--muted); padding: 6px 12px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.seg button:hover:not(.on) { background: #f4f5f7; }

/* ---------- Boksy „srednia pozycja wg modeli LLM" (Dashboard) ---------- */
.pos-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.pos-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 12px;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.pos-box .pos-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pos-box .pos-title { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.35; }
.pos-box .pos-ico { flex: none; }
.pos-box .pos-value { font-size: 38px; font-weight: 800; line-height: 1.05; letter-spacing: -1px; margin-top: 10px; }
.pos-box .pos-model { font-size: 12px; margin-top: 2px; }
.pos-box .pos-spark { margin-top: 10px; }
.pos-box.pos-empty { background: #fbfbfc; }
.pos-box .pos-nodata {
    margin-top: 10px; height: 78px;
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--line); border-radius: 10px;
    color: #9aa1ac; font-size: 13px; font-weight: 600; letter-spacing: .2px;
}

@media (max-width: 820px) {
    .sidebar { position: fixed; left: -252px; z-index: 30; transition: left .2s; box-shadow: 0 10px 40px rgba(16,24,40,.18); }
    .sidebar.open { left: 0; }
    .main { width: 100%; }
    .topbar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .panel .panel-head { flex-wrap: wrap; gap: 10px; }
    .kanban { grid-template-columns: 1fr; }
    .card .value { font-size: 34px; }
}
