/* ===== RESET ===== */
* {
    box-sizing: border-box;
}

:root {
    --topbar-height: 70px;
    --sidebar-width: 220px;
    --app-bg: #1f2937;
    --topbar-bg: #2b2b2b; /* antracyt */
    --sidebar-text: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --content-bg: #f3f4f6;
    --content-text: #111827;
    --calendar-hour-height: 56px;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--app-bg);
    color: var(--content-text);
}

/* ===== AUTH (LOGIN) ===== */
body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
    color: #ffffff;
}

.auth-shell {
    width: 100%;
}

.auth-center {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.auth-logo img {
    display: block;
    height: 86px;
    width: auto;
}

.auth-card {
    width: 100%;
    background: #ffffff;
    color: #111827;
    padding: 18px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}

.auth-title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}

.auth-label {
    display: block;
    margin: 10px 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    outline: none;
}

.auth-input:focus {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.auth-btn {
    width: 100%;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #111827;
    background: #111827;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.auth-btn:hover {
    background: #0b1220;
}

.auth-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ===== TOPBAR ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo {
    display: block;
    height: var(--topbar-height);
    width: auto;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.topbar-right {
    position: relative; /* anchor notification dropdown */
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.topbar-right .notification-menu,
.topbar-right .mail-menu {
    position: relative; /* anchor dropdown to icon */
}

.topbar-right .notification-icon,
.topbar-right .user-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    color: inherit;
}

.topbar-right .notification-icon:hover,
.topbar-right .user-icon:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--app-bg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    color: var(--sidebar-text);
    z-index: 900;
    transition: width 0.18s ease, transform 0.18s ease;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}

.sidebar-icon {
    width: 22px;
    flex: 0 0 22px;
    text-align: center;
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar a:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar hr {
    width: 100%;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 12px 0;
}

/* ===== CONTENT ===== */
.content {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    background: var(--content-bg);
    color: var(--content-text);
    min-height: calc(100vh - var(--topbar-height));
}

body.sidebar-collapsed {
    --sidebar-width: 68px;
}

body.sidebar-collapsed .sidebar {
    padding: 14px 10px;
}

body.sidebar-collapsed .sidebar a {
    justify-content: center;
    padding: 10px 8px;
}

body.sidebar-collapsed .sidebar-label {
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 880;
    display: none;
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

.content > :first-child {
    margin-top: 0;
}

.content > :last-child {
    margin-bottom: 0;
}

/* ===== CARDS / BUTTONS ===== */
.content .card {
    background: #ffffff;
    color: #111827;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.content .btn {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.content .btn:hover {
    background: #f3f4f6;
}

.content .btn-primary {
    border-color: #111827;
    background: #111827;
    color: #ffffff;
}

.content .btn-primary:hover {
    background: #0b1220;
}

.content .btn-danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.content .btn-danger:hover {
    background: #ffe4e6;
}

/* ===== ACTIVITY CARDS ===== */
.content .activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.content .activity-card {
    padding: 14px;
}

.content .js-clickable-card {
    cursor: pointer;
    transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.content .js-clickable-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.content .js-clickable-card:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

/* ===== SALES FUNNEL (DRAG & DROP) ===== */
.content .sales-funnel-stage-list {
    min-height: 48px;
}

.content .sales-funnel-stage-list.is-dragover {
    outline: 2px dashed #60a5fa;
    outline-offset: 2px;
    border-radius: 14px;
}

.content .sales-funnel-card[draggable="true"] {
    cursor: grab;
    user-select: none;
}

.content .sales-funnel-card.is-dragging {
    opacity: 0.55;
}

.content .sales-funnel-card.is-updating {
    opacity: 0.7;
    pointer-events: none;
}

.content .sales-funnel-card.has-planned-action {
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.content .sales-funnel-card.missing-planned-action {
    border-color: #fecaca;
    background: #fff1f2;
}

.content .activity-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.content .activity-title {
    font-weight: 700;
}

.content .activity-meta {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

.content .activity-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.content .activity-actions form {
    margin: 0;
}

.content .activity-details {
    margin-top: 12px;
    color: #374151;
    white-space: pre-wrap;
}

/* ===== CONTACT ACTIONS (TASKS) ===== */
.content .contact-action-widget {
    width: 100%;
}

.content .contact-action-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.content .contact-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.content .contact-action-label {
    font-size: 12px;
    color: #6b7280;
    min-width: 90px;
    font-weight: 700;
}

.content .contact-action-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content .contact-action-btn:hover {
    background: #f3f4f6;
}

.content .contact-action-btn.is-active {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.content .contact-action-form {
    border: 1px dashed #e5e7eb;
    background: #f9fafb;
    border-radius: 14px;
    padding: 12px;
}

.content .task-bubble-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content .task-bubble {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.content .task-bubble.is-done {
    background: #f9fafb;
    border-color: #e5e7eb;
    opacity: 0.9;
}

.content .task-bubble-title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.content .task-bubble-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 999px;
}

.content .task-bubble-meta {
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}

.content .task-bubble-body {
    margin-top: 10px;
    color: #374151;
    white-space: pre-wrap;
}

.content .task-bubble-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    align-items: center;
}

/* ===== LIVE SEARCH ===== */
.search-container {
    position: relative;
    flex: 1;
    max-width: 560px;
    margin: 0 20px;
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

#liveSearch {
    width: 100%;
    flex: 1 1 auto;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    outline: none;
}

.search-scan-btn {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.search-scan-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.search-scan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#liveSearch::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

#searchResults {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.22);
    padding: 10px;
    max-height: 55vh;
    overflow: auto;
    z-index: 2500;
    display: none;
}

#searchResults strong {
    display: block;
    margin: 6px 6px 4px;
    font-size: 12px;
    color: #374151;
}

#searchResults hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 10px 0;
}

#searchResults > div {
    padding: 8px 10px;
    border-radius: 10px;
}

#searchResults > div:hover {
    background: #f3f4f6;
}

#searchResults a {
    color: inherit;
    text-decoration: none;
}

/* ===== DROPDOWNS ===== */
.user-menu {
    position: relative;
}

.dropdown,
.notification-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    min-width: 220px;
    display: none;
    z-index: 2000;
}

.dropdown a,
.notification-dropdown div,
.notification-dropdown .notification-item {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #111;
}

.notification-dropdown .notification-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.dropdown a:hover {
    background: #f3f4f6;
}

.notification-dropdown .notification-item:hover {
    background: #f3f4f6;
}

.notification-dropdown .notification-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* ===== NOTIFICATION BADGE ===== */
.notification-icon {
    position: relative;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: red;
    color: white;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 50%;
}

/* ===== CALENDAR ===== */
.content .calendar-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1000px) {
    .content .calendar-layout {
        grid-template-columns: 1fr;
    }
}

.content .calendar-toolbar {
    margin-bottom: 16px;
}

.content .calendar-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.content .calendar-view-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.content .calendar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.content .calendar-period {
    font-weight: 700;
}

.content .calendar-timegrid {
    --calendar-hours: 24;
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 10px;
    align-items: start;
}

.content .calendar-timecol {
    height: calc(var(--calendar-hour-height) * var(--calendar-hours));
}

.content .calendar-time-row {
    height: var(--calendar-hour-height);
    padding: 2px 8px 0 0;
    text-align: right;
    font-size: 11px;
    color: #6b7280;
    line-height: 1;
}

.content .calendar-daycol-inner,
.content .calendar-week-col-inner {
    position: relative;
    height: calc(var(--calendar-hour-height) * var(--calendar-hours));
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background-color: #ffffff;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(229, 231, 235, 1) 0,
        rgba(229, 231, 235, 1) 1px,
        transparent 1px,
        transparent var(--calendar-hour-height)
    );
}

.content .calendar-daycol-inner.is-today,
.content .calendar-week-col-inner.is-today {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.content .calendar-week-scroll {
    overflow-x: auto;
}

.content .calendar-week-scroll-inner {
    min-width: 980px; /* 64 + 5*~180 */
}

.content .calendar-week-header {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.content .calendar-week-header-days {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.content .calendar-week-header-day {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px;
    text-align: center;
}

.content .calendar-week-header-day a {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.content .calendar-week-header-day small {
    font-weight: 400;
    color: #6b7280;
}

.content .calendar-week-header-day.is-today {
    border-color: #c7d2fe;
    background: #eef2ff;
}

.content .calendar-week-cols {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.content .calendar-event {
    position: absolute;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    border-left: 4px solid #111827;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 6px 8px;
    overflow: hidden;
    color: inherit;
}

.content .calendar-event:hover {
    background: #f9fafb;
}

.content .calendar-event:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20);
}

.content .calendar-event[data-type="telefon"] {
    border-left-color: #2563eb;
}

.content .calendar-event[data-type="mail"] {
    border-left-color: #16a34a;
}

.content .calendar-event[data-type="sms"] {
    border-left-color: #f59e0b;
}

.content .calendar-event[data-type="działanie"],
.content .calendar-event[data-type="dzialanie"] {
    border-left-color: #6366f1;
}

.content .calendar-event[data-type="spotkanie"] {
    border-left-color: #7c3aed;
}

.content .calendar-event.is-done {
    background: #f8fafc;
    color: #64748b;
    border-color: #cbd5e1;
    border-left-color: #94a3b8;
}

.content .calendar-event-title {
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content .calendar-event-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content .calendar-month-dow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
}

.content .calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.content .calendar-month-cell {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.content .calendar-month-cell.is-outside {
    background: #f9fafb;
    color: #6b7280;
}

.content .calendar-month-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    background: transparent;
}

.content .calendar-month-cell.is-weekday::before {
    background: rgba(34, 197, 94, 0.10); /* delikatna zieleń */
}

.content .calendar-month-cell.is-weekend::before {
    background: rgba(107, 114, 128, 0.14); /* delikatna szarość */
}

.content .calendar-month-cell.is-outside::before {
    opacity: 0.55;
}

.content .calendar-month-cell > * {
    position: relative;
    z-index: 1;
}

.content .calendar-month-cell-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.content .calendar-month-day {
    font-weight: 700;
}

.content .calendar-month-day a {
    color: inherit;
    text-decoration: none;
}

.content .calendar-month-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.content .calendar-chip {
    display: block;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    text-align: left;
    font: inherit;
    padding: 6px 8px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #111827;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.2;
}

.content .calendar-chip:hover {
    background: #e5e7eb;
}

.content .calendar-chip.is-done {
    background: #f8fafc;
    color: #64748b;
    border-color: #cbd5e1;
}

.content .calendar-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.content .calendar-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 3500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.content .calendar-modal {
    width: min(560px, 100%);
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 24px 70px rgba(0,0,0,0.35);
    padding: 14px;
}

.content .calendar-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.content .calendar-modal-title {
    font-weight: 800;
    font-size: 16px;
}

.content .calendar-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #111827;
}

.content .calendar-modal-close:hover {
    background: #f3f4f6;
}

.content .calendar-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

/* ===== PRODUCT IMAGES ===== */
.content .product-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.content .product-image-tile {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.content .product-image-tile.is-main {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.content .product-image-tile img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}

.content .product-image-actions {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.content .product-image-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #1d4ed8;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 6px 10px;
    border-radius: 999px;
}

/* ===== PRODUCT DOCUMENTS ===== */
.content .product-docs-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.content .product-docs-col {
    flex: 1 1 340px;
    min-width: 280px;
}

.content .product-doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content .product-doc-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px 12px;
}

.content .product-doc-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}

.barcode-inline-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.barcode-inline-controls input[type="text"] {
    flex: 1 1 auto;
}

.content .barcode-scanner-modal {
    max-width: 720px;
}

.barcode-scanner-video-wrap {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
}

.barcode-scanner-reader {
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
    min-height: 280px;
}

.barcode-scanner-reader video,
.barcode-scanner-reader canvas {
    display: block;
    width: 100% !important;
    max-height: min(65vh, 480px);
    object-fit: cover;
}

.barcode-scanner-video {
    display: block;
    width: 100%;
    max-height: min(65vh, 480px);
    object-fit: cover;
    background: #020617;
}

.barcode-scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.18);
}

.barcode-scanner-overlay::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    top: 50%;
    height: 2px;
    background: rgba(34, 197, 94, 0.9);
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.55);
}

.barcode-scanner-status {
    margin: 10px 0 0;
    font-size: 13px;
    color: #4b5563;
}

.barcode-scanner-status.is-error {
    color: #b91c1c;
}

.barcode-scanner-status.is-success {
    color: #166534;
}

/* ===== RESPONSIVE (MOBILE) ===== */
@media (max-width: 900px) {
    .topbar {
        padding: 0 12px;
    }

    .topbar-right {
        gap: 8px;
    }

    .topbar-right .notification-icon,
    .topbar-right .user-icon,
    .sidebar-toggle {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .sidebar-toggle {
        font-size: 20px;
    }

    .app-logo {
        height: 56px;
    }

    .search-container {
        margin: 0 10px;
        max-width: none;
    }

    #liveSearch {
        padding: 9px 10px;
    }

    .search-input-row {
        gap: 8px;
    }

    .search-scan-btn {
        height: 38px;
        padding: 0 12px;
    }

    .barcode-inline-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .content {
        margin-left: 0;
        padding: 16px;
    }

    /* Off-canvas sidebar */
    .sidebar {
        width: 260px;
        transform: translateX(-105%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Jeśli user ma zapisany stan "collapsed", na mobile i tak pokazujemy pełne menu */
    body.sidebar-collapsed {
        --sidebar-width: 220px;
    }

    body.sidebar-collapsed .sidebar {
        padding: 20px;
    }

    body.sidebar-collapsed .sidebar a {
        justify-content: flex-start;
        padding: 10px 12px;
    }

    body.sidebar-collapsed .sidebar-label {
        display: inline;
    }

    /* Tabele: przewijanie w poziomie na małych ekranach */
    .content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
