/* MODALS OVERLAY */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 9999 !important;
    display: none; /* JS toggles to flex */
    align-items: center !important;
    justify-content: center !important;
    padding: 24px;
    box-sizing: border-box;
}

.modal .card, .modal-inner {
    background: rgba(26, 29, 36, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    backdrop-filter: blur(16px) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6) !important;
    animation: modalAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: auto !important;
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 10000;
    overflow: hidden;
    padding: 32px !important; /* Ensure consistent generous padding */
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

:root {
    --bg-dark: #0f1115;
    --bg-surface: #1a1d24;
    --bg-surface-hover: #232730;
    --text-primary: #f0f2f5;
    --text-secondary: #9aa0a6;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: #2e333e;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-subtle: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none; /* reset browser default */
}

/* ---- CUSTOM FOCUS RING (tylko klawiatura, nie mysz) ---- */
*:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.75);
    outline-offset: 2px;
    border-radius: inherit;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(155deg, #0e1119 0%, #0f1115 45%, #100f17 100%);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}


/* HEADER */
.header {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    box-shadow: var(--shadow-subtle);
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    opacity: 0.6;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.logo-name {
    background: linear-gradient(-90deg, #e2e8f0 0%, #94a3b8 25%, #bfdbfe 50%, #94a3b8 75%, #e2e8f0 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
    animation: textGradientShift 5s linear infinite;
}

@keyframes textGradientShift {
    0% { background-position: 200% center; }
    100% { background-position: 0% center; }
}

.logo-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 6px rgba(59,130,246,0.5));
    align-self: center;
}

.accent {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #0f1115;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    align-self: center;
    box-shadow: 0 1px 6px rgba(251,191,36,0.35);
    margin-left: 2px;
}

.time-display {
    font-variant-numeric: tabular-nums;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-dark);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* CARDS & PANELS */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.accent-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.accent-link:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}


/* CONTROLS (Operator & Device) */
.controls-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-select {
    width: 100%;
    padding: 14px 16px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.modern-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ===== OPERATOR CUSTOM DROPDOWN ===== */
.operator-wrapper {
    position: relative;
}

.operator-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.operator-display:hover {
    border-color: var(--accent-blue);
    background: var(--bg-surface-hover);
}

.operator-display.open {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.operator-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: 0;
    transition: var(--transition);
}

.operator-avatar.empty {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    font-size: 1rem;
}


.operator-name {
    flex: 1;
    font-size: 0.975rem;
    font-weight: 500;
    color: var(--text-primary);
}

.operator-name.placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.operator-chevron {
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}

.operator-display.open .operator-chevron {
    transform: rotate(180deg);
}

.operator-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border: 1px solid var(--accent-blue);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 50;
    overflow: hidden;
    display: none;
    animation: dropdownFadeIn 0.15s ease-out;
}

.operator-dropdown-list.open {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.operator-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.operator-option:hover {
    background: var(--bg-surface-hover);
}

.operator-option.selected {
    background: rgba(59, 130, 246, 0.1);
}

.operator-option-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.operator-option-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* TOGGLE BUTTONS */
.toggle-container {
    display: flex;
    gap: 8px;
    background: var(--bg-dark);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.toggle-container input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.toggle-container input[type="radio"]:checked + .toggle-btn {
    background: color-mix(in srgb, var(--device-color, #10b981), transparent 85%);
    color: var(--device-color, #10b981);
    border-color: var(--device-color, #10b981);
}

/* WORKSPACE */
.workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (min-width: 900px) {
    .workspace {
        grid-template-columns: 1fr 1fr;
    }
}

/* PARKINGS GRID */
.parkings-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.parking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* ---- SEPARATORY GRUP w siatce parkingów ---- */
.parking-group-separator {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 -2px;
    pointer-events: none;
}

.parking-group-separator.hidden {
    display: none;
}

.parking-group-sep-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.85;
}

.parking-group-sep-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0.7;
}

.parking-group-sep-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
    opacity: 0.6;
}

.parking-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--border-color); /* Overridden inline */
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.parking-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border-color: rgba(255,255,255,0.1);
}

.parking-card.selected {
    background: linear-gradient(135deg, var(--bg-surface-hover) 0%, #20242e 100%);
    border-color: color-mix(in srgb, var(--card-color, #3b82f6), transparent 55%);
    border-top-color: var(--card-color, #3b82f6) !important;
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--card-color, #3b82f6), transparent 70%),
        0 0 22px color-mix(in srgb, var(--card-color, #3b82f6), transparent 65%),
        0 8px 24px rgba(0, 0, 0, 0.3);
}

.parking-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.parking-name {
    font-size: 1rem;
    font-weight: 500;
}

/* REASONS PANEL */
.reasons-panel {
    background: rgba(26, 29, 36, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.reasons-panel.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.selected-parking-name {
    color: var(--accent-blue);
    font-weight: 700;
}

.reasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.reason-btn {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-left: 3px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.reason-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.07) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
}

.reason-btn:hover::before {
    opacity: 1;
}

.reason-btn:hover {
    border-color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.reason-btn:active {
    transform: translateY(0) scale(0.96);
    background: rgba(59, 130, 246, 0.25);
    transition: transform 0.1s;
}

.reason-label {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.3;
}

.reason-shortcut {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0,0,0,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.reason-btn:hover .reason-shortcut {
    color: rgba(255,255,255,0.8);
}

/* ---- GEAR ICON on reason button ---- */
.reason-gear-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    z-index: 2;
    padding: 0;
    line-height: 1;
    user-select: none;
}
.reason-btn:hover .reason-gear-btn {
    opacity: 1;
}
.reason-gear-btn:hover {
    background: rgba(59,130,246,0.2);
    color: var(--accent-blue);
    opacity: 1 !important;
}

/* ---- ADD NEW REASON GHOST TILE ---- */
.reason-btn.add-new {
    background: transparent !important;
    border: 1.5px dashed rgba(255, 255, 255, 0.15) !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.45;
    box-shadow: none !important;
    transform: none !important;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}
.reason-btn.add-new:hover {
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03) !important;
    opacity: 0.85;
}
.reason-btn.add-new .reason-label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: inherit;
}

/* ---- SHORTCUT BADGE — bottom-right watermark ---- */
.reason-shortcut-badge {
    position: absolute;
    bottom: 5px;
    right: 7px;
    font-size: 0.62rem;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
    opacity: 0.38;
    letter-spacing: 0.04em;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s;
    line-height: 1;
}
.reason-btn:hover .reason-shortcut-badge {
    opacity: 0.65;
}

/* ---- DYNAMIC SHORTCUT BADGES (Alt Reveal) ---- */
.dynamic-shortcut {
    position: absolute;
    bottom: 4px; /* Slightly lower on the reasons */
    right: 4px;
    background: var(--accent-blue);
    color: white;
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 0.70rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0.6);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10;
    text-transform: uppercase;
}

body.show-alt-hints .dynamic-shortcut {
    opacity: 1;
    transform: scale(1);
}

.device-wrapper .dynamic-shortcut {
    top: 4px; 
    bottom: auto; /* Adjust positioning for device badges to be top-right */
}

/* ---- SHORTCUT CAPTURE BOX (focus state) ---- */
#shortcut-capture-box:focus {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
#shortcut-capture-box.captured {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* ---- SHORTCUT LIST ROWS inside modal ---- */
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.shortcut-row-key {
    font-family: monospace;
    font-weight: 600;
    background: rgba(59,130,246,0.15);
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.shortcut-row-info {
    flex: 1;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shortcut-row-del {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.shortcut-row-del:hover {
    background: rgba(239,68,68,0.15);
    color: var(--accent-red);
}


.shortcut-input-container {
    position: relative;
}

.shortcut-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: monospace;
    outline: none;
    transition: var(--transition);
}

.shortcut-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* LOGS TABLE */
.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.icon-btn:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

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

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.modern-table th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.modern-table tr:hover td {
    background: var(--bg-dark);
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.time-col {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.font-medium {
    font-weight: 500;
}

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

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-in {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-out {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* TOAST NOTIFICATION */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent-green);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-weight: 500;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--accent-red);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Admin form (also used in modals on index) */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.admin-input:focus {
    border-color: var(--accent-blue);
}

.primary-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.primary-btn:hover {
    background: var(--accent-blue-hover);
}

/* Action buttons in log table */
.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    opacity: 0.7;
}

.action-btn:hover {
    opacity: 1;
    background: var(--bg-dark);
}

/* ===== MEMO BOARD (System Interwencji) ===== */

:root {
    --priority-critical: #ef4444;
    --priority-high:     #f97316;
    --priority-medium:   #3b82f6;
    --priority-low:      #6b7280;
}

.memo-board-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-subtle);
}

.memo-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.memo-board-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.memo-count-badge {
    background: var(--priority-critical);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
    display: none;
    animation: pulse-badge 2s infinite;
}

.memo-count-badge.visible {
    display: inline-block;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

.add-memo-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.add-memo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

/* Memo Grid */
.memo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.memo-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 36px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.memo-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--priority-medium);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
    position: relative;
}

.memo-card:hover {
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.memo-card[data-priority="Krytyczna"] { border-left-color: var(--priority-critical); }
.memo-card[data-priority="Wysoka"]    { border-left-color: var(--priority-high); }
.memo-card[data-priority="Średnia"]   { border-left-color: var(--priority-medium); }
.memo-card[data-priority="Niska"]     { border-left-color: var(--priority-low); }

.memo-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.memo-priority-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 3px 9px;
    border-radius: 999px;
}

.prio-Krytyczna { background: rgba(239,68,68,0.18);  color: var(--priority-critical); }
.prio-Wysoka    { background: rgba(249,115,22,0.18); color: var(--priority-high); }
.prio-Średnia   { background: rgba(59,130,246,0.18); color: var(--priority-medium); }
.prio-Niska     { background: rgba(107,114,128,0.18);color: var(--priority-low); }

.memo-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.memo-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.memo-content {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
    flex: 1;
    word-break: break-word;
}

.memo-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.memo-action-btn {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.memo-action-btn.resolve-btn:hover {
    background: rgba(16,185,129,0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.memo-action-btn.delete-btn:hover {
    background: rgba(239,68,68,0.12);
    border-color: var(--accent-red);
    color: var(--accent-red);
}


.memo-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    min-height: 90px;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.5;
}

.memo-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.priority-select-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.priority-radio { display: none; }

.priority-label {
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.priority-radio:checked + .priority-label {
    color: white;
    border-color: transparent;
}

.priority-radio[value="Krytyczna"]:checked + .priority-label { background: var(--priority-critical); }
.priority-radio[value="Wysoka"]:checked    + .priority-label { background: var(--priority-high); }
.priority-radio[value="Średnia"]:checked   + .priority-label { background: var(--priority-medium); }
.priority-radio[value="Niska"]:checked     + .priority-label { background: var(--priority-low); }

/* Contextual Memos (below manual input) */
.contextual-memos-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom scrollbar for container */
.contextual-memos-container::-webkit-scrollbar {
    width: 4px;
}
.contextual-memos-container::-webkit-scrollbar-track {
    background: transparent;
}
.contextual-memos-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.contextual-memo {
    background: #1e222a;
    border-left: 4px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: memoSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contextual-memo[data-priority="Krytyczna"] { border-left-color: var(--priority-critical); }
.contextual-memo[data-priority="Wysoka"]    { border-left-color: var(--priority-high); }
.contextual-memo[data-priority="Średnia"]   { border-left-color: var(--priority-medium); }
.contextual-memo[data-priority="Niska"]     { border-left-color: var(--priority-low); }

.contextual-memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.contextual-memo-prio {
    padding: 1px 6px;
    border-radius: 4px;
}

.prio-crit-bg { background: rgba(239, 68, 68, 0.2); color: var(--priority-critical); }
.prio-high-bg { background: rgba(249, 115, 22, 0.2); color: var(--priority-high); }
.prio-med-bg  { background: rgba(59, 130, 246, 0.2); color: var(--priority-medium); }
.prio-low-bg  { background: rgba(107, 114, 128, 0.2); color: var(--priority-low); }

@keyframes memoSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== EMPTY STATE (prawy panel bez wyboru obiektu/operatora) ===== */
.panel-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    animation: fadeIn 0.4s ease-out;
    flex: 1;
}

.panel-empty-icon {
    font-size: 3rem;
    opacity: 0.35;
    animation: floatIcon 3s ease-in-out infinite;
    line-height: 1;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}

.panel-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.8;
}

.panel-empty-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    opacity: 0.5;
    max-width: 200px;
    line-height: 1.5;
}

/* Dotted border on right panel when idle */
.reasons-panel.idle-state {
    border-color: var(--border-color);
    border-style: dashed;
    box-shadow: none;
    display: flex !important;
}

/* ============================================================
   CUSTOM SCROLLBAR
   Smukły, ciemny pasek pasujący do palety BlankGate.
   ============================================================ */

/* Firefox — tylko główny scroll strony */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-dark);
}

/* Chromium / Safari */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

::-webkit-scrollbar-corner {
    background: var(--bg-dark);
}


