:root {
    --bg: #0d1117;
    --panel: #161b22;
    --panel-2: #1c2230;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #2f81f7;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* ---------- Topbar ---------- */
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-login { font-weight: 600; }
.user-team { color: var(--muted); font-size: 0.85rem; }

.badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.badge-admin { background: rgba(210,153,34,0.15); color: var(--yellow); border-color: var(--yellow); }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 20px; transition: max-width 0.15s ease; }
/* Widok admina — szeroki układ (full HD) zamiast wąskiej kolumny. */
.container.admin-wide { max-width: min(1800px, 96vw); }

/* Baner podglądu cudzych danych (admin). */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(210,153,34,0.12);
    border: 1px solid var(--yellow);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    color: var(--yellow);
}
/* Atrybut hidden musi nadpisać display ustawiony klasami (np. flex/inline-flex). */
[hidden] { display: none !important; }

/* Pasek filtrów (pełne rozbicie). */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}
.filters-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--muted);
}
.filters-bar select,
.filters-bar input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 5px 8px;
    font-size: 0.85rem;
}
.admin-hint { margin-top: -4px; margin-bottom: 12px; font-size: 0.82rem; }
a.user-link { color: var(--green); text-decoration: none; }
a.user-link:hover { text-decoration: underline; }
.pricing-link {
    font-weight: 400;
    font-size: 0.78rem;
    margin-left: 8px;
    color: var(--green);
    text-decoration: none;
}
.pricing-link:hover { text-decoration: underline; }
.pricing-note { margin-top: -4px; margin-bottom: 10px; font-size: 0.8rem; }
/* Separator wizualny przed kolumnami cennika (Input/Output). */
th.col-sep, td.col-sep { border-left: 2px solid var(--border); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card h3 { font-size: 0.95rem; color: var(--muted); margin-bottom: 8px; }
.admin-card { border-color: var(--yellow); }

.info-panel {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
}
.info-panel summary { cursor: pointer; font-weight: 600; }
.info-panel ul { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.info-panel li { margin-bottom: 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.btn:hover { background: #262d3a; text-decoration: none; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #1f6feb; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-github { background: #238636; border-color: #238636; color: #fff; font-weight: 600; font-size: 1rem; }
.btn-github:hover { background: #2ea043; text-decoration: none; }

/* ---------- Budget ---------- */
.budget-summary { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 16px; }
.budget-metric { display: flex; flex-direction: column; }
.budget-metric .label { color: var(--muted); font-size: 0.8rem; }
.budget-metric .value { font-size: 1.4rem; font-weight: 700; }
.value-green { color: var(--green); }
.value-red { color: var(--red); }
.topup-msg { margin-left: 12px; font-size: 0.9rem; }
.topup-msg.ok { color: var(--green); }
.topup-msg.err { color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--border); }
tbody tr:hover { background: var(--panel-2); }
tfoot td { font-weight: 700; border-top: 2px solid var(--border); }

/* sortowalne nagłówki w tabeli admina */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable.sorted { color: var(--text); }

/* ---------- View tabs (admin) ---------- */
.view-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.view-tab {
    background: var(--panel); color: var(--muted); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 18px; cursor: pointer; font-size: 0.9rem; font-weight: 600;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--panel-2); color: var(--text); border-color: var(--accent, #2f81f7); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 320px; margin-bottom: 16px; }

/* ---------- Compare ---------- */
.compare-summary { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 16px; }
.compare-metric { background: var(--panel-2); padding: 12px 16px; border-radius: 8px; }
.compare-metric .label { color: var(--muted); font-size: 0.8rem; }
.compare-metric .value { font-size: 1.2rem; font-weight: 700; }

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    max-width: 440px;
    width: 100%;
    text-align: center;
}
.login-card h1 { margin: 0 0 6px; }
.subtitle { color: var(--muted); margin-top: 0; }
.login-card .btn-github { width: 100%; justify-content: center; margin: 20px 0; }
.login-help { text-align: left; border-top: 1px solid var(--border); padding-top: 16px; }
.login-help h3 { font-size: 0.95rem; }
.login-help ol { padding-left: 20px; color: var(--muted); }
.login-help li { margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 0.85rem; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert-error { background: rgba(248,81,73,0.15); color: var(--red); border: 1px solid var(--red); }
