/* =============================================
   runeo - Dark Mode Cyber-Violet Theme (V2)
   ============================================= */

/* --- CSS Variables --- */
:root {
    /* Sidebar (dark violet glow) */
    --sidebar-bg: linear-gradient(180deg, #0F0F1E 0%, #12102A 50%, #0F0F1E 100%);
    --sidebar-bg-color: #0F0F1E;
    --sidebar-hover: #1E1E3A;
    --sidebar-active: #2A2A50;
    --sidebar-text: #8B8B9A;
    --sidebar-text-active: #FFFFFF;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;

    /* Topbar */
    --topbar-bg: #111120;
    --topbar-border: #2A2A45;
    --topbar-height: 56px;

    /* Content */
    --content-bg: #0B0B15;
    --card-bg: #161625;
    --card-border: #2A2A45;
    --card-shadow: 0 2px 8px rgba(0,0,0,.3);

    /* Colors */
    --primary: #7B61FF;
    --primary-hover: #5A44C8;
    --primary-light: rgba(123,97,255,.12);
    --success: #10b981;
    --success-light: rgba(16,185,129,.12);
    --warning: #f59e0b;
    --warning-light: rgba(245,158,11,.12);
    --danger: #ef4444;
    --danger-light: rgba(239,68,68,.12);
    --info: #7B61FF;
    --info-light: rgba(123,97,255,.12);

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --text-muted: #8B8B9A;

    /* Misc */
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 14px;
    --transition: 0ms;

    /* Misc RGB decompositions for rgba() usage */
    --card-bg-rgb: 22,22,37;
    --hover-bg: rgba(123,97,255,.08);
    --draft-bg: rgba(139,139,154,.12);
    --bg-secondary: #1E1E30;

    /* Font */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text-primary); background: var(--content-bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* --- Scrollbar global (dark violet) --- */
* {
    scrollbar-width: thin;
    scrollbar-color: #3D3D5C #0B0B15;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0B0B15; }
::-webkit-scrollbar-thumb { background: #3D3D5C; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #7B61FF; }

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

.ml-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

.ml-content {
    flex: 1;
    min-width: 0;
    /* P146 iter11 (notatka #1604): overflow: clip zamiast overflow-x: hidden.
       Hidden tworzy scroll container dla osi Y (auto), przez co position:sticky
       wewnątrz .ml-content nie działało w trybie prod. Clip nie tworzy scroll containera. */
    overflow-x: clip;
    padding: 24px;
}

/* --- Sidebar --- */
.ml-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg-color);
    background-image: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition);
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid rgba(123,97,255,.08);
}

/* Sidebar subtle violet glow */
.ml-sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 200px;
    background: radial-gradient(ellipse at top center, rgba(123,97,255,.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.ml-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(123,97,255,.1);
    position: relative;
    z-index: 1;
}

/* === Logo (obrazki) ===
   Pełny logotyp (logo_final.png, 354x64 natywnie, skalowany do wys. 32px)
   oraz favicon (32x32) widoczny w trybie zwiniętym sidebara. */
.ml-sidebar__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}
.ml-sidebar__brand-logo {
    display: block;
    height: 28px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(123,97,255,.35));
}
.ml-sidebar__brand-logo--full { display: block; height: 28px; }
.ml-sidebar__brand-logo--icon { display: none; height: 28px; width: 28px; }

.ml-sidebar__toggle {
    background: none; border: none; color: var(--sidebar-text);
    cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
}
.ml-sidebar__toggle:hover { color: #fff; background: var(--sidebar-hover); }
.ml-sidebar__toggle-icon { display: block; }
.ml-sidebar__toggle-icon--expand { display: none; }
.ml-sidebar--collapsed .ml-sidebar__toggle-icon--collapse { display: none; }
.ml-sidebar--collapsed .ml-sidebar__toggle-icon--expand { display: block; }

/* Sidebar scrollbar styling */
.ml-sidebar,
.ml-sidebar__nav,
.ml-sidebar__group-items {
    scrollbar-width: thin;
    scrollbar-color: rgba(123,97,255,0.15) var(--sidebar-bg-color);
}
.ml-sidebar::-webkit-scrollbar,
.ml-sidebar__nav::-webkit-scrollbar,
.ml-sidebar__group-items::-webkit-scrollbar {
    width: 4px;
}
.ml-sidebar::-webkit-scrollbar-track,
.ml-sidebar__nav::-webkit-scrollbar-track,
.ml-sidebar__group-items::-webkit-scrollbar-track {
    background: var(--sidebar-bg-color);
}
.ml-sidebar::-webkit-scrollbar-thumb,
.ml-sidebar__nav::-webkit-scrollbar-thumb,
.ml-sidebar__group-items::-webkit-scrollbar-thumb {
    background: rgba(123,97,255,0.15);
    border-radius: 2px;
}
.ml-sidebar::-webkit-scrollbar-thumb:hover,
.ml-sidebar__nav::-webkit-scrollbar-thumb:hover,
.ml-sidebar__group-items::-webkit-scrollbar-thumb:hover {
    background: rgba(123,97,255,0.3);
}

.ml-sidebar__nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.ml-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.ml-sidebar__link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.ml-sidebar__link--active {
    background: rgba(123,97,255,.15);
    color: #FFFFFF;
    border-left: 3px solid var(--primary);
}

.ml-sidebar__icon {
    min-width: 20px; width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
}
.ml-sidebar__icon svg { width: 18px; height: 18px; }

.ml-sidebar__footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(123,97,255,.1);
    position: relative;
    z-index: 1;
}

.ml-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 6px;
    padding-right: 6px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.ml-sidebar__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B61FF, #5A44C8);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.ml-sidebar__avatar--img {
    object-fit: cover;
    background: transparent;
}

.ml-sidebar__user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ml-sidebar__user-name {
    color: #E0E0E0;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ml-sidebar__logout {
    color: #8B8B9A;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    flex-shrink: 0;
}
.ml-sidebar__logout:hover { color: #ef4444; background: rgba(239,68,68,.15); }

/* Sidebar separator */
.ml-sidebar__separator {
    height: 1px;
    background: rgba(123,97,255,.1);
    margin: 6px 12px;
}

/* Sidebar collapsible groups */
.ml-sidebar__group {
    margin: 0;
}
.ml-sidebar__group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.ml-sidebar__group-header:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.ml-sidebar__group--active > .ml-sidebar__group-header {
    color: #E0E0E0;
}
.ml-sidebar__group-chevron {
    margin-left: auto;
    display: flex;
    align-items: center;
    transition: transform 200ms ease;
    opacity: .5;
}
.ml-sidebar__group--open > .ml-sidebar__group-header > .ml-sidebar__group-chevron {
    transform: rotate(90deg);
    opacity: .8;
}
.ml-sidebar__group-items {
    display: none;
    padding-left: 0;
}
.ml-sidebar__group--open > .ml-sidebar__group-items {
    display: block;
}
.ml-sidebar__link--child {
    font-size: 12.5px;
    padding: 7px 12px 7px 22px;
}
.ml-sidebar__link--child .ml-sidebar__icon {
    min-width: 20px;
    width: 20px;
}
.ml-sidebar__link--child .ml-sidebar__icon svg {
    width: 15px;
    height: 15px;
}

/* Sidebar collapsed */
.ml-sidebar--collapsed {
    width: var(--sidebar-collapsed);
    /* Pozwól flyoutom wychodzić poza sidebar i rysować się nad contentem */
    overflow: visible;
    z-index: 10000;
}
.ml-sidebar--collapsed .ml-sidebar__nav { overflow: visible; }
.ml-sidebar--collapsed .ml-sidebar__label,
.ml-sidebar--collapsed .ml-sidebar__user-info,
.ml-sidebar--collapsed .ml-sidebar__group-chevron,
.ml-sidebar--collapsed .ml-sidebar__separator { display: none; }
.ml-sidebar--collapsed .ml-sidebar__brand-logo--full { display: none; }
.ml-sidebar--collapsed .ml-sidebar__brand-logo--icon { display: block; }
.ml-sidebar--collapsed .ml-sidebar__group-items { display: none !important; }
.ml-sidebar--collapsed ~ .ml-main { margin-left: var(--sidebar-collapsed); }

/* Collapsed: header pionowo — favicon na górze, hamburger pod nim */
.ml-sidebar--collapsed .ml-sidebar__header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    height: auto;
    gap: 8px;
}
.ml-sidebar--collapsed .ml-sidebar__brand {
    justify-content: center;
    width: 100%;
}
.ml-sidebar--collapsed .ml-sidebar__link,
.ml-sidebar--collapsed .ml-sidebar__group-header {
    justify-content: center;
    padding: 10px 0;
}
.ml-sidebar--collapsed .ml-sidebar__link--active {
    border-left: none;
    border-left: 3px solid var(--primary);
}
/* Aktywna grupa w trybie zwiniętym — podświetl ikonę grupy jak aktywny element */
.ml-sidebar--collapsed .ml-sidebar__group--active > .ml-sidebar__group-header {
    background: rgba(123,97,255,.15);
    color: #FFFFFF;
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
}

/* === Flyout submenu w trybie zwiniętym ===
   Po najechaniu na grupę / item — pokaz panel obok po prawej stronie */
.ml-sidebar--collapsed .ml-sidebar__group,
.ml-sidebar--collapsed .ml-sidebar__nav > .ml-sidebar__link {
    position: relative;
}
.ml-sidebar--collapsed .ml-sidebar__group:hover > .ml-sidebar__group-items {
    display: block !important;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 220px;
    background: var(--sidebar-bg-color, #12102A);
    border: 1px solid rgba(123,97,255,.25);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0,0,0,.5), 0 0 0 1px rgba(123,97,255,.1);
    padding: 6px;
    z-index: 10001;
    /* Brak margin-left — flyout styka się z grupą, żeby kursor nie tracił hover w trakcie przejścia */
    margin-left: 0;
}
/* Most hover: niewidzialny pasek łączący grupę z flyoutem po lewej stronie,
   dzięki któremu kursor nie wypada z :hover przy przechodzeniu między elementami */
.ml-sidebar--collapsed .ml-sidebar__group:hover > .ml-sidebar__group-items::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    width: 10px;
    height: 100%;
    background: transparent;
}
/* Powiększ strefę hover samej grupy w prawo, aby objąć odstęp do flyoutu */
.ml-sidebar--collapsed .ml-sidebar__group::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 10px;
    height: 100%;
    background: transparent;
    pointer-events: auto;
}
.ml-sidebar--collapsed .ml-sidebar__group:hover > .ml-sidebar__group-items .ml-sidebar__label {
    display: inline;
}
/* Tytuł sekcji nad opcjami w flyout (tryb zwinięty) */
.ml-sidebar__group-flyout-title { display: none; }
.ml-sidebar--collapsed .ml-sidebar__group:hover > .ml-sidebar__group-items .ml-sidebar__group-flyout-title {
    display: block;
    padding: 8px 12px 10px;
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
    border-bottom: 1px solid rgba(123,97,255,.25);
    background: linear-gradient(135deg, rgba(123,97,255,.18), rgba(123,97,255,.05));
    border-top-left-radius: calc(var(--radius) - 2px);
    border-top-right-radius: calc(var(--radius) - 2px);
}
.ml-sidebar--collapsed .ml-sidebar__group:hover > .ml-sidebar__group-items .ml-sidebar__link--child {
    justify-content: flex-start;
    padding: 8px 12px;
}
.ml-sidebar--collapsed .ml-sidebar__nav > .ml-sidebar__link:hover::after {
    content: attr(data-label);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 6px;
    background: var(--sidebar-bg-color, #12102A);
    color: #fff;
    border: 1px solid rgba(123,97,255,.25);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 10001;
    pointer-events: none;
}

/* --- Topbar --- */
.ml-topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.ml-topbar__left { display: flex; align-items: center; gap: 12px; }
.ml-topbar__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.ml-topbar__menu-btn {
    display: none;
    background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px;
}

.ml-topbar__right { display: flex; align-items: center; gap: 16px; }

.ml-topbar__search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1E1E30;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 6px 12px;
}
.ml-topbar__search svg { color: var(--text-muted); flex-shrink: 0; }
.ml-topbar__search-input {
    border: none; background: none; outline: none;
    width: 200px; color: var(--text-primary);
}
.ml-topbar__search-input::placeholder { color: var(--text-muted); }
.ml-topbar__search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius); margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    display: none; z-index: 200;
}
.ml-topbar__search-results:not(:empty) { display: block; }

.ml-topbar__avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #7B61FF, #5A44C8); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; border: none; cursor: pointer;
}

.ml-topbar__user-menu { position: relative; }
.ml-topbar__dropdown {
    position: absolute; top: 100%; right: 0;
    width: 200px; background: var(--card-bg);
    border: 1px solid var(--card-border); border-radius: var(--radius);
    margin-top: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
    display: none; z-index: 200;
}
.ml-topbar__dropdown.active { display: block; }
.ml-topbar__dropdown-header { padding: 12px 16px; }
.ml-topbar__dropdown-header strong { display: block; font-size: 13px; color: #fff; }
.ml-topbar__dropdown-header small { color: var(--text-muted); font-size: 12px; }
.ml-topbar__dropdown hr { border: none; border-top: 1px solid var(--card-border); margin: 0; }
.ml-topbar__dropdown-item {
    display: block; padding: 10px 16px; font-size: 13px;
    color: var(--text-secondary); transition: background var(--transition);
}
.ml-topbar__dropdown-item:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.ml-topbar__dropdown-item--danger { color: var(--danger); }
.ml-topbar__dropdown-item--danger:hover { background: var(--danger-light); color: var(--danger); }

/* --- Auth Page --- */
.ml-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--content-bg);
}

.ml-auth-container { width: 100%; max-width: 420px; padding: 20px; }

.ml-auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.ml-auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.ml-auth-logo h1 { font-size: 28px; font-weight: 700; color: #FFFFFF; letter-spacing: -.5px; }
.ml-auth-logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.ml-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--card-border);
}
.ml-auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.ml-auth-tab:hover { color: var(--text-primary); }
.ml-auth-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.ml-auth-form .ml-form-group { margin-bottom: 16px; }

/* --- Form elements --- */
.ml-form-group { margin-bottom: 16px; }
.ml-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.ml-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #3D3D5C;
    border-radius: var(--radius);
    background: #1E1E30;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    height: 34px;
}
.ml-input:hover { border-color: #5A5A7A; }
.ml-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(123,97,255,.2); }
.ml-input::placeholder { color: var(--text-muted); }

textarea.ml-input { resize: vertical; min-height: 80px; height: auto; }

/* Date inputs: wrapper-based approach — hide native segments completely for empty inputs */
/* Custom date picker popup */
.ml-dp-popup {
    position: fixed; z-index: 10002;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--card-border, #3a3a5c);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    width: 280px;
    padding: 12px;
    user-select: none;
}
.ml-dp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.ml-dp-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}
.ml-dp-nav {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: var(--text-muted, #888);
    padding: 4px 8px; border-radius: 6px;
    transition: background 0.15s;
}
.ml-dp-nav:hover { background: var(--hover-bg, rgba(255,255,255,0.08)); }
.ml-dp-daynames {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    margin-bottom: 4px;
}
.ml-dp-daynames span {
    text-align: center; font-size: 11px; font-weight: 600;
    color: var(--text-muted, #888); padding: 4px 0;
}
.ml-dp-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.ml-dp-blank { aspect-ratio: 1; }
.ml-dp-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    font-size: 13px; color: var(--text-primary, #e0e0e0);
    border-radius: 8px; transition: background 0.15s;
}
.ml-dp-day:hover { background: var(--hover-bg, rgba(255,255,255,0.1)); }
.ml-dp-day.ml-dp-today {
    font-weight: 700;
    border: 1px solid var(--primary, #7c3aed);
}
.ml-dp-day.ml-dp-selected {
    background: var(--primary, #7c3aed) !important;
    color: #fff !important;
}
.ml-dp-clear {
    display: flex; justify-content: center; margin-top: 8px;
    border-top: 1px solid var(--card-border, #3a3a5c);
    padding-top: 8px;
}
.ml-dp-clear button {
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: var(--text-muted, #888);
    padding: 4px 12px; border-radius: 6px;
}
.ml-dp-clear button:hover { color: var(--danger, #dc2626); background: var(--hover-bg, rgba(255,255,255,0.05)); }
.ml-dp-title--clickable {
    cursor: pointer; padding: 2px 6px; border-radius: 6px;
    transition: background 0.15s;
}
.ml-dp-title--clickable:hover { background: var(--hover-bg, rgba(255,255,255,0.1)); }
.ml-dp-month-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    padding: 8px 0;
}
.ml-dp-month-btn {
    background: none; border: none; cursor: pointer;
    font-size: 13px; color: var(--text-primary, #e0e0e0);
    border-radius: 8px; padding: 10px 4px;
    transition: background 0.15s;
}
.ml-dp-month-btn:hover { background: var(--hover-bg, rgba(255,255,255,0.1)); }
.ml-dp-month-btn.ml-dp-today { font-weight: 700; border: 1px solid var(--primary, #7c3aed); }
.ml-dp-month-btn.ml-dp-selected { background: var(--primary, #7c3aed) !important; color: #fff !important; }
.ml-dp-month-btn.ml-dp-outside { color: var(--text-muted, #666); opacity: 0.5; }
.ml-dp-today-btn {
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: var(--primary, #7c3aed);
    padding: 4px 12px; border-radius: 6px; font-weight: 600;
}
.ml-dp-today-btn:hover { background: var(--hover-bg, rgba(255,255,255,0.05)); }
/* Weekend highlighting in datepicker */
.ml-dp-daynames span:nth-child(6),
.ml-dp-daynames span:nth-child(7) { color: var(--text-muted, #888); }
.ml-dp-daynames span:nth-child(7) { color: #ef4444; }
.ml-dp-day.ml-dp-weekend { background: rgba(255,255,255,0.04); }
.ml-dp-day.ml-dp-sunday { color: #ef4444; }
.ml-dp-day.ml-dp-sunday:hover { color: #ef4444; }
.ml-dp-day.ml-dp-sunday.ml-dp-selected { color: #fff !important; }

/* --- Buttons --- */
.ml-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #3D3D5C;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    height: 34px;
    line-height: 1;
}
/* Icon alignment inside buttons — ensures proper vertical centering */
.ml-btn > i,
.ml-btn > svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.ml-btn--primary {
    background: linear-gradient(135deg, #7B61FF, #5A44C8);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(123,97,255,.3);
}
.ml-btn--primary:hover {
    background: linear-gradient(135deg, #8B71FF, #6A54D8);
    box-shadow: 0 4px 12px rgba(123,97,255,.4);
    color: #fff;
}
.ml-btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: #3D3D5C;
}
.ml-btn--outline:hover {
    background: var(--sidebar-hover);
    border-color: #5A5A7A;
    color: var(--text-primary);
}
.ml-btn--danger { background: var(--danger); color: #fff; border-color: transparent; }
.ml-btn--danger:hover { background: #dc2626; border-color: transparent; }
.ml-btn--ghost { background: none; border: 1px solid #3D3D5C; color: var(--text-muted); padding: 6px 8px; }
.ml-btn--ghost:hover { color: var(--text-primary); background: var(--sidebar-hover); border-color: #5A5A7A; }
/* Icon-only buttons (X, gear, etc.) — no border */
.ml-btn--icon { border: none; padding: 6px; min-width: auto; background: transparent; }
.ml-btn--icon:hover { border: none; background: transparent; }
/* Circle icon button (e.g. unlink X) — colored border, round */
.ml-btn--icon-circle { border: 1px solid currentColor !important; border-radius: 50%; width: 20px; height: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.ml-btn--icon-circle:hover { opacity: 0.8; }
.ml-btn--full { width: 100%; justify-content: center; }
.ml-btn--sm { padding: 4px 10px; font-size: 12px; height: 34px; }

/* --- Cards --- */
.ml-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
}
.ml-card__title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.ml-card--welcome {
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(123,97,255,.05) 100%);
}
.ml-card--welcome p { color: var(--text-secondary); margin-bottom: 20px; }

/* --- KPI Grid --- */
.ml-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.ml-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 150ms ease, box-shadow 150ms ease;
}
.ml-kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.ml-kpi-card__icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ml-kpi-card__icon svg { width: 24px; height: 24px; }
.ml-kpi-card__icon--blue { background: rgba(123,97,255,.15); color: var(--primary); }
.ml-kpi-card__icon--green { background: rgba(16,185,129,.15); color: var(--success); }
.ml-kpi-card__icon--purple { background: rgba(123,97,255,.15); color: var(--primary); }
.ml-kpi-card__icon--amber { background: rgba(245,158,11,.15); color: var(--warning); }
.ml-kpi-card__value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: #FFFFFF;
}
.ml-kpi-card__label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* --- Quick Actions --- */
.ml-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Steps --- */
.ml-steps { display: flex; flex-direction: column; gap: 12px; }
.ml-step { display: flex; align-items: center; gap: 12px; }
.ml-step__num {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, #7B61FF, #5A44C8); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.ml-step__text { font-size: 14px; color: var(--text-secondary); }

/* --- Flash messages --- */
/* Toast container - fixed top-right */
.ml-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}
.ml-toast {
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    animation: toastSlideIn .3s ease-out;
    transition: opacity .3s, transform .3s;
    pointer-events: auto;
}
.ml-toast__msg { flex: 1; }
.ml-toast--success { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.3); backdrop-filter: blur(12px); }
.ml-toast--error { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); backdrop-filter: blur(12px); }
.ml-toast--warning { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); backdrop-filter: blur(12px); }
.ml-toast--info { background: rgba(123,97,255,.15); color: #a78bfa; border: 1px solid rgba(123,97,255,.3); backdrop-filter: blur(12px); }
.ml-toast__close { background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; opacity: .6; padding: 0; line-height: 1; }
.ml-toast__close:hover { opacity: 1; }
@keyframes toastSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
/* Legacy flash - keep for backward compat */
.ml-flash { display: none; }

/* --- Empty state --- */
.ml-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.ml-empty h2 { font-size: 20px; color: var(--text-primary); margin-bottom: 8px; text-transform: uppercase; }
.ml-empty p { margin-bottom: 20px; }

/* --- Tables --- */
.ml-table-wrap { overflow-x: auto; max-width: 100%; }
.ml-table-scroll { overflow-x: auto; max-width: 100%; }
.ml-table-scroll th, .ml-table-scroll td { white-space: nowrap; }
.ml-table {
    width: 100%;
    border-collapse: collapse;
}
.ml-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--card-border);
}
.ml-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
    color: var(--text-secondary);
}
.ml-table tr:hover td { background: rgba(123,97,255,.04); }
.ml-table tr:last-child td { border-bottom: none; }
/* Checkbox cells: prevent text-overflow dots */
.ml-checkbox-cell, .ml-col-checkbox-header { text-overflow: clip !important; overflow: visible !important; }

/* --- Badges --- */
.ml-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.ml-badge--blue { background: rgba(123,97,255,.15); color: #a78bfa; }
.ml-badge--green { background: rgba(16,185,129,.15); color: #34d399; }
.ml-badge--amber { background: rgba(245,158,11,.15); color: #fbbf24; }
.ml-badge--red { background: rgba(239,68,68,.15); color: #f87171; }
.ml-badge--gray { background: rgba(139,139,154,.15); color: var(--text-muted); }
.ml-badge--purple { background: rgba(123,97,255,.15); color: #a78bfa; }
.ml-badge--teal { background: rgba(20,184,166,.15); color: #2dd4bf; }
.ml-badge--cyan { background: rgba(6,182,212,.15); color: #22d3ee; }

/* --- Tag pills (clickable tag selector) --- */
.ml-tag-pill {
    display: inline-block;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    border: 2px solid var(--tag-color, #8B8B9A);
    color: var(--tag-color, #8B8B9A);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1.4;
}
.ml-tag-pill:hover {
    background: color-mix(in srgb, var(--tag-color, #8B8B9A) 15%, transparent);
}
.ml-tag-pill--active {
    background: var(--tag-color, #8B8B9A);
    color: #fff;
}
.ml-tag-pill--active:hover {
    opacity: 0.9;
}

/* --- Pagination --- */
.ml-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}
.ml-pagination a, .ml-pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid #3D3D5C;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ml-pagination a:hover { background: var(--sidebar-hover); color: var(--text-primary); border-color: #5A5A7A; }
.ml-pagination .active {
    background: linear-gradient(135deg, #7B61FF, #5A44C8);
    color: #fff;
    border-color: transparent;
}

/* --- Modal --- */
.ml-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition);
    backdrop-filter: blur(4px);
}
.ml-modal-overlay.active { opacity: 1; pointer-events: auto; }
.ml-modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 90%; max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.ml-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
}
.ml-modal__title { font-size: 16px; font-weight: 600; color: #fff; text-transform: uppercase; }
.ml-modal__close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 20px; }
.ml-modal__close:hover { color: var(--text-primary); }
.ml-modal__body { padding: 20px; }
.ml-modal__footer { padding: 16px 20px; border-top: 1px solid var(--card-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============================================================
   RESPONSIVE — projekt 156 (Wersja mobilna)
   Breakpointy: 1100 / 900 / 700 / 500 / 390 / 320
   Layout w bazie (Modern + Standard wspolnie). Kolory bez zmian.
   ============================================================ */

/* === >=1101 — desktop pelnowymiarowy (default, brak override) === */

/* === <=1100 — male desktopy / duze tablety poziomo === */
@media (max-width: 1100px) {
    :root { --sidebar-width: 210px; }
    .ml-content { padding: 20px; }
    .ml-kpi-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .ml-topbar__search { max-width: 220px; }
    .ml-topbar__search input { width: 100%; }
}

/* === <=900 — tablety pionowo === */
@media (max-width: 900px) {
    :root { --sidebar-width: 72px; }
    .ml-sidebar { width: 72px; }
    .ml-sidebar .ml-sidebar__label,
    .ml-sidebar .ml-sidebar__user-info,
    .ml-sidebar .ml-sidebar__group-chevron { display: none; }
    .ml-main { margin-left: 72px; }
    .ml-content { padding: 18px; }
    .ml-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ml-topbar { padding: 0 16px; }
    .ml-topbar__title { font-size: 14px; }
    .ml-topbar__search { display: none; }
    .ml-topbar__right { gap: 10px; }
    /* Tabele — scroll horyzontalny */
    .ml-table-wrap, .ml-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ml-table { min-width: 640px; }
}

/* === <=700 — phablety / male tablety: pelne mobile === */
@media (max-width: 700px) {
    :root { --sidebar-width: 0px; }
    /* Sidebar off-canvas (hamburger) */
    .ml-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 260px !important;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform var(--transition);
        box-shadow: 4px 0 24px rgba(0,0,0,.4);
    }
    .ml-sidebar .ml-sidebar__label,
    .ml-sidebar .ml-sidebar__user-info,
    .ml-sidebar .ml-sidebar__group-chevron { display: block; }
    .ml-sidebar.mobile-open { transform: translateX(0); }
    .ml-main { margin-left: 0 !important; }
    .ml-topbar__menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .ml-topbar { padding: 0 12px; height: 56px; }
    :root { --topbar-height: 56px; }
    .ml-topbar__title { font-size: 13px; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ml-topbar__right { gap: 6px; }
    .ml-topbar__mail-btn,
    .ml-topbar__chat-btn,
    .ml-topbar__tickets-btn,
    .ml-topbar__notif-btn { padding: 8px !important; min-width: 40px; min-height: 40px; }
    .ml-topbar__lang span:nth-child(2),
    .ml-topbar__theme span:nth-child(2) { display: none; }

    .ml-content { padding: 14px; }
    .ml-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }

    /* Karty / sekcje pelna szerokosc */
    .ml-card, .ml-panel { width: 100%; max-width: 100%; box-sizing: border-box; }

    /* Tabele — wymuszony scroll horyzontalny */
    .ml-table-wrap, .ml-table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -14px;
        margin-right: -14px;
        padding-left: 14px;
        padding-right: 14px;
    }
    .ml-table { min-width: 600px; font-size: 12px; }
    .ml-table th, .ml-table td { padding: 8px 10px; }

    /* Modale pelnoekranowe */
    .ml-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }
    .ml-modal__body { flex: 1; overflow-y: auto; }

    /* Formularze — pelna szerokosc + duze pola dotykowe */
    .ml-input, .ml-select, select, select.ml-input, textarea {
        width: 100%;
        min-height: 44px;
        font-size: 16px; /* zapobiega zoomowi w iOS */
    }
    .ml-btn, button.ml-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
    .ml-form-grid, .ml-grid-2, .ml-grid-3, .ml-grid-4 { grid-template-columns: 1fr !important; gap: 12px; }

    /* Backdrop dla otwartego sidebara */
    .ml-sidebar.mobile-open::after {
        content: "";
        position: fixed;
        top: 0; left: 260px; right: 0; bottom: 0;
        background: rgba(0,0,0,.5);
        z-index: -1;
    }
}

/* === <=500 — telefony srednie === */
@media (max-width: 500px) {
    .ml-kpi-grid { grid-template-columns: 1fr !important; }
    .ml-content { padding: 12px; }
    .ml-topbar { padding: 0 10px; }
    .ml-topbar__title { font-size: 12px; max-width: 40vw; }
    .ml-topbar__right { gap: 4px; }
    /* Ukryj mniej krytyczne ikony, zostaw bell + avatar */
    .ml-topbar__chat-btn,
    .ml-topbar__tickets-btn { display: none !important; }
    .ml-topbar__lang,
    .ml-topbar__theme { display: none; }
    .ml-table { min-width: 480px; font-size: 11px; }
    .ml-table th, .ml-table td { padding: 6px 8px; }
    .ml-modal__header, .ml-modal__body, .ml-modal__footer { padding: 14px; }

    /* === Tabele jako karty (universal, oparty o data-label dodawany przez JS) === */
    .ml-table.ml-table--mobile-cards {
        min-width: 0;
        width: 100%;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .ml-table.ml-table--mobile-cards thead { display: none; }
    .ml-table.ml-table--mobile-cards tbody,
    .ml-table.ml-table--mobile-cards tr,
    .ml-table.ml-table--mobile-cards td { display: block; width: 100%; }
    .ml-table.ml-table--mobile-cards tr {
        background: var(--card-bg, #1E1E30);
        border: 1px solid var(--card-border, #2A2A40);
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 10px 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    }
    .ml-table.ml-table--mobile-cards td {
        border: 0;
        padding: 6px 0;
        text-align: left !important;
        white-space: normal !important;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        font-size: 12px;
        min-height: 24px;
    }
    .ml-table.ml-table--mobile-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted, #8B8B9A);
        flex: 0 0 40%;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    .ml-table.ml-table--mobile-cards td:empty,
    .ml-table.ml-table--mobile-cards td[data-label=""] { display: none; }
    .ml-table.ml-table--mobile-cards td:last-child { border-bottom: 0; }
}

/* === <=390 — iPhone 12/13/14 standard === */
@media (max-width: 390px) {
    .ml-content { padding: 10px; }
    .ml-topbar__mail-btn { display: none !important; }
    .ml-topbar__title { display: none; }
    .ml-table { font-size: 11px; }
    .ml-card, .ml-panel { padding: 12px !important; }
}

/* === <=320 — iPhone SE / male telefony === */
@media (max-width: 320px) {
    :root { --topbar-height: 52px; }
    .ml-content { padding: 8px; }
    .ml-topbar { padding: 0 6px; }
    .ml-topbar__right { gap: 2px; }
    .ml-btn { padding: 8px 10px; font-size: 12px; }
    .ml-table { min-width: 360px; }
}

/* Klasa pomocnicza — zablokuj scroll body gdy mobile sidebar otwarty */
body.ml-mobile-nav-open { overflow: hidden; }

/* ============================================================
   ITERACJA 3 — Dashboard / Settings / Filtry mobile
   ============================================================ */

/* Zakładki przewijalne poziomo na mobile (settings, products, orders modale) */
@media (max-width: 700px) {
    .ml-tabs, .ml-tabs--underline {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        scrollbar-width: none;
        margin-left: -14px;
        margin-right: -14px;
        padding-left: 14px;
        padding-right: 14px;
    }
    .ml-tabs::-webkit-scrollbar,
    .ml-tabs--underline::-webkit-scrollbar { display: none; }
    .ml-tabs a, .ml-tabs--underline a,
    .ml-tabs button, .ml-tabs--underline button {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Dashboard — KPI cards kompresja + ml-page-header stack */
@media (max-width: 700px) {
    .ml-kpi-card { padding: 12px !important; gap: 10px; }
    .ml-kpi-card__icon { width: 40px; height: 40px; flex: 0 0 40px; }
    .ml-kpi-card__icon svg { width: 20px; height: 20px; }
    .ml-kpi-card__value { font-size: 18px !important; }
    .ml-kpi-card__label { font-size: 11px !important; }
    .ml-kpi-card__sub { font-size: 10px !important; }

    .ml-page-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .ml-page-header__left,
    .ml-page-header__right {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }
    .ml-page-header__right { justify-content: flex-start; }
    .ml-page-header__right .ml-btn { flex: 1 1 auto; min-width: 0; }
}

/* Filter bar — collapse na mobile */
.ml-filter-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card-bg, #1E1E30);
    border: 1px solid var(--card-border, #2A2A40);
    border-radius: 10px;
    color: var(--text-primary, #E5E5F0);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
}
.ml-filter-toggle::after {
    content: "▾";
    font-size: 14px;
    transition: transform var(--transition);
}
.ml-filter-toggle.is-open::after { transform: rotate(180deg); }

@media (max-width: 700px) {
    .ml-filter-toggle { display: flex; }
    .ml-filter-bar {
        display: none;
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
        padding: 12px;
    }
    .ml-filter-bar.is-open { display: flex; }
    .ml-filter-bar > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
    }
    .ml-filter-bar input,
    .ml-filter-bar select,
    .ml-filter-bar .ml-input,
    .ml-filter-bar .ml-select { width: 100% !important; }
}

/* Settings — sekcje formularzy stack */
@media (max-width: 700px) {
    .ml-settings-grid,
    .ml-settings-row { grid-template-columns: 1fr !important; gap: 12px; }
    .ml-form-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .ml-form-row > label { width: 100% !important; }
}

/* Inbox back button (mobile) — domyślnie ukryty, pokazany <=700px */
.ml-inbox-back-btn {
    display: none;
    background: var(--card-bg, #1E1E30);
    color: var(--text-primary, #E5E5F0);
    border: 1px solid var(--card-border, #2A2A40);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    margin-right: 10px;
    align-items: center;
    justify-content: center;
}
@media (max-width: 700px) {
    .ml-inbox-back-btn { display: inline-flex; }
}

/* Styled selects */
.ml-input[type="date"],
.ml-input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

/* Universal select styling - all selects get dark appearance */
select,
select.ml-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #1E1E30;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B8B9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    padding: 6px 38px 6px 12px;
    cursor: pointer;
    border: 1px solid #3D3D5C;
    border-radius: var(--radius);
    height: 34px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.4;
    transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}
select:hover,
select.ml-input:hover {
    border-color: #5A5A7A;
    background-color: #252540;
}
select:focus,
select.ml-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123,97,255,.2);
    outline: none;
    background-color: #1E1E30;
}
select option {
    background: #1E1E30;
    color: var(--text-secondary);
}

/* Dark-themed selects (inside sidebar or dark containers) */
.ml-sidebar select,
[data-theme="dark"] select {
    background-color: var(--sidebar-hover);
    border-color: rgba(123,97,255,.15);
    color: #E0E0E0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B8B9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.ml-sidebar select:hover,
[data-theme="dark"] select:hover {
    border-color: rgba(123,97,255,.3);
    background-color: var(--sidebar-active);
}
.ml-sidebar select:focus,
[data-theme="dark"] select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123,97,255,.25);
    background-color: var(--sidebar-active);
}

/* Filter select inline (smaller, for toolbars/filters) */
.ml-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #1E1E30;
    border: 1px solid #3D3D5C;
    border-radius: var(--radius);
    padding: 7px 34px 7px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B8B9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
    transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
    font-family: var(--font);
    line-height: 1.4;
    height: 34px;
}
.ml-filter-select:hover {
    border-color: #5A5A7A;
    background-color: #252540;
}
.ml-filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123,97,255,.2);
    background-color: #1E1E30;
}

/* Select wrapper for custom icon overlay */
.ml-select-wrapper {
    position: relative;
    display: inline-block;
}
.ml-select-wrapper select {
    padding-right: 38px;
}
.ml-select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B8B9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}

/* Sortable table headers */
.ml-table th a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ml-table th a:hover { color: var(--primary); }
.ml-table th .sort-icon { font-size: 10px; opacity: .5; }
.ml-table th .sort-icon--active { opacity: 1; color: var(--primary); }

/* Company tabs */
.ml-tabs--underline {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--card-border);
    margin-bottom: 16px;
}
.ml-tabs--underline a {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}
.ml-tabs--underline a:hover { color: var(--text-primary); }
.ml-tabs--underline a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Search results area spacing */
.ml-topbar__search-results {
    padding: 6px 0;
}
.ml-topbar__search-results a,
.ml-topbar__search-results .ml-search-item {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition);
}
.ml-topbar__search-results a:hover,
.ml-topbar__search-results .ml-search-item:hover {
    background: var(--sidebar-hover);
}

/* NIP row alignment */
.ml-nip-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
}
.ml-nip-row .ml-form-group {
    margin-bottom: 0;
}
.ml-nip-row .ml-btn {
    height: 34px;
    white-space: nowrap;
}

/* --- Tabs (generic, reusable) --- */
.ml-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--card-border);
    margin-bottom: 16px;
}
.ml-tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: all var(--transition);
}
.ml-tab:hover { color: var(--text-primary); }
.ml-tab--active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal Guard - dialog potwierdzenia zamkniecia */
.ml-modal-guard-confirm {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.7);
    z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    animation: mgFadeIn .15s ease;
    backdrop-filter: blur(4px);
}
@keyframes mgFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ml-modal-guard-confirm__box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 24px;
    max-width: 400px;
    width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: mgSlideUp .15s ease;
}
@keyframes mgSlideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ml-modal-guard-confirm__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    text-transform: uppercase;
}
.ml-modal-guard-confirm__msg {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ml-modal-guard-confirm__btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.ml-modal-guard-confirm__btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s ease, transform .1s ease;
}
.ml-modal-guard-confirm__btn:active { transform: scale(.97); }
.ml-modal-guard-confirm__btn--no {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}
.ml-modal-guard-confirm__btn--no:hover { background: var(--sidebar-active); }
.ml-modal-guard-confirm__btn--yes {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.ml-modal-guard-confirm__btn--yes:hover { background: #dc2626; }

/* Number input spinner arrows — hidden by default, visible on hover/focus */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    opacity: 0;
}
input[type="number"]:hover::-webkit-inner-spin-button,
input[type="number"]:hover::-webkit-outer-spin-button,
input[type="number"]:focus::-webkit-inner-spin-button,
input[type="number"]:focus::-webkit-outer-spin-button {
    -webkit-appearance: inner-spin-button;
    opacity: 1;
    background: var(--card-bg, #161625);
    color: var(--text-primary, #fff);
}
/* ── Automation trigger/condition/action pills (Modern dark theme) ── */
.auto-pill-trigger { background: rgba(99,135,255,.15); color: #93b4ff; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.auto-pill-condition { background: rgba(251,191,36,.12); color: #fbbf24; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.auto-pill-action { background: rgba(74,222,128,.12); color: #4ade80; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.auto-pill-action-expand { background: rgba(74,222,128,.06); border: 1px solid rgba(74,222,128,.15); border-top: none; padding: 6px 10px; border-radius: 0 0 6px 6px; font-size: 11px; color: #86efac; }

/* Automation edit form cards (Modern dark theme) */
.auto-card-trigger { background: rgba(99,135,255,.08); border: 1px solid rgba(99,135,255,.2); }
.auto-card-trigger h4 { color: #93b4ff; }
.auto-card-condition { background: rgba(251,191,36,.06); border: 1px solid rgba(251,191,36,.18); }
.auto-card-condition h4 { color: #fbbf24; }
.auto-card-action { background: rgba(74,222,128,.06); border: 1px solid rgba(74,222,128,.18); }
.auto-card-action h4 { color: #4ade80; }

/* Paused automation card — dim content but keep buttons active */
.auto-item--paused > div:last-child, .ret-auto-item--paused > div:last-child { opacity: .5; }
.auto-item--paused .auto-pill-trigger, .auto-item--paused .auto-pill-condition, .auto-item--paused .auto-pill-action,
.ret-auto-item--paused .auto-pill-trigger, .ret-auto-item--paused .auto-pill-condition, .ret-auto-item--paused .auto-pill-action { opacity: .5; }

/* Groups modal input styling for Modern */
#groups-modal input[type="text"], #ret-groups-modal input[type="text"] { background: var(--card-bg, #161625); color: var(--text-primary, #fff); border-color: var(--card-border); }
#groups-modal .auto-group-edit-input, #ret-groups-modal .ret-auto-group-edit-input { background: var(--card-bg, #161625); color: var(--text-primary, #fff); }

/* Condition group styling for Modern */
.cond-group { border-color: rgba(251,191,36,.25); background: rgba(251,191,36,.04); }
.cond-group__title { color: #fbbf24; }
.cond-group__logic { border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.08); color: #fbbf24; }
.cond-group-divider__line { background: rgba(251,191,36,.25); }
.cond-group-divider__label { color: #fbbf24; background: rgba(251,191,36,.12); }
.cond-group-divider__label:hover { background: rgba(251,191,36,.2); }

/* Automation popup items hover for Modern */
.auto-popup-item:hover { border-color: var(--primary); background: rgba(123,97,255,.1); }
.auto-popup-item .coming-soon-badge { background: rgba(251,191,36,.15); color: #fbbf24; }

input[type="number"] {
    -moz-appearance: textfield;
}
input[type="number"]:hover,
input[type="number"]:focus {
    -moz-appearance: auto;
}

/* Spinner keyframes & classes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ml-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color, #374151);
    border-top-color: var(--primary, #7c3aed);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.ml-spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--text-muted, #6b7280);
    border-top-color: var(--primary, #7c3aed);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* --- Custom cell tooltip (replaces native title) --- */
.ml-cell-tooltip {
    position: fixed;
    z-index: 99999;
    max-width: 360px;
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1.45;
    font-family: var(--font);
    color: #E0E0E0;
    background: #1E1E30;
    border: 1px solid #3D3D5C;
    border-radius: var(--radius-sm, 4px);
    box-shadow: 0 4px 16px rgba(0,0,0,.45);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    word-break: break-word;
    white-space: normal;
}
.ml-cell-tooltip.visible {
    opacity: 1;
}

/* ── Split/Merge modal items ── */
.ml-split-hint {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--card-border);
}
.ml-split-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.ml-split-empty.ml-split-error {
    color: var(--danger, #ef4444);
}
.ml-split-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--card-border);
    transition: background .15s;
}
.ml-split-item:hover {
    background: var(--hover-bg, rgba(255,255,255,.03));
}
.ml-split-item:last-child {
    border-bottom: none;
}
.ml-split-item-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.ml-split-item-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.ml-split-item-info {
    flex: 1;
    min-width: 0;
}
.ml-split-item-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ml-split-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.ml-split-item-qty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.ml-split-qty-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}
.ml-split-qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--card-border);
    border-radius: var(--radius, 6px);
    overflow: hidden;
}
.ml-split-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.ml-split-qty-btn:hover {
    background: var(--primary);
    color: #fff;
}
.ml-split-qty-input {
    width: 44px;
    height: 28px;
    border: none;
    border-left: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    background: var(--content-bg);
    color: var(--text-primary);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    -moz-appearance: textfield;
}
.ml-split-qty-input::-webkit-outer-spin-button,
.ml-split-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ml-split-item-price {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 80px;
    text-align: right;
}

/* ── Merge modal order list items ── */
.ml-merge-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: background .15s;
}
.ml-merge-item:hover {
    background: var(--hover-bg, rgba(255,255,255,.03));
}
.ml-merge-item:last-child {
    border-bottom: none;
}
.ml-merge-item-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.ml-merge-item-number {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.ml-merge-item-company {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ml-merge-item-price {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* ── Disabled button state ── */
.ml-btn--disabled,
.ml-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.ml-merge-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================
   Custom Select (Projekt #151) — Modern (dark) baseline
   Override jasnego motywu w app-theme-standard.css
   ============================================================ */
.nm-cs { position: relative; display: inline-block; vertical-align: top; font-family: var(--font); }
.nm-cs-native {
    position: absolute !important;
    opacity: 0 !important;
    width: 100% !important;
    height: 100% !important;
    left: 0; top: 0;
    pointer-events: none;
    z-index: -1;
}
.nm-cs__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius, 8px);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.nm-cs__btn:hover { border-color: var(--primary); }
.nm-cs--open .nm-cs__btn {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.nm-cs--disabled .nm-cs__btn { opacity: .55; cursor: not-allowed; }
.nm-cs__label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nm-cs__caret {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary, var(--text-primary));
    transition: transform 200ms ease;
}
.nm-cs--open .nm-cs__caret { transform: rotate(180deg); }

.nm-cs__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    min-width: 100%;
    margin-top: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius, 8px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    transform-origin: top center;
    animation: nm-cs-in 140ms ease-out;
}
.nm-cs--open .nm-cs__dropdown { display: block; }
.nm-cs--up .nm-cs__dropdown {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0;
    transform-origin: bottom center;
}
@keyframes nm-cs-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nm-cs__option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 120ms ease, color 120ms ease;
}
.nm-cs__option:hover { background: var(--content-bg); }
.nm-cs__option--selected {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.nm-cs__option--disabled { opacity: .45; cursor: not-allowed; }
.nm-cs__opt-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nm-cs__check {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    color: var(--primary);
}

/* Wewnątrz tabel/komórek — kompaktowy wariant przez inline width */
.nm-cs--open { z-index: 1001; }

/* ============================================================
   ITERACJA 4 — Picking, modale wewnętrzne, compose mobile
   ============================================================ */

/* === Picking mobile (klasy z pages/picking.php) === */
@media (max-width: 700px) {
    .picking-mode-selector {
        grid-template-columns: 1fr !important;
        gap: 10px;
        margin-bottom: 16px;
    }
    .picking-mode-card {
        padding: 14px;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .picking-mode-icon { font-size: 28px; margin-bottom: 0; flex: 0 0 auto; }
    .picking-mode-card h3 { font-size: 14px; margin: 0; }
    .picking-mode-card p { font-size: 11px; }

    .pick-item-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }
    .pick-item-row .pick-product-info { width: 100%; }
    .pick-item-row .pick-product-name { font-size: 14px; word-break: break-word; }
    .pick-item-row .pick-qty-info {
        text-align: left;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .pick-item-row .pick-qty-value { font-size: 18px; }
    .pick-item-row .pick-order-badges { width: 100%; }
    .pick-confirm-btn {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    .picking-orders-table { min-width: 0; }
    .batch-split-section { margin-top: 16px; padding-top: 16px; }
}

/* === Modale wewnętrzne — wiersze formularzy/produktów === */
@media (max-width: 700px) {
    .ml-modal__body .ml-grid-2,
    .ml-modal__body .ml-grid-3,
    .ml-modal__body .ml-grid-4,
    .ml-modal__body .ml-form-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    .ml-modal__body .ml-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .ml-modal__body .ml-form-row > label,
    .ml-modal__body .ml-form-row > .ml-form-label {
        width: 100%;
        text-align: left;
    }
    .ml-modal__footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .ml-modal__footer .ml-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
    }
    /* Wewnętrzne tabele w modalach (np. linie zamówienia / faktury) — scroll horyzontalny */
    .ml-modal__body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}

/* === Karty zamówień / faktur — szczegółowe info-grid === */
@media (max-width: 700px) {
    .ml-info-grid,
    .ml-detail-grid,
    .ml-order-summary,
    .ml-invoice-summary {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .ml-summary-totals {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
}
