/* =========================================================================
   SHIPAIRGLOBAL - SISTEMA DE GESTIÓN LOGÍSTICA
   Design System v2.0 - Dark Theme Premium
   ========================================================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Design Tokens ───────────────────────────────────────────────────── */
:root {
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-heading: 'Inter', sans-serif;

    --bg-dark: #0a0e17;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-focus: rgba(255, 255, 255, 0.06);

    --accent: #FF9800;
    --accent-hover: #FFB74D;
    --accent-glow: rgba(255, 152, 0, 0.25);
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --text-disabled: #475569;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: var(--accent);
    --border-subtle: rgba(255, 255, 255, 0.04);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);

    --transition: all 0.2s ease;
    --transition-slow: all 0.35s ease;

    --sidebar-width: 240px;
    --header-height: 56px;
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ══════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════════════ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    width: 400px;
    max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    backdrop-filter: blur(20px);
}

.login-card .logo-area {
    text-align: center;
    margin-bottom: 28px;
}

.login-card .logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent), #E65100);
    border-radius: 12px;
    font-weight: 800;
    font-size: 16px;
    color: white;
    margin-bottom: 12px;
}

.login-card .logo-name {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: white;
}

.login-card .logo-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   SIDEBAR — ACCORDION GROUPS
   ══════════════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background-color: rgba(8, 12, 20, 0.98);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px 10px 10px;
    overflow-y: auto;
    gap: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    margin-bottom: 22px;
}

.sidebar-logo .badge {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #E65100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(255,152,0,0.4);
}

.sidebar-logo .name {
    font-size: 14px;
    font-weight: 700;
    color: white;
    font-family: var(--font-heading);
    line-height: 1.2;
}
.sidebar-logo .tagline {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Accordion Group */
.nav-group {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    user-select: none;
    border-radius: var(--radius);
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-group-header:hover {
    background: rgba(255,255,255,0.04);
    color: white;
}

.nav-group-header.open {
    color: white;
    background: rgba(255,255,255,0.04);
}

.nav-group-header i.group-icon {
    width: 17px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.nav-group-header .chevron {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-group-header.open .chevron {
    transform: rotate(90deg);
}

/* Active group — accent stripe */
.nav-group-header.has-active {
    color: var(--accent);
}

.nav-group-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group-children.open {
    max-height: 600px;
}

/* Sub items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px 7px 30px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: white;
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.nav-item i {
    width: 15px;
    text-align: center;
    font-size: 12px;
    flex-shrink: 0;
}

/* Logout — standalone item at bottom */
.nav-standalone {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.nav-item.logout {
    color: var(--error);
    padding-left: 11px;
    border-radius: var(--radius);
}

.nav-item.logout:hover {
    background: var(--error-bg);
}

/* Separator line between groups */
.nav-sep {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 8px;
}

/* ══════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
    height: var(--header-height);
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    background: rgba(10, 14, 23, 0.6);
    backdrop-filter: blur(10px);
}

.page-title {
    font-size: 15px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-bar input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px 8px 34px;
    color: white;
    font-size: 13px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #151922;
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.open { display: block; }

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.search-result-item:hover { background: rgba(255,255,255,0.04); }

.search-result-item .sr-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.search-result-item .sr-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
}

.header-user .user-role {
    font-weight: 700;
    color: var(--accent);
    font-size: 10px;
    text-transform: uppercase;
}

/* Network Switch */
.net-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.switch {
    position: relative;
    width: 36px;
    height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.net-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.net-badge.online { background: var(--success-bg); color: var(--success); }
.net-badge.offline { background: var(--error-bg); color: var(--error); }

/* ── Offline Banner ───────────────────────────────────────────────────── */
.sync-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: var(--warning-bg);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 12px;
    font-weight: 600;
    color: var(--warning);
}

.sync-banner.visible { display: flex; }

.btn-sync {
    background: var(--warning);
    color: #000;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════════
   SCREEN CONTAINER
   ══════════════════════════════════════════════════════════════════════ */
.screen-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.screen { display: none; }
.screen.active { display: block; }

/* ── Panel Layouts ────────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* ── Glass Panel ──────────────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.panel-header i {
    color: var(--accent);
    font-size: 16px;
}

.panel-header span {
    font-size: 14px;
    font-weight: 700;
    color: white;
    font-family: var(--font-heading);
}

.panel-header .panel-badge {
    margin-left: auto;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
}

/* ══════════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input:not([type="checkbox"]), select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

input:not([type="checkbox"]):focus, select:focus, textarea:focus {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input:not([type="checkbox"])::placeholder, textarea::placeholder { color: var(--text-disabled); }

input:not([type="checkbox"])[readonly] {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* FIX: Select dropdown dark styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

select option {
    background-color: #1a1f2e;
    color: var(--text-primary);
    padding: 8px;
}

/* Input variants */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.input-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.input-warning {
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px var(--warning-bg) !important;
}

.input-success {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px var(--success-bg) !important;
}

/* Checkbox override */
input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Inline Add Button */
.input-with-add {
    display: flex;
    gap: 6px;
}

.input-with-add input,
.input-with-add select {
    flex: 1;
}

.btn-inline-add {
    width: 38px;
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.btn-inline-add:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #E65100 100%);
    color: white;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 152, 0, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover { filter: brightness(1.1); }

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

.btn-danger:hover { filter: brightness(1.1); }

.btn-block { width: 100%; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ══════════════════════════════════════════════════════════════════════
   CHIPS (Cuenta Asociada)
   ══════════════════════════════════════════════════════════════════════ */
.chip-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 6px 0 10px 0;
}

.chip {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.chip:hover {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
}

.chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

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

thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

th {
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,0.02); }

tr.selected td { background: var(--accent-glow); }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-deposito { background: var(--info-bg); color: var(--info); }
.badge-vuelo { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }
.badge-hold { background: var(--warning-bg); color: var(--warning); }
.badge-ready { background: var(--success-bg); color: var(--success); }
.badge-entregado { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.badge-retenido { background: var(--error-bg); color: var(--error); }
.badge-activo { background: var(--success-bg); color: var(--success); }

/* ══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: #1e2332;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.5s forwards;
    max-width: 400px;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-error { border-left: 4px solid var(--error); }
.toast.toast-info { border-left: 4px solid var(--info); }

.toast i { font-size: 16px; flex-shrink: 0; }
.toast.toast-success i { color: var(--success); }
.toast.toast-warning i { color: var(--warning); }
.toast.toast-error i { color: var(--error); }
.toast.toast-info i { color: var(--info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(50px); }
}

/* ══════════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #151922;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i { color: var(--accent); }

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

/* ══════════════════════════════════════════════════════════════════════
   n8n SIMULATOR WIDGET
   ══════════════════════════════════════════════════════════════════════ */
.n8n-widget {
    margin-top: 20px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}

.n8n-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.n8n-flow {
    display: flex;
    align-items: center;
    gap: 8px;
}

.n8n-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 56px;
}

.n8n-node i { font-size: 16px; color: var(--text-muted); }
.n8n-node-label { font-size: 8px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

.n8n-node.active {
    border-color: var(--accent);
    background: var(--accent-glow);
    animation: pulseNode 1s ease;
}

.n8n-node.active i { color: var(--accent); }
.n8n-node.active .n8n-node-label { color: var(--accent); }

@keyframes pulseNode {
    0%,100% { box-shadow: 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 6px var(--accent-glow); }
}

/* ══════════════════════════════════════════════════════════════════════
   SCAN STATUS BOXES
   ══════════════════════════════════════════════════════════════════════ */
.scan-status {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    margin: 12px 0;
    transition: var(--transition);
}

.scan-status.ok {
    background: var(--success-bg);
    border-color: rgba(16,185,129,0.3);
    color: var(--success);
}

.scan-status.err {
    background: var(--error-bg);
    border-color: rgba(239,68,68,0.3);
    color: var(--error);
}

/* ══════════════════════════════════════════════════════════════════════
   SECURITY NOTE
   ══════════════════════════════════════════════════════════════════════ */
.security-note {
    font-size: 11px;
    font-weight: 700;
    color: var(--error);
    padding: 8px 12px;
    background: var(--error-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}

/* ══════════════════════════════════════════════════════════════════════
   INFO BOXES
   ══════════════════════════════════════════════════════════════════════ */
.info-box {
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 12px;
    line-height: 1.5;
}

.info-box.warning {
    background: var(--warning-bg);
    border-color: rgba(245,158,11,0.2);
    color: var(--warning);
}

.info-box.danger {
    background: var(--error-bg);
    border-color: rgba(239,68,68,0.2);
    color: var(--error);
}

.info-box.info {
    background: var(--info-bg);
    border-color: rgba(59,130,246,0.2);
    color: var(--info);
}

.info-box .info-title {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    margin-bottom: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   SHELF COUNTER
   ══════════════════════════════════════════════════════════════════════ */
.shelf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.shelf-cell {
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.shelf-cell .shelf-name {
    font-size: 13px;
    font-weight: 800;
    color: white;
    font-family: var(--font-mono);
}

.shelf-cell .shelf-count {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.shelf-cell.has-items { border-color: var(--accent); }
.shelf-cell.has-items .shelf-count { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════
   DRAG & DROP
   ══════════════════════════════════════════════════════════════════════ */
.drag-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background: rgba(255,255,255,0.01);
    transition: var(--transition);
}

.drag-drop-area:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drag-drop-area i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body {
        flex-direction: column !important;
        height: 100vh !important;
        overflow: hidden !important;
    }
    
    #sidebar-toggle {
        display: flex !important;
    }
    
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -250px !important;
        width: 240px !important;
        height: 100vh !important;
        z-index: 999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        background-color: rgba(8, 12, 20, 0.99) !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        border-right: 1px solid var(--border-color) !important;
        border-bottom: none !important;
        padding: 16px 10px 10px !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
    }
    
    .sidebar.mobile-open {
        left: 0 !important;
    }
    
    .sidebar-logo {
        margin-bottom: 22px !important;
        margin-right: 0 !important;
    }
    
    .nav-links {
        flex-direction: column !important;
        overflow-x: visible !important;
    }
    
    .nav-section-label {
        display: block !important;
    }
    
    .nav-item span {
        display: inline !important;
    }
    
    .nav-item {
        padding: 9px 12px !important;
    }
    
    .main-content {
        height: calc(100vh - 56px) !important;
        overflow-y: auto !important;
        margin-left: 0 !important;
    }
    
    .screen-area {
        padding: 12px !important;
    }
    
    header {
        height: 56px !important;
        padding: 0 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        position: sticky !important;
        top: 0 !important;
        background: #080c14 !important;
        z-index: 100 !important;
        border-bottom: 1px solid var(--border-color) !important;
        flex-wrap: nowrap !important;
    }
    
    .page-title {
        display: none !important;
    }
    
    .search-bar {
        flex: 1 !important;
        max-width: 100% !important;
        margin: 0 8px !important;
        order: initial !important;
    }
    
    .grid-2, .grid-3, .grid-2-1 {
        grid-template-columns: 1fr !important;
    }
    
    .input-row, .input-row-3 {
        grid-template-columns: 1fr !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════════════════════ */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-row { display: flex; gap: 10px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.separator { border: 0; border-top: 1px solid var(--border-color); margin: 16px 0; }

/* ══════════════════════════════════════════════════════════════════════
   USA-SCREEN — Full-width intake form + shelf grid at bottom
   ══════════════════════════════════════════════════════════════════════ */
#usa-screen .intake-form-wrap {
    max-width: 900px;
    margin: 0 auto;
}
#usa-screen .shelf-bottom-wrap {
    margin-top: 24px;
    padding-top: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   SHELF MANAGEMENT
   ══════════════════════════════════════════════════════════════════════ */
.shelf-mgmt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.shelf-mgmt-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}
.shelf-mgmt-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.shelf-mgmt-card .shelf-name-label {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 4px;
    display: block;
}
.shelf-mgmt-card .shelf-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}
.shelf-mgmt-card .shelf-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.shelf-add-card {
    background: rgba(255,152,0,0.04);
    border: 1px dashed rgba(255,152,0,0.4);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 100px;
}
.shelf-add-card:hover {
    background: rgba(255,152,0,0.08);
    border-color: var(--accent);
}
.shelf-add-card i { font-size: 22px; }
.shelf-add-card span { font-size: 12px; font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════
   CONFIG SCREEN TABS
   ══════════════════════════════════════════════════════════════════════ */
.config-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.config-tab-btn {
    padding: 9px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    white-space: nowrap;
}
.config-tab-btn:hover { color: white; background: rgba(255,255,255,0.03); }
.config-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(255,152,0,0.05);
}
.config-tab-pane { display: none; }
.config-tab-pane.active { display: block; }

/* Webhook status card */
.webhook-status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    transition: var(--transition);
}
.webhook-status-card:hover { border-color: rgba(255,255,255,0.14); }
.webhook-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}
.webhook-dot.green { color: var(--success); background: var(--success); }
.webhook-dot.orange { color: var(--warning); background: var(--warning); }
.webhook-dot.red { color: var(--error); background: var(--error); }
.webhook-info { flex: 1; }
.webhook-info .wh-name { font-size: 13px; font-weight: 600; color: white; }
.webhook-info .wh-url  { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); word-break: break-all; }

/* System info box */
.sys-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.sys-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
}
.sys-info-card .label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.sys-info-card .value { font-size: 20px; font-weight: 800; color: white; }
.sys-info-card .value.accent { color: var(--accent); }


/* Beautiful Custom Toggle Switches */
.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}
.custom-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.custom-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 22px;
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}
input:checked + .switch-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}
input:checked + .switch-slider:before {
    transform: translateX(22px);
    background-color: white;
}

/* Shelf Cell Popover styles */
.shelf-cell {
    position: relative;
    cursor: pointer;
}
.shelf-popover {
    display: none;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: #12121d !important; /* Solid dark background */
    border: 1px solid var(--accent) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    border-radius: var(--radius);
    padding: 12px;
    z-index: 1100;
}
.shelf-popover-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-bottom: 8px;
    text-align: center;
}
.shelf-popover-list {
    max-height: 160px;
    overflow-y: auto;
    font-size: 10px;
    color: white;
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}
.shelf-popover-item {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.shelf-popover-item:last-child {
    border-bottom: none;
}

/* Custom Calendar Styles */
.custom-calendar-popup {
    width: 290px;
    background: #12121d !important; /* Solid dark background */
    border: 1px solid var(--accent) !important;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    padding: 14px;
    font-family: inherit;
    user-select: none;
    display: none;
    position: absolute;
    top: 110%;
    left: 0;
    z-index: 1200;
}
.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: white;
}
.cal-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: 0.2s;
}
.cal-btn:hover {
    background: rgba(255,152,0,0.1);
}
.cal-month-year {
    font-weight: 700;
    font-size: 12px;
}
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}
.cal-day {
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: 0.2s;
}
.cal-day:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}
.cal-day.empty {
    cursor: default;
    background: none !important;
}
.cal-day.selected {
    background: var(--accent) !important;
    color: white !important;
    font-weight: 700;
}
.cal-day.today {
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 700;
}
.cal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.search-dropdown-popup {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #12121d !important;
    border: 1px solid var(--accent) !important;
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1300;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    display: none;
    text-align: left;
}

/* Input Validation Error Highlight */
.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.25) !important;
}
