:root {
    --blue: #3563e9;
    --blue-dark: #2a51c4;
    --blue-light: #eef3fe;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #eceef2;
    --border-dark: #dfe3ea;

    --text: #1a202c;
    --muted: #7c8aa0;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* ---------- przyciski ---------- */

.btn-primary,
.btn-gold {
    display: inline-block;
    padding: 0.6rem 1.3rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--blue);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.13s ease;
}

.btn-primary:hover,
.btn-gold:hover { background: var(--blue-dark); }

.btn-primary[disabled],
.btn-gold[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.45rem 1rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #344054;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.13s ease;
}

.btn-secondary:hover { background: var(--bg); }

/* ---------- strona logowania ---------- */

.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--bg);
}

.logo-tile {
    background: #1b1e24;
    border-radius: 16px;
    padding: 1.05rem 1.5rem;
    margin-bottom: 1.6rem;
}

.logo-tile img {
    width: 180px;
    height: auto;
    display: block;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 2rem 1.9rem 1.6rem;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    margin: 0 0 0.15rem;
    font-size: 1.12rem;
    font-weight: 600;
}

.auth-subtitle {
    margin: 0 0 1.4rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.auth-card label {
    display: block;
    margin: 0.95rem 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #344054;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.13s ease, box-shadow 0.13s ease;
}

.auth-card input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.13);
}

.input-wrap { position: relative; }

.input-wrap input { padding-right: 2.6rem; }

.toggle-pass {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    padding: 5px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.toggle-pass:hover { color: var(--text); }

.toggle-pass .i-hide { display: none; }
.toggle-pass.on .i-show { display: none; }
.toggle-pass.on .i-hide { display: block; }

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.95rem;
}

.remember {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.84rem;
    color: #344054;
    cursor: pointer;
    user-select: none;
}

.remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
    cursor: pointer;
}

.auth-card button[type="submit"] {
    width: 100%;
    margin-top: 1.35rem;
    padding: 0.68rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--blue);
    color: #fff;
    font-size: 0.93rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.13s ease;
}

.auth-card button[type="submit"]:hover { background: var(--blue-dark); }

.auth-card button[type="submit"][disabled] { opacity: 0.6; cursor: default; }

.auth-footer {
    margin: 1.4rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: #9aa5b5;
}

.alert {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    margin-bottom: 0.3rem;
}

.alert-error {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

/* ---------- układ panelu ---------- */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.15rem 0.9rem 1rem;
}

.sidebar-logo {
    display: block;
    background: #1b1e24;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
}

.sidebar-logo img {
    width: 100%;
    max-width: 145px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.13s ease, color 0.13s ease;
}

.nav a svg { flex-shrink: 0; }

.nav a:hover {
    background: var(--bg);
    color: var(--text);
}

.nav a.active {
    background: var(--blue-light);
    color: var(--blue);
}

.nav a.active::before {
    content: "";
    position: absolute;
    left: -0.9rem;
    top: 22%;
    height: 56%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--blue);
}

.sidebar-logout {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 0.7rem;
}

.sidebar-logout button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.85rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.13s ease, color 0.13s ease;
}

.sidebar-logout button:hover {
    background: #fef3f2;
    color: #d92d20;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    padding: 0.75rem 1.6rem;
    border-bottom: 1px solid var(--border);
}

.search {
    position: relative;
    flex: 0 1 420px;
}

.search svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search input {
    width: 100%;
    padding: 0.55rem 0.9rem 0.55rem 2.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.13s ease, background 0.13s ease, box-shadow 0.13s ease;
}

.search input::placeholder { color: #9aa5b5; }

.search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.12);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.86rem;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
}

.topbar-user .user-name {
    color: #344054;
    font-weight: 500;
}

.content {
    padding: 1.8rem 1.6rem 2.5rem;
    max-width: 1120px;
    width: 100%;
}

.content h1 {
    margin: 0 0 0.25rem;
    font-size: 1.22rem;
    font-weight: 600;
}

.content .lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.88rem;
}

/* karty statystyk */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.2rem 1.3rem;
}

.card-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin: 0 0 0.25rem;
}

.card-value {
    font-size: 1.45rem;
    font-weight: 600;
    margin: 0;
}

/* znaczniki statusu */

.badge {
    display: inline-block;
    padding: 0.18rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 500;
}

.badge-warn {
    background: #fffaeb;
    color: #b54708;
}

.badge-ok {
    background: #ecfdf3;
    color: #027a48;
}

/* panel z wierszami (KSeF, ustawienia) */

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.3rem;
    border-bottom: 1px solid #f1f3f7;
    font-size: 0.88rem;
}

.panel-row:last-child { border-bottom: 0; }

.panel-row .row-label { color: var(--muted); }
.panel-row .row-value { font-weight: 500; }

/* pusty stan */

.empty-state {
    background: var(--surface);
    border: 1px dashed #d8dde6;
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
}

.empty-state h2 {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.empty-state p { margin: 0; font-size: 0.86rem; }

.muted { color: var(--muted); }

/* ---------- Ustawienia ---------- */

.settings { max-width: 940px; }

/* hero */
.settings-hero {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.4rem;
}

.hero-cover {
    height: 104px;
    background:
        radial-gradient(420px 170px at 82% -45%, rgba(255, 255, 255, 0.28), transparent 70%),
        linear-gradient(118deg, #2742a8, #3563e9 58%, #5b82f2);
}

.hero-cover::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 104px;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 30px 30px;
    -webkit-mask-image: linear-gradient(115deg, #000, transparent 72%);
    mask-image: linear-gradient(115deg, #000, transparent 72%);
    pointer-events: none;
}

.hero-body {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 1.15rem;
    padding: 0 1.6rem 1.3rem;
    margin-top: -36px;
}

.hero-avatar {
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    border-radius: 20px;
    background: linear-gradient(158deg, #4d74ee, #2a4cc4);
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--surface);
    box-shadow: 0 8px 20px rgba(42, 76, 196, 0.32);
}

.hero-meta {
    flex: 1;
    min-width: 0;
    padding-bottom: 3px;
}

.hero-meta h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.hero-meta .hero-mail {
    color: var(--muted);
    font-size: 0.88rem;
}

.hero-badges {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 5px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.72rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--blue-light);
    color: var(--blue);
    white-space: nowrap;
}

.pill svg { width: 13px; height: 13px; }
.pill-muted { background: #f2f4f7; color: #475467; }

/* tabs */
.settings-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 1.4rem;
    box-shadow: var(--shadow-sm);
}

.settings-tabs .tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.87rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.settings-tabs .tab svg { opacity: 0.85; flex-shrink: 0; }
.settings-tabs .tab:hover { color: var(--text); background: var(--bg); }

.settings-tabs .tab.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 3px 9px rgba(53, 99, 233, 0.32);
}

.settings-tabs .tab.active svg { opacity: 1; }

/* panels */
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: panelIn 0.26s ease; }

@keyframes panelIn {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: none; }
}

/* section card */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.2rem;
}

.section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.section-ic {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--blue-light);
    color: var(--blue);
}

.section-ic.ic-danger { background: #fef3f2; color: #d92d20; }
.section-ic.ic-ok { background: #ecfdf3; color: #12b76a; }

.section-head .h { margin: 0; font-size: 1rem; font-weight: 600; }
.section-head .s { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--muted); }

.section-body { padding: 0.3rem 1.5rem; }

/* dwukolumnowe wiersze pol */
.field-row {
    display: flex;
    gap: 2rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid #f1f3f7;
}

.field-row:last-child { border-bottom: 0; }

.field-label { flex: 0 0 32%; padding-top: 0.35rem; }
.field-label .t { display: block; font-size: 0.88rem; font-weight: 600; color: #1d2939; }
.field-label .d { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; line-height: 1.45; }
.field-control { flex: 1; min-width: 0; }

.section-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.95rem 1.5rem;
    background: #fafbfc;
    border-top: 1px solid var(--border);
}

.section-footer .note { font-size: 0.78rem; color: var(--muted); }

/* inputy w ustawieniach */
.settings-panel input[type="text"],
.settings-panel input[type="email"],
.settings-panel input[type="password"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.13s ease, box-shadow 0.13s ease;
}

.settings-panel input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.13);
}

.settings-panel input:disabled { background: #f6f7f9; color: var(--muted); cursor: not-allowed; }

/* sila hasla */
.pwd-strength {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.7rem;
    color: var(--muted);
}

.pwd-bars { display: flex; gap: 5px; flex: 1; }
.pwd-bars i { height: 5px; flex: 1; border-radius: 99px; background: #eceef2; transition: background 0.25s ease; }
.pwd-strength .lbl { font-size: 0.75rem; font-weight: 600; color: inherit; min-width: 78px; text-align: right; }

.pwd-strength.lvl-1 { color: #f04438; }
.pwd-strength.lvl-2 { color: #f79009; }
.pwd-strength.lvl-3 { color: #3563e9; }
.pwd-strength.lvl-4 { color: #12b76a; }
.pwd-strength.lvl-1 .pwd-bars i:nth-child(-n+1),
.pwd-strength.lvl-2 .pwd-bars i:nth-child(-n+2),
.pwd-strength.lvl-3 .pwd-bars i:nth-child(-n+3),
.pwd-strength.lvl-4 .pwd-bars i:nth-child(-n+4) { background: currentColor; }

.match-hint { margin: 0.5rem 0 0; font-size: 0.78rem; min-height: 1em; }
.match-hint.ok { color: #027a48; }
.match-hint.bad { color: #b42318; }

/* bezpieczenstwo */
.device-row {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    padding: 1rem 1.15rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 1.1rem;
}

.device-ic {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--blue-light);
    color: var(--blue);
}

.device-row .grow { flex: 1; min-width: 0; }
.device-row .t { font-weight: 600; font-size: 0.9rem; }
.device-row .d { font-size: 0.82rem; color: var(--muted); margin-top: 1px; }

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #344054;
}

.check-item .ck {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #ecfdf3;
    color: #12b76a;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* konto — kafelki info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.info-tile {
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.info-tile .k {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.info-tile .v { font-size: 1rem; font-weight: 600; word-break: break-word; }

@media (max-width: 760px) {
    .settings-tabs .tab span { display: none; }
    .settings-tabs .tab { padding: 0.6rem; }
    .hero-body { flex-wrap: wrap; }
    .field-row { flex-direction: column; gap: 0.55rem; }
    .field-label { flex: none; padding-top: 0; }
    .check-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}

/* ---------- KSeF: firmy i formularze w panelu ---------- */

.alert-ok {
    background: #ecfdf3;
    color: #027a48;
    border: 1px solid #abefc6;
}

.badge-off {
    background: #f2f4f7;
    color: #98a2b3;
}

.section-title {
    margin: 0 0 0.7rem;
    font-size: 1rem;
    font-weight: 600;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.select {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
}

.mono {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.84rem;
}

.company-row {
    flex-wrap: wrap;
}

.row-inactive { opacity: 0.5; }

.company-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    min-width: 0;
}

.company-info .muted { font-size: 0.8rem; }

.token-badges { display: inline-flex; gap: 0.25rem; }
.token-badges .badge { font-size: 0.68rem; padding: 0.1rem 0.45rem; }

.company-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.company-actions .btn-secondary {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-block;
}

.company-actions button[disabled] { opacity: 0.45; cursor: not-allowed; }

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem 1.5rem 1.5rem;
}

.form-card label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.95rem 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #344054;
}

.form-card input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.13s ease, box-shadow 0.13s ease;
}

.form-card input[type="text"]:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.13);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.3rem;
}

.form-hint {
    margin: 1rem 0 0;
    font-size: 0.8rem;
}

.form-subhead {
    margin: 1.4rem 0 0.2rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #344054;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
}

/* ---------- API: klucze i dokumentacja ---------- */

.key-reveal {
    background: #f0f9f4;
    border: 1px solid #abefc6;
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.2rem;
}

.key-reveal-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: #027a48;
    margin-bottom: 0.7rem;
}

.key-value {
    display: block;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.9rem;
    background: #fff;
    border: 1px solid #c4e5cd;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.7rem;
    word-break: break-all;
    color: #1d2939;
}

.doc-label {
    margin: 1.3rem 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #344054;
}

.code-block {
    margin: 0;
    background: #0f1117;
    color: #e6e8ee;
    border-radius: var(--radius-sm);
    padding: 0.9rem 1.05rem;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre;
}

.doc-notes {
    margin: 1.2rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: #475467;
    line-height: 1.7;
}

.doc-notes .mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; background: #f2f4f7; padding: 0 0.3rem; border-radius: 4px; }

/* ---------- API: dokumentacja (developer portal) ---------- */

.api-env-banner {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.1rem;
    background: linear-gradient(120deg, #1b2433, #20304a);
    border-radius: var(--radius);
    margin-bottom: 1.2rem;
    color: #cdd5e3;
}

.api-env-banner .env-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #f79009; box-shadow: 0 0 0 3px rgba(247,144,9,0.2);
    flex-shrink: 0;
}
.api-env-banner.is-prod .env-dot { background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,0.2); }
.api-env-banner .env-label { font-weight: 600; color: #fff; font-size: 0.88rem; }
.api-env-banner .env-url {
    margin-left: auto;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.8rem;
    color: #9fb0c9;
    background: rgba(255,255,255,0.06);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
}

.doc-section { margin-top: 1.6rem; }
.doc-section:first-child { margin-top: 0; }

.doc-h {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.7rem;
    font-size: 1.02rem;
    font-weight: 600;
    color: #1d2939;
}
.doc-h .n {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px;
    background: var(--blue-light); color: var(--blue);
    font-size: 0.78rem; font-weight: 700;
    flex-shrink: 0;
}

.doc-sub {
    margin: 1.2rem 0 0.5rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #475467;
}

/* endpoint pill */
.endpoint {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: #0f1117;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.7rem 0.6rem 0.65rem;
    margin-bottom: 0.4rem;
}
.method {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.28rem 0.6rem;
    border-radius: 6px;
    flex-shrink: 0;
    color: #fff;
}
.method-post { background: #12b76a; }
.method-get  { background: #3563e9; }
.endpoint .path {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.84rem;
    color: #e6e8ee;
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
}

/* code block z przyciskiem kopiuj */
.code-wrap { position: relative; }
.code-wrap .code-copy {
    position: absolute;
    top: 8px; right: 8px;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 6px;
    background: rgba(255,255,255,0.07);
    color: #cdd5e3;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.13s ease, color 0.13s ease;
    z-index: 2;
}
.code-wrap .code-copy:hover { background: rgba(255,255,255,0.14); color: #fff; }
.code-wrap .code-copy.done { background: #12b76a; border-color: #12b76a; color: #fff; }

/* zakładki języków */
.code-tabs {
    display: flex;
    gap: 0.2rem;
    background: #1a1d26;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 5px 5px 0;
}
.code-tab {
    padding: 0.45rem 0.85rem;
    border: 0;
    border-radius: 7px 7px 0 0;
    background: transparent;
    color: #8d93a3;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}
.code-tab:hover { color: #cdd5e3; }
.code-tab.active { background: #0f1117; color: #fff; }
.code-tabs + .code-wrap .code-block,
.code-pane .code-block { border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin: 0; }
.code-pane { display: none; }
.code-pane.active { display: block; }

/* kolory składni */
.code-block .t-key  { color: #7cc4ff; }
.code-block .t-str  { color: #b6e3a0; }
.code-block .t-num  { color: #f0b072; }
.code-block .t-bool { color: #d6a2ff; }
.code-block .t-punc { color: #8d93a3; }
.code-block .t-method { color: #12d18e; font-weight: 700; }
.code-block .t-comment { color: #6a7282; font-style: italic; }

/* tabela parametrów */
.param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.param-table th, .param-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid #f1f3f7;
    vertical-align: top;
}
.param-table th {
    background: #fafbfc;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    font-weight: 600;
}
.param-table tr:last-child td { border-bottom: 0; }
.param-table .p-name { font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; color: #1d2939; font-weight: 600; white-space: nowrap; }
.param-table .p-type { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.req-tag { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; }
.req-tag.req { background: #fef3f2; color: #b42318; }
.req-tag.opt { background: #f2f4f7; color: #667085; }

/* statusy odpowiedzi */
.resp-status {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; font-weight: 600;
    margin: 1rem 0 0.45rem;
}
.resp-status .dotc { width: 8px; height: 8px; border-radius: 50%; }
.resp-status.ok .dotc { background: #12b76a; }
.resp-status.bad .dotc { background: #f04438; }

.status-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.status-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid #f1f3f7; }
.status-table tr:last-child td { border-bottom: 0; }
.status-table .code {
    font-family: ui-monospace, Consolas, monospace; font-weight: 700;
    width: 56px;
}
.status-table .c-4 { color: #b54708; }
.status-table .c-2 { color: #027a48; }
.status-table .c-5 { color: #b42318; }

@media (max-width: 700px) {
    .api-env-banner .env-url { margin-left: 0; width: 100%; }
    .param-table { display: block; overflow-x: auto; }
}

/* ---------- Faktury: tabela ---------- */

.inv-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.87rem;
}

.inv-table th,
.inv-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #f1f3f7;
}

.inv-table th {
    background: #fafbfc;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.inv-table tr:last-child td { border-bottom: 0; }
.inv-table tbody tr:hover { background: #fafbfc; }
.inv-table .num { font-weight: 600; }
.inv-table .amount { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table .ksef-num { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; color: var(--muted); }

.badge-accepted { background: #ecfdf3; color: #027a48; }
.badge-pending  { background: #fffaeb; color: #b54708; }
.badge-error    { background: #fef3f2; color: #b42318; }

@media (max-width: 760px) {
    .inv-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .company-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- mobile ---------- */

@media (max-width: 860px) {
    .app { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 0.6rem;
        padding: 0.55rem 0.9rem;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-logo {
        margin: 0;
        padding: 0.45rem 0.6rem;
        flex-shrink: 0;
        border-radius: 9px;
    }

    .sidebar-logo img { max-width: 86px; }

    .nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.15rem;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar { display: none; }

    .nav a { padding: 0.45rem 0.65rem; white-space: nowrap; }
    .nav a.active::before { display: none; }

    .sidebar-logout {
        margin: 0;
        border: 0;
        padding: 0;
        flex-shrink: 0;
    }

    .sidebar-logout button { padding: 0.45rem 0.6rem; }
    .sidebar-logout button span { display: none; }

    .topbar { padding: 0.6rem 1rem; }
    .search { flex: 1; }
    .topbar-user .user-name { display: none; }
    .content { padding: 1.25rem 1rem 2rem; }
}
