/* ================================================================
   Slomatic — dark theme + sidebar layout
   ================================================================ */

:root, [data-theme="dark"] {
    --bg:           #0b0e14;
    --bg-elev-1:    #14181f;
    --bg-elev-2:    #1a1f29;
    --bg-elev-3:    #232936;
    --border:       #2a3140;
    --text:         #ffffff;
    --text-muted:   #d1d8e1;
    --text-dim:     #a3b0c2;
    --accent:       #4f8cff;
    --accent-soft:  rgba(79, 140, 255, 0.16);
    --accent-2:     #a78bfa;
    --accent-3:     #4ade80;
    --danger:       #f87171;
    --danger-soft:  rgba(248, 113, 113, 0.14);
    --warning:      #fbbf24;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 8px 24px rgba(0,0,0,0.3);
}

[data-theme="light"] {
    --bg:           #f6f7f9;
    --bg-elev-1:    #ffffff;
    --bg-elev-2:    #f1f3f7;
    --bg-elev-3:    #e4e7ed;
    --border:       #c5cad2;
    --text:         #050810;
    --text-muted:   #1a202c;
    --text-dim:     #2d3748;
    --accent:       #1d4ed8;
    --accent-soft:  rgba(29, 78, 216, 0.12);
    --accent-2:     #6d28d9;
    --accent-3:     #15803d;
    --danger:       #b91c1c;
    --danger-soft:  rgba(185, 28, 28, 0.10);
    --warning:      #b45309;
    --shadow:       0 4px 16px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; }

/* ----------------------------------------------------- LOGIN */
.login-page {
    display: flex; min-height: 100vh; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at top, #1a1f29 0%, #0b0e14 70%);
}
.login-card {
    background: var(--bg-elev-1); padding: 40px;
    border: 1px solid var(--border); border-radius: var(--radius);
    width: 100%; max-width: 380px;
    box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-card .subtitle { margin: 0 0 24px; font-size: 13px; color: var(--text-muted); }
.login-card label {
    display: block; margin-bottom: 16px;
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.login-card input {
    display: block; width: 100%; padding: 11px 14px; margin-top: 6px;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
    text-transform: none; letter-spacing: normal; font-family: inherit;
}
.login-card input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card button:not(.pwd-toggle) {
    display: block; width: 100%; padding: 11px; margin-top: 8px;
    background: var(--accent); color: #fff; border: 0;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: background .15s;
}
.login-card button:not(.pwd-toggle):hover { background: #6ba1ff; }
.login-card .error {
    margin-top: 16px; padding: 10px 12px;
    background: var(--danger-soft); border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5; border-radius: var(--radius-sm); font-size: 13px;
}

/* ----------------------------------------------------- APP SHELL */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ----------------------------------------------------- SIDEBAR */
.sidebar {
    background: var(--bg-elev-1); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px 12px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 8px;
    padding: 0 12px 18px; font-weight: 700; font-size: 20px;
    color: var(--text); text-decoration: none;
}
.logo-mark {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: 800;
}
.sidebar-brand .badge {
    margin-left: auto; font-size: 10px; color: var(--text-dim);
    background: var(--bg-elev-3); padding: 2px 6px; border-radius: 4px;
    font-weight: 500;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 16px;
    background: var(--bg-elev-2); border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.sidebar-user .info { min-width: 0; }
.sidebar-user .name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { font-size: 12px; color: var(--text-dim); text-transform: capitalize; }

.sidebar-section {
    font-size: 12px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.8px;
    padding: 8px 12px 6px;
}
.sidebar-menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; color: var(--text-muted);
    text-decoration: none; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 500;
    transition: background .12s, color .12s;
}
.sidebar-menu a:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar-menu a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-menu a.menu-parent { font-weight: 600; }
.sidebar-menu .chevron {
    margin-left: auto; width: 12px; height: 12px;
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
    transition: transform .18s;
}
.sidebar-menu .menu-parent.expanded .chevron { transform: rotate(90deg); }
.sidebar-submenu {
    display: flex; flex-direction: column; gap: 1px;
    margin: 0 0 0 8px; padding-left: 14px;
    border-left: 1px solid var(--border);
    max-height: 0; overflow: hidden;
    transition: max-height .22s ease, margin .22s ease;
}
.sidebar-submenu.expanded {
    max-height: 360px; margin: 2px 0 6px 8px;
}
.sidebar-submenu a {
    padding: 7px 12px; font-size: 14px; color: var(--text-muted);
    font-weight: 500; gap: 8px; text-decoration: none;
    display: flex; align-items: center; border-radius: 6px;
    transition: background .12s, color .12s;
}
.sidebar-submenu a:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar-submenu a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-submenu .dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: currentColor; opacity: 0.6; flex-shrink: 0;
}
.sidebar-submenu a.active .dot { opacity: 1; }
.sidebar-submenu a.partner-switch-link { justify-content: space-between; }
.sidebar-submenu a.partner-switch-link.active { background: rgba(34, 197, 94, .14); color: var(--accent-3); font-weight: 600; }
.sidebar-submenu a.partner-switch-link.active .dot { background: var(--accent-3); opacity: 1; }
.sidebar-submenu a.partner-switch-link .active-dot { font-size: 9px; color: var(--accent-3); margin-left: auto; }
.sidebar-submenu a.partner-switch-link.reset-link { color: var(--text-dim); font-style: italic; }
.sidebar-submenu a.partner-switch-link.reset-link:hover { color: var(--text); }

/* Lista partnerów pod Przegląd — zawsze widoczna (bez toggle) */
.sidebar-partners {
    display: flex; flex-direction: column; gap: 1px;
    margin: 2px 0 6px 8px; padding-left: 14px;
    border-left: 1px solid var(--border);
}
.sidebar-partners a {
    padding: 7px 12px; font-size: 14px; color: var(--text-muted);
    font-weight: 500; gap: 8px; text-decoration: none;
    display: flex; align-items: center; border-radius: 6px;
    transition: background .12s, color .12s;
    justify-content: space-between;
}
.sidebar-partners a:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar-partners .dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: currentColor; opacity: 0.6; flex-shrink: 0;
}
.sidebar-partners a.active {
    background: rgba(34, 197, 94, .14); color: var(--accent-3); font-weight: 600;
}
.sidebar-partners a.active .dot { background: var(--accent-3); opacity: 1; }
.sidebar-partners a .active-dot { font-size: 9px; color: var(--accent-3); margin-left: auto; }
.sidebar-partners a.reset-link { color: var(--text-dim); font-style: italic; }
.sidebar-partners a.reset-link:hover { color: var(--text); }
.sidebar-location {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 3px 12px 3px 20px; font-size: 12px;
    color: var(--text-dim);
}
.sidebar-location .location-indent { opacity: 0.5; flex-shrink: 0; line-height: 1.4; }
.sidebar-location .loc-name { flex: 1; min-width: 0; word-break: break-word; overflow-wrap: anywhere; line-height: 1.4; }
.sidebar-menu svg, .sidebar-footer svg {
    width: 20px; height: 20px; flex-shrink: 0;
    stroke: currentColor; stroke-width: 1.8; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-footer form { margin: 0; }
.sidebar-footer button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; background: transparent; border: 0;
    color: var(--text-muted); font-size: 15px; font-weight: 500;
    cursor: pointer; border-radius: var(--radius-sm);
    text-align: left; font-family: inherit;
}
.sidebar-footer button:hover { background: var(--bg-elev-2); color: var(--text); }

/* ----------------------------------------------------- TOPBAR */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: flex-start;
    gap: 16px; padding: 0 36px; height: 56px;
    background: var(--bg-elev-1); border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(8px);
}
.topbar-spacer { flex: 1; }

/* Active partner badge */
.active-partner-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; background: rgba(34, 197, 94, 0.12);
    border: 1px solid var(--accent-3); border-radius: 20px;
    font-size: 13px; color: var(--accent-3); text-decoration: none;
    font-weight: 500;
}
.active-partner-badge.muted-badge {
    background: var(--bg-elev-2); border-color: var(--border);
    color: var(--text-muted);
}
.active-partner-badge .dot-active {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-3); animation: pulse 2s infinite;
}
.active-partner-badge .reset-active {
    background: transparent; border: 0; color: inherit;
    cursor: pointer; font-size: 16px; line-height: 1;
    padding: 0 2px; opacity: .7;
}
.active-partner-badge .reset-active:hover { opacity: 1; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* Switch tematu (iOS-style) */
.theme-switch {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.theme-switch .ico {
    width: 14px; height: 14px; stroke: var(--text-muted);
    stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.theme-switch input { display: none; }
.theme-switch .track {
    position: relative; width: 36px; height: 20px;
    background: var(--bg-elev-3); border-radius: 12px;
    transition: background .2s;
}
.theme-switch .thumb {
    position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text); transition: transform .2s, background .2s;
}
.theme-switch input:checked + .track { background: var(--accent); }
.theme-switch input:checked + .track .thumb { transform: translateX(16px); background: #fff; }

/* ----------------------------------------------------- MAIN */
.main { padding: 28px 36px; min-width: 0; }
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px; margin-bottom: 24px;
}
.page-header .title { flex: 1; min-width: 0; }
.page-header h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.page-header .subtitle { margin: 0; color: var(--text-muted); font-size: 13px; }
.page-header .actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ----------------------------------------------------- BUTTONS */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 0; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; cursor: pointer;
    text-decoration: none; transition: background .12s, color .12s;
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6ba1ff; }
.btn-secondary { background: var(--bg-elev-3); color: var(--text); }
.btn-secondary:hover { background: #2d3748; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #f87171; }
.btn-link {
    background: transparent; border: 0; color: var(--accent);
    cursor: pointer; padding: 0 4px; font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

/* ----------------------------------------------------- PARTNER CARDS (Przegląd) */
.partner-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}
.partner-card {
    background: var(--bg-elev-1); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    transition: border-color .12s, transform .12s;
    cursor: pointer;
}
.partner-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.partner-card.is-active { border-color: var(--accent-3); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15); }
.partner-card .active-badge {
    background: var(--accent-3); color: #fff; font-size: 11px;
    font-weight: 600; padding: 3px 8px; border-radius: 10px;
    flex-shrink: 0;
}
.partner-card .head {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.partner-card .pic {
    width: 38px; height: 38px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.partner-card .name { font-size: 15px; font-weight: 600; color: var(--text); }
.partner-card .package { font-size: 12px; color: var(--text-muted); }
.partner-card .stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.stat-tile {
    background: var(--bg-elev-2); border-radius: var(--radius-sm);
    padding: 12px 10px; text-align: center;
}
.stat-tile .num {
    font-size: 18px; font-weight: 700; color: var(--accent);
    letter-spacing: -0.5px; line-height: 1.1;
}
.stat-tile.purple .num { color: var(--accent-2); }
.stat-tile.green .num { color: var(--accent-3); }
.stat-tile .label {
    font-size: 11px; color: var(--text-muted);
    margin-top: 3px; text-transform: capitalize;
}

/* ----------------------------------------------------- MODULE TILES (Kampanie/Marketing entry) */
.module-tiles {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.module-tile {
    background: var(--bg-elev-1); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px;
    text-decoration: none; color: var(--text);
    transition: border-color .12s, transform .12s;
    display: block;
}
.module-tile:hover {
    border-color: var(--accent); transform: translateY(-2px);
}
.module-tile .icon-box {
    width: 38px; height: 38px; border-radius: 8px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.module-tile.green .icon-box { color: var(--accent-3); background: rgba(34, 197, 94, .12); }
.module-tile.purple .icon-box { color: var(--accent-2); background: rgba(139, 92, 246, .12); }
.module-tile.amber .icon-box { color: var(--warning); background: rgba(245, 158, 11, .12); }
.module-tile h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.module-tile p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.module-tile svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ----------------------------------------------------- EMPTY STATE */
.empty-state {
    background: var(--bg-elev-1); border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 48px 32px;
    text-align: center; color: var(--text-muted);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.empty-state p { margin: 0 0 16px; font-size: 13px; }

/* ----------------------------------------------------- ADMIN TABS */
.tabs {
    display: flex; gap: 2px; border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    background: transparent; border: 0; padding: 10px 14px; cursor: pointer;
    color: var(--text-muted); font-size: 13px; font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: inherit; transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.panel-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: nowrap; width: 100%; }
.panel-actions p.muted { margin: 0; }
.search-wrapper { position: relative; flex-shrink: 0; margin-left: auto; }
.search-wrapper svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: var(--text-dim); pointer-events: none; }
.search-input { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 7px 12px 7px 32px; font-size: 13px; outline: none; width: 220px; }
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

/* ----------------------------------------------------- TABLES */
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--bg-elev-1); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.data-table th, .data-table td {
    padding: 12px 16px; text-align: left;
    border-bottom: 1px solid var(--border); font-size: 13px;
}
.data-table th {
    background: var(--bg-elev-2); font-weight: 600; color: var(--text-dim);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-elev-2); }
.data-table td.actions { white-space: nowrap; text-align: right; }
.data-table code {
    background: var(--bg-elev-3); color: var(--text-muted);
    padding: 2px 6px; border-radius: 4px; font-size: 11px;
}
.loc-user-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg-elev-2); border-radius: 6px; margin-bottom: 4px; }
.location-users { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.location-user-tag { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--bg-elev-3); color: var(--text-dim); }
.location-row td { background: var(--bg-elev-2); font-size: 13px; border-bottom: 1px solid var(--border); }
.location-row:last-child td { border-bottom: 0; }
.location-name { display: flex; align-items: center; gap: 6px; }
.location-indent { color: var(--text-dim); padding-left: 16px; flex-shrink: 0; }
.location-city { font-size: 11px; color: var(--text-dim); background: var(--bg-elev-3); padding: 1px 6px; border-radius: 4px; }

/* ----------------------------------------------------- FORMS */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form label.inline {
    flex-direction: row; align-items: center; gap: 8px;
    text-transform: none; color: var(--text); font-size: 13px;
    letter-spacing: normal;
}
.pwd-wrap { position:relative; display:flex; align-items:center; }
.pwd-wrap input { flex:1; padding-right:38px !important; width:100%; }
.pwd-toggle { position:absolute; right:10px; background:none; border:none; cursor:pointer; color:var(--text-muted,#7a829e); padding:0; display:flex; align-items:center; line-height:1; }
.pwd-toggle:hover { color:var(--text-primary,#e8eaf0); }
.pwd-toggle svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.form input[type="text"], .form input[type="email"],
.form input[type="password"], .form select, .form textarea {
    padding: 9px 12px; background: var(--bg-elev-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-family: inherit;
    text-transform: none; letter-spacing: normal;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form h4 { margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--text); }
.feature-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 280px; overflow-y: auto; padding: 10px;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.feature-row {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 10px; align-items: center; padding: 4px 6px;
    font-size: 13px; color: var(--text);
    text-transform: none; letter-spacing: normal;
}
.override-row {
    display: grid; grid-template-columns: 1fr auto;
    gap: 16px; align-items: center; padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.override-row:last-child { border-bottom: 0; }
.override-row select { min-width: 200px; }

/* ----------------------------------------------------- MODAL */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: var(--bg-elev-1); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 24px 64px rgba(0,0,0,.5);
    width: 100%; max-width: 560px; max-height: 90vh;
    display: flex; flex-direction: column;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close {
    background: transparent; border: 0; font-size: 20px; line-height: 1;
    cursor: pointer; color: var(--text-muted); padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 14px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}
.token-display {
    background: var(--bg-elev-2); border: 1px solid var(--warning);
    border-radius: var(--radius-sm); padding: 12px; margin: 12px 0;
    word-break: break-all;
}
.token-display code { font-size: 13px; color: var(--warning); background: transparent; padding: 0; }

/* ----------------------------------------------------- TOAST */
#toast-root {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 2000; pointer-events: none;
}
.toast {
    padding: 11px 16px; border-radius: var(--radius-sm);
    background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); font-size: 13px;
    opacity: 0; transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--accent-3); }
.toast-error { border-color: var(--danger); color: #fca5a5; }

/* ----------------------------------------------------- SCROLLBAR */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #2d3748; }

/* ----------------------------------------------------- SLOTS */
.slot-bar { display:flex; align-items:center; gap:12px; padding:10px 16px; background:var(--bg-elev-1); border-radius:var(--radius-sm); margin-bottom:12px; font-size:13px; }
.slot-progress { flex:1; height:6px; background:var(--bg-elev-3); border-radius:3px; overflow:hidden; }
.slot-progress-fill { height:100%; background:var(--accent); border-radius:3px; transition:width .3s; }
.slot-progress-fill.full { background:var(--red,#e53e3e); }
.slot-warning { color:var(--red,#e53e3e); font-weight:600; }
.slot-free { color:var(--green,#48bb78); font-weight:500; }
.slot-panel { margin-bottom:16px; }
.slot-cards { display:flex; gap:12px; }
.slot-card { flex:1; background:var(--bg-elev-1); border:1px solid var(--border); border-radius:10px; padding:14px 18px; display:flex; flex-direction:column; gap:6px; }
.slot-card-label { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); font-weight:600; }
.slot-card-nums { display:flex; align-items:baseline; gap:1px; line-height:1; }
.slot-card-used { font-size:28px; font-weight:700; color:var(--text-primary); }
.slot-card-sep { font-size:15px; color:var(--text-muted); }
.slot-bar { height:6px; background:var(--bg-elev-3,#2a2f45); border-radius:99px; overflow:hidden; margin-top:2px; }
.slot-bar-fill { height:100%; border-radius:99px; background:var(--accent,#5b7cf6); transition:width .3s; }
.slot-bar-fill.warn { background:#f6a93b; }
.slot-bar-fill.danger { background:var(--red,#e53e3e); }
.slot-card-free { font-size:12px; color:var(--green,#48bb78); font-weight:500; }
.slot-card-none { font-size:12px; color:var(--red,#e53e3e); font-weight:600; }
.slot-row { display:grid; grid-template-columns:28px 1fr 160px; align-items:center; gap:10px; padding:7px 14px; font-size:13px; border-bottom:1px solid var(--border); }
.slot-row:last-child { border-bottom:none; }
.slot-num { color:var(--text-muted); font-size:11px; font-weight:600; }
.slot-name { font-weight:500; }
.slot-loc-count { color:var(--text-muted); font-size:12px; }

/* ----------------------------------------------------- HAMBURGER */
.hamburger {
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; width: 36px; height: 36px;
    background: transparent; border: 0; cursor: pointer;
    padding: 4px; border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-elev-2); }
.hamburger span {
    display: block; width: 20px; height: 2px;
    background: var(--text-muted); border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ----------------------------------------------------- RESPONSIVE */
@media (max-width: 768px) {
    /* Layout */
    .app-shell { grid-template-columns: 1fr; }

    /* Hamburger visible */
    .hamburger { display: flex; }

    /* Sidebar — wysuwa się z lewej */
    .sidebar {
        position: fixed; top: 0; left: -260px; bottom: 0;
        width: 240px; z-index: 200;
        transition: left .25s ease;
        overflow-y: auto;
    }
    .sidebar.open { left: 0; }

    /* Topbar */
    .topbar { padding: 0 16px; gap: 10px; }
    .active-partner-badge { font-size: 12px; padding: 5px 10px; max-width: 180px; overflow: hidden; }
    .active-partner-badge strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Main content */
    .main { padding: 16px; }
    .page-header { flex-direction: column; gap: 12px; }
    .page-header .actions { width: 100%; }

    /* Partner grid */
    .partner-grid { grid-template-columns: 1fr; }

    /* Module tiles */
    .module-tiles { grid-template-columns: 1fr; }

    /* Tables — horizontal scroll */
    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .data-table thead, .data-table tbody, .data-table tr { display: table; width: 100%; table-layout: fixed; }
    .data-table { white-space: normal; }
    .data-table td, .data-table th { white-space: nowrap; }

    /* Panel actions */
    .panel-actions { flex-wrap: wrap; }
    .search-input { width: 100%; }
    .search-wrapper { width: 100%; margin-left: 0; }

    /* Tabs — scroll horizontal */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tab { white-space: nowrap; flex-shrink: 0; }

    /* Modal */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-box {
        max-width: 100%; width: 100%; max-height: 92vh;
        border-radius: var(--radius) var(--radius) 0 0;
        margin: 0;
    }

    /* Toast */
    #toast-root { left: 16px; right: 16px; bottom: 16px; }

    /* Slot cards */
    .slot-cards { flex-direction: column; }

    /* Login */
    .login-card { padding: 28px 20px; margin: 16px; }
}

@media (max-width: 480px) {
    .main { padding: 12px; }
    .topbar { padding: 0 12px; }
    .partner-card .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .stat-tile { padding: 10px 6px; }
    .stat-tile .num { font-size: 15px; }
    .page-header h1 { font-size: 18px; }
}
