:root {
    --bg: #0b1220;
    --bg-soft: #111827;
    --panel: #151f32;
    --panel-2: #1b2740;
    --border: rgba(148, 163, 184, 0.18);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --muted-2: #64748b;
    --primary: #3b82f6;
    --primary-2: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 18px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 32%),
        radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.10), transparent 35%),
        var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: #93c5fd;
}

/* =========================
   GŁÓWNY UKŁAD APLIKACJI
   ========================= */

.app-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(10, 16, 30, 0.94);
    border-right: 1px solid var(--border);
    padding: 30px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 8px 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 26px;
}

.logo-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.sidebar-brand strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
}

.sidebar-brand span {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: var(--muted);
}

.sidebar-section {
    margin-bottom: 26px;
}

.sidebar-label {
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 0 14px;
    margin-bottom: 11px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    border-radius: 15px;
    color: #cbd5e1;
    font-size: 16px;
    font-weight: 500;
    transition: 0.15s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(59, 130, 246, 0.14);
    color: #ffffff;
}

.sidebar-footer {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    padding: 16px;
    background: rgba(21, 31, 50, 0.85);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.sidebar-footer span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-footer strong {
    display: block;
    margin-top: 5px;
    font-size: 16px;
}

.main {
    padding: 34px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 30px;
}

.page-title h1 {
    margin: 0;
    font-size: 36px;
    letter-spacing: -0.03em;
}

.page-title p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.user-box {
    min-width: 230px;
    background: rgba(21, 31, 50, 0.84);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 17px;
    box-shadow: var(--shadow);
}

.user-box small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
    font-size: 13px;
}

.user-box strong {
    display: block;
    font-size: 16px;
}

.role-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
    font-size: 13px;
}

/* =========================
   KARTY, PANELE, FOLDERY
   ========================= */

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.quick-card {
    background: linear-gradient(180deg, rgba(27, 39, 64, 0.94), rgba(17, 24, 39, 0.94));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.quick-card span {
    color: var(--muted);
    font-size: 14px;
}

.quick-card strong {
    display: block;
    margin-top: 9px;
    font-size: 28px;
}

.panel {
    background: rgba(21, 31, 50, 0.86);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 24px 26px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.panel-header h2 {
    margin: 0;
    font-size: 24px;
}

.panel-header p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.panel-body {
    padding: 26px;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 18px;
}

.folder-tile {
    min-height: 155px;
    background: linear-gradient(180deg, rgba(27, 39, 64, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    color: var(--text);
    transition: 0.16s ease;
    position: relative;
    overflow: hidden;
}

.folder-tile::after {
    content: "";
    position: absolute;
    right: -35px;
    bottom: -35px;
    width: 105px;
    height: 105px;
    background: rgba(59, 130, 246, 0.12);
    border-radius: 50%;
}

.folder-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(96, 165, 250, 0.55);
    color: white;
}

.folder-tile h3 {
    margin: 0 0 10px;
    font-size: 20px;
}

.folder-tile p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
    font-size: 15px;
}

.folder-symbol {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #bfdbfe;
    font-size: 28px;
}

.folder-tile-with-actions {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.folder-main-link {
    display: block;
    color: var(--text);
}

.folder-main-link:hover {
    color: #ffffff;
}

.folder-actions {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

/* =========================
   PRZYCISKI
   ========================= */

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary-2);
    color: white;
    padding: 11px 16px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
}

.btn:hover,
button:hover {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.18);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 10px;
}

/* =========================
   TABELE
   ========================= */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
    text-align: left;
    padding: 14px 15px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 15px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    font-size: 15px;
}

tr:hover td {
    background: rgba(148, 163, 184, 0.04);
}

/* =========================
   FORMULARZE
   ========================= */

input,
select,
textarea {
    width: 100%;
    max-width: 620px;
    padding: 12px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.86);
    color: var(--text);
    outline: none;
    font-family: inherit;
    font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

.form-row {
    margin-bottom: 18px;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 15px;
}

.message,
.flash {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.22);
    padding: 13px 15px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.empty-state {
    border: 1px dashed rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.55);
    border-radius: 18px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.small,
.muted {
    color: var(--muted);
    font-size: 14px;
}

/* =========================
   STATUSY I ETYKIETY
   ========================= */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-ok {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-off {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.action-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    border: 1px solid rgba(59, 130, 246, 0.24);
    font-size: 13px;
    font-weight: 700;
}

/* =========================
   KOMENTARZE
   ========================= */

.comment-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 10px;
}

.comment-header span {
    color: var(--muted);
    font-size: 13px;
}

.comment-card p {
    margin: 0;
    color: #dbeafe;
    line-height: 1.5;
}

/* =========================
   LOGOWANIE
   ========================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px;
    background:
        radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.18), transparent 34%),
        radial-gradient(circle at 20% 85%, rgba(56, 189, 248, 0.10), transparent 28%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(180deg, rgba(21, 31, 50, 0.96), rgba(12, 18, 33, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 28px;
    padding: 42px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    filter: blur(4px);
    pointer-events: none;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 26px;
    color: #ffffff;
    margin: 0 auto 24px;
    box-shadow: 0 16px 38px rgba(37, 99, 235, 0.38);
    position: relative;
    z-index: 1;
}

.login-card h1 {
    margin: 0 0 10px;
    font-size: 38px;
    line-height: 1.1;
    letter-spacing: -0.04em;
    position: relative;
    z-index: 1;
}

.login-card > .muted {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 28px;
    position: relative;
    z-index: 1;
}

.login-card form {
    text-align: left;
    position: relative;
    z-index: 1;
}

.login-card .form-row {
    margin-bottom: 20px;
}

.login-card label {
    font-size: 15px;
    font-weight: 700;
    color: #dbeafe;
}

.login-card input {
    max-width: none;
    width: 100%;
    height: 52px;
    font-size: 16px;
    padding: 0 16px;
    border-radius: 14px;
    background: rgba(8, 13, 24, 0.74);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #f8fafc;
}

.login-card input::-ms-reveal,
.login-card input::-ms-clear {
    display: none;
}

.login-card input[type="password"]::-webkit-credentials-auto-fill-button,
.login-card input[type="password"]::-webkit-caps-lock-indicator,
.login-card input[type="password"]::-webkit-contacts-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
}

.full-btn {
    width: 100%;
    height: 52px;
    font-size: 16px;
    border-radius: 14px;
    margin-top: 4px;
}

.login-footer {
    margin-top: 32px;
    padding-top: 22px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-footer-title {
    color: #e2e8f0;
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 7px;
}

.login-footer-text {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 11px;
}

.login-footer-copy {
    color: #64748b;
    font-size: 13px;
    line-height: 1.7;
}

/* =========================
   RESPONSYWNOŚĆ
   ========================= */

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .sidebar-footer {
        position: static;
        margin-top: 20px;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .login-page {
        padding: 18px;
    }

    .login-card {
        padding: 30px 24px;
        border-radius: 24px;
    }

    .login-card h1 {
        font-size: 32px;
    }

    .login-card > .muted {
        font-size: 15px;
    }
}

/* Większa czytelność listy dokumentów w folderze */

.table-wrap table {
    font-size: 17px;
}

.table-wrap th {
    font-size: 15px;
}

.table-wrap td {
    font-size: 17px;
}

.table-wrap td a {
    font-size: 17px;
    font-weight: 700;
}
