/* ================================================
   Dashboard CSS v3.0 - iDesk NetManager
   Sidebar Layout + Professional Dashboard
   ================================================ */

/* Header */
.header {
    background: linear-gradient(135deg, #0f2942 0%, #1a3a5c 40%, #1e4976 100%);
    color: #fff;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    padding: 0 1.5rem;
    width: 100%;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--ideskr-primary, #00d4aa) 0%, var(--ideskr-secondary, #667eea) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
}

.logo-icon { line-height: 1; }

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    overflow: hidden;
}

.app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-subtitle {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--ideskr-primary, #00d4aa);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.header-brand:hover {
    color: #fff;
    text-shadow: 0 0 12px rgba(0, 212, 170, 0.5);
}

.header-brand-icon {
    font-size: 0.65rem;
    color: var(--ideskr-primary, #00d4aa);
    filter: drop-shadow(0 0 4px rgba(0, 212, 170, 0.4));
}

.header-brand:hover .header-brand-icon {
    color: #fff;
}

.header-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 0.35rem 0.6rem;
    border-radius: 1rem;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}
.status-dot.connected { background: #10b981; }
.status-dot.connecting { background: #f59e0b; animation: pulse 1.5s infinite; }
.status-dot.error { background: #ef4444; }
.status-text { color: #e2e8f0; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Starlink Badge */
.starlink-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.12);
    padding: 0.35rem 0.7rem;
    border-radius: 1rem;
    color: #90cdf4;
    font-weight: 500;
}

/* Sidebar Toggle (mobile) */
.sidebar-toggle {
    display: none;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.25rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.25); }

/* ═══════════════════════════════════════════
   SIDEBAR NAVIGATION
   ═══════════════════════════════════════════ */

.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 64px);
    margin-top: 64px;
}

.sidebar {
    width: 220px;
    min-width: 220px;
    background: #1e293b;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    z-index: 98;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #475569;
    padding: 1rem 1.25rem 0.4rem;
    text-transform: uppercase;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-item:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.05);
}

.sidebar-item.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #3b82f6;
}

.sidebar-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-label {
    white-space: nowrap;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-decoration: none;
    color: var(--ideskr-primary, #00d4aa);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    transition: color 0.3s ease;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand-icon {
    font-size: 0.55rem;
    filter: drop-shadow(0 0 3px rgba(0, 212, 170, 0.4));
}

.sidebar-version {
    font-size: 0.65rem;
    color: #475569;
    text-align: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Tab Panels */
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }

/* Main Content (with sidebar offset) */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 1.5rem;
    min-height: calc(100vh - 64px);
    background: var(--bg-secondary);
    overflow-x: hidden;
}

.content-inner {
    max-width: 1400px;
    margin: 0 auto;
    min-width: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card.accent-green { border-left: 4px solid var(--success-color); }
.stat-card.accent-blue { border-left: 4px solid var(--primary-color); }
.stat-card.accent-orange { border-left: 4px solid var(--warning-color); }

.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }

/* Section Card */
.section-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-header h2 { margin: 0; font-size: 1.15rem; }

/* Toolbar */
.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.toolbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 0.5rem; }
.panel-toolbar h2 { margin: 0; font-size: 1.15rem; }
.toolbar-left .form-control {
    font-size: 0.82rem;
    padding: 0.4rem 0.65rem;
    border-radius: 0.4rem;
    min-width: 140px;
    border: 1px solid var(--border-light);
    transition: border-color 0.2s;
}
.toolbar-left .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}

/* Info Banner */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: #2a4365;
}
.info-banner .icon { font-size: 1.25rem; flex-shrink: 0; }
.info-banner.info-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

/* Vessel Overview Cards */
.vessels-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.vessel-overview-card {
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    background: #fff;
    transition: box-shadow 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
.vessel-overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
}
.vessel-overview-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.voc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.voc-name { font-weight: 600; font-size: 0.95rem; }
.voc-stats { display: flex; gap: 1rem; }
.voc-stat { text-align: center; }
.voc-stat-val { font-size: 1.25rem; font-weight: 700; display: block; color: var(--text-primary); }
.voc-stat-lbl { font-size: 0.7rem; color: var(--text-secondary); }

/* Vessels Management Grid */
.vessels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.25rem;
}

.vessel-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s, transform 0.15s;
    position: relative;
}
.vessel-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.vessel-card-clickable {
    cursor: pointer;
}
.vessel-card-clickable:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Vessel card top accent bar based on connection status */
.vessel-card .vc-status-bar {
    height: 4px;
    width: 100%;
    background: #94a3b8;
    transition: background 0.3s;
}
.vessel-card .vc-status-bar.status-online { background: linear-gradient(90deg, #22c55e, #10b981); }
.vessel-card .vc-status-bar.status-stale { background: linear-gradient(90deg, #f59e0b, #eab308); }
.vessel-card .vc-status-bar.status-offline { background: linear-gradient(90deg, #ef4444, #dc2626); }
.vessel-card .vc-status-bar.status-never-synced { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }

.vc-card-body {
    padding: 1.25rem;
}

.vc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.vc-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.vc-vessel-type {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
}

.vc-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 1rem;
    margin-bottom: 0.75rem;
}
.vc-detail {
    font-size: 0.8rem;
    padding: 0.2rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.vc-label { font-weight: 600; color: var(--text-primary); }
.vc-detail-icon { font-size: 0.85rem; opacity: 0.7; }

.vc-voucher-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc, #f0f9ff);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e0f2fe;
}
.vc-vs {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.vc-vs-val {
    font-size: 1.15rem;
    font-weight: 700;
    display: block;
    color: var(--text-primary);
}
.vc-green { color: var(--success-color) !important; }
.vc-blue { color: var(--primary-color) !important; }
.vc-orange { color: var(--warning-color) !important; }

.vc-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}
.vc-actions .btn {
    flex: 1;
    min-width: auto;
    text-align: center;
    white-space: nowrap;
}

/* Profiles bar on vessel card */
.vc-profiles-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0;
    font-size: 0.75rem;
    flex-wrap: wrap;
}
.vc-profiles-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 0.15rem;
}

/* Pending vouchers sync bar */
.vc-pending-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    margin-bottom: 0.5rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: #92400e;
}
.vc-pending-icon { font-size: 0.85rem; }
.vc-pending-text { flex: 1; font-weight: 500; }
.btn-sync {
    background: #f59e0b !important;
    color: #fff !important;
    border: none;
    font-size: 0.68rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sync:hover { background: #d97706 !important; }

/* Router Sync Status Badges */
.router-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 1rem;
    letter-spacing: 0.02em;
}
.router-online { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.router-stale { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.router-offline { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.router-never-synced { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.vc-sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    gap: 0.75rem;
}

.vc-sync-detail { font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; }

.vc-router-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: #f0f9ff;
    border-radius: 0.5rem;
    border: 1px solid #bae6fd;
}
.vc-router-info-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.vc-router-info-label { font-weight: 600; color: var(--text-primary); }

/* WAN usage bar on vessel cards */
.vc-wan-bar {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-radius: 0.5rem;
    border: 1px solid #fde68a;
    font-size: 0.72rem;
    align-items: center;
    flex-wrap: wrap;
}
.vc-wan-item { display: flex; align-items: center; gap: 0.25rem; }
.vc-wan-label { color: var(--text-secondary); }
.vc-wan-bar strong { color: var(--text-primary); }
.vc-warn { color: #dc2626 !important; }

/* WAN section in vessel detail modal */
.vd-wan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
    margin-bottom: 0.75rem;
}
.vd-wan-box {
    background: var(--bg-secondary);
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
}
.vd-wan-val { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.vd-wan-lbl { display: block; font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.2rem; }
.vd-wan-warn { color: #dc2626 !important; }
.vd-wan-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.vd-wan-progress {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.vd-wan-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.vd-wan-pct { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

/* Overview card sync enhancements */
.vo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.vo-header h3 { margin: 0; font-size: 1rem; }

.vo-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.vo-stat strong { color: var(--text-primary); }

.vo-sync-info {
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.6rem;
    margin-top: 0.3rem;
    background: #f0f9ff;
    border-radius: 0.35rem;
    border: 1px solid #e0f2fe;
}
.vo-wan-info {
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.6rem;
    margin-top: 0.3rem;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-radius: 0.35rem;
    border: 1px solid #fde68a;
}
.vo-sync-warning {
    font-size: 0.72rem;
    color: #b45309;
    background: #fffbeb;
    padding: 0.35rem 0.6rem;
    border-radius: 0.35rem;
    margin-top: 0.4rem;
    border: 1px solid #fde68a;
}

/* Vessel Detail Modal Styles */
.vd-section {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
}
.vd-section h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.vd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.vd-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.vd-item strong { color: var(--text-primary); }
.vd-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    text-align: center;
}
.vd-stat-box {
    background: #fff;
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}
.vd-stat-box .val {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.1rem;
}
.vd-stat-box .lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.vd-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.vd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.vd-section-header h4 {
    margin-bottom: 0;
}
.vd-vouchers-wrap {
    overflow-x: auto;
}
.vd-vouchers-table {
    min-width: 640px;
}
.vd-vouchers-table th,
.vd-vouchers-table td {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Sync Key Modal */
.sync-key-display {
    background: #1e293b;
    color: #10b981;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.1em;
    margin: 1rem 0;
    word-break: break-all;
    user-select: all;
    cursor: text;
}
.sync-key-steps {
    margin: 1rem 0 0;
}
.sync-key-steps ol {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}
.sync-key-steps li {
    font-size: 0.85rem;
    padding: 0.35rem 0;
    color: var(--text-secondary);
}
.sync-key-steps li strong { color: var(--text-primary); }
.sync-key-steps code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

/* Data Table */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    table-layout: fixed;
}
.data-table th, .data-table td {
    padding: 0.45rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table th {
    white-space: nowrap;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 2px solid var(--border-medium, #cbd5e1);
}
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: #f1f5f9; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:nth-child(even):hover { background: #f1f5f9; }

.voucher-code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.76rem;
    font-weight: 600;
    background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    letter-spacing: 0.02em;
    border: 1px solid #dce3f0;
    color: #1e3a5f;
}

.empty-cell { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* Usage Cell (merged Quota + Used + Remaining) */
.usage-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.usage-text {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.2rem;
}
.usage-value {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
}
.usage-sep { color: var(--text-muted); font-weight: 400; }
.usage-pct {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    background: #f1f5f9;
    padding: 0.05rem 0.3rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.usage-pct-danger { color: #dc2626; background: #fef2f2; }
.usage-remaining {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}
.usage-remaining.remaining-low { color: #ef4444; font-weight: 600; }

/* Progress Mini */
.progress-mini {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-mini {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.progress-bar-mini.success { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-bar-mini.warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-bar-mini.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* Legacy remaining classes (for compatibility) */
.remaining-text { font-size: 0.8rem; color: var(--text-secondary); }
.remaining-value { font-weight: 500; }
.remaining-value.remaining-low { color: #ef4444; font-weight: 600; }

/* Bulk Action Bar */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    border: 1px solid #93c5fd;
    border-radius: 0.6rem;
    flex-wrap: wrap;
}
.bulk-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.bulk-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e40af;
    white-space: nowrap;
}
.bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
}
.bulk-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.bulk-checkbox-col {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: center;
    padding-left: 0.5rem !important;
    padding-right: 0.3rem !important;
}
.bulk-checkbox-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}
.bulk-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}
tr.bulk-selected {
    background: rgba(59, 130, 246, 0.08) !important;
}
tr.bulk-selected:hover {
    background: rgba(59, 130, 246, 0.12) !important;
}

/* Voucher Stats Row */
.voucher-stats-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    padding-bottom: 0.25rem;
}

.voucher-stat-card {
    flex: 1 0 200px;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 0.6rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.voucher-stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.voucher-stat-card h4 { margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--text-primary); }
.vs-row { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; font-size: 0.85rem; }
.vs-row span { color: var(--text-secondary); }
.vs-row strong { color: var(--text-primary); }
.vs-usage { font-size: 0.8rem; color: var(--text-secondary); }

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 0.4rem;
    font-size: 0.85rem;
}
.activity-code { font-family: monospace; font-weight: 600; }
.activity-vessel { color: var(--text-secondary); }
.activity-usage { flex: 1; text-align: right; color: var(--text-secondary); }
.activity-date { font-size: 0.75rem; color: var(--text-muted); min-width: 60px; text-align: right; }

/* Config Section */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.25rem;
}

/* Reference Sub-Tabs */
.ref-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ref-tab {
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--border-light);
    border-radius: 99px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.ref-tab:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}
.ref-tab.active {
    background: var(--primary-color, #1e3a5f);
    color: #fff;
    border-color: var(--primary-color, #1e3a5f);
}
.ref-panel { display: none; }
.ref-panel.active { display: block; }

.config-details { margin: 1rem 0; }
.config-item {
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-secondary);
}
.config-item strong { color: var(--text-primary); }
.config-actions { margin-top: 1rem; }

.config-form .form-group { margin-bottom: 1rem; }
.config-form label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; }

.architecture-diagram { margin-top: 1rem; }
.diagram {
    background: #1e293b;
    color: #10b981;
    padding: 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.72rem;
    line-height: 1.5;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
}

.command-list { margin-top: 1rem; }
.command-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}
.cmd-label { display: block; font-weight: 500; margin-bottom: 0.2rem; color: var(--text-secondary); }
.command-item code {
    display: block;
    background: #1e293b;
    color: #10b981;
    padding: 0.4rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    overflow-x: auto;
}

/* Generated Codes */
.generated-codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0;
}
.gen-code {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    background: #f0fdf4;
    color: #166534;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
    border: 1px solid #bbf7d0;
    letter-spacing: 0.05em;
}

/* Warning Box */
.warning-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #92400e;
}

/* Result Summary */
.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.result-item {
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 0.35rem;
    font-size: 0.85rem;
}

/* Action Cell */
.action-cell {
    white-space: nowrap;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

/* Button Extra Sizes */
.btn-xs {
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    border-radius: 0.3rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

/* Icon-only compact action buttons */
.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    border-radius: 0.35rem;
    line-height: 1;
}
.btn-icon:hover { transform: scale(1.1); }

.btn-outline-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}
.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* Badge Extra */
.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
}

/* Form Rows */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* Modal Footer Override for generated codes */
.modal-footer {
    flex-direction: column;
    align-items: stretch;
}
.modal-footer h3 { margin: 0 0 0.5rem; font-size: 1rem; }

/* Modal Overlay Enhancement */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
.modal.active { display: flex; }
.modal-content {
    background: #fff;
    border-radius: 1rem;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    animation: modalSlideUp 0.3s ease;
}
.modal-content.modal-lg { max-width: 680px; }

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 1rem 1rem 0 0;
    z-index: 1;
}
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 1rem 1rem;
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 350px;
}

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}
.notification button {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    color: inherit;
}
.notification-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.notification-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notification-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.notification-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

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

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 1rem 0;
    font-size: 0.8rem;
    margin-left: 220px;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}
@media (max-width: 991px) {
    .footer { margin-left: 0; }
}
.footer .brand-link { color: #90cdf4; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}
.empty-state h3 { color: var(--text-secondary); }
.empty-state a { color: var(--primary-color); cursor: pointer; }

/* Voucher Row Status */
.voucher-row.status-exhausted { background: #fffbeb; }
.voucher-row.status-revoked { background: #fef2f2; opacity: 0.7; }
.voucher-row.status-expired_port_call { opacity: 0.5; }

/* ═══════════════════════════════════════════
   RESPONSIVE: TABLET (max-width: 991px)
   ═══════════════════════════════════════════ */
@media (max-width: 991px) {
    .sidebar-toggle { display: block; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); z-index: 200; }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; padding: 1.25rem; }
    .footer { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════
   RESPONSIVE: MOBILE (max-width: 768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Header */
    .header { height: auto; min-height: 56px; overflow: hidden; }
    .header-content { gap: 0.5rem; min-width: 0; }
    .header-actions { gap: 0.35rem; min-width: 0; }
    .app-subtitle { display: none; }
    .starlink-badge { display: none; }
    .header-divider { display: none; }
    .header-brand-text { display: none; }
    .connection-status { display: none; }
    .logo-mark { width: 32px; height: 32px; font-size: 1rem; }
    .dashboard-layout { margin-top: 56px; min-height: calc(100vh - 56px); }
    .sidebar { top: 56px; }
    .sidebar-overlay { top: 56px; }

    /* Main layout */
    .main-content { padding: 0.75rem; }
    .section-card { padding: 0.75rem; margin-bottom: 0.75rem; border-radius: 0.5rem; }
    .section-header { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .section-header h2 { font-size: 1rem; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .stat-card { padding: 0.75rem; }
    .stat-value { font-size: 1.25rem; }
    .stat-icon { font-size: 1.5rem; }

    /* Grids */
    .vessels-overview-grid { grid-template-columns: 1fr; }
    .vessels-grid { grid-template-columns: 1fr; }
    .config-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* Toolbar */
    .panel-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.6rem;
        gap: 0.5rem;
    }
    .toolbar-left, .toolbar-right { width: 100%; }
    .toolbar-left { gap: 0.35rem; }
    .toolbar-left .form-control { min-width: 0; flex: 1; font-size: 0.78rem; padding: 0.35rem 0.5rem; }
    .toolbar-right { flex-wrap: wrap; gap: 0.35rem; }
    .toolbar-right .btn { flex: 1; min-width: 0; font-size: 0.75rem; padding: 0.35rem 0.5rem; justify-content: center; }

    /* Voucher Stats Row */
    .voucher-stats-row { flex-direction: column; gap: 0.5rem; }
    .voucher-stat-card { min-width: 0; padding: 0.75rem; }

    /* Voucher Table - Card Layout on Mobile */
    .table-responsive { overflow-x: visible; }
    .data-table:not(.daily-table) thead { display: none; }
    .data-table:not(.daily-table) tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem 0.75rem;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        border: 1px solid var(--border-light);
        border-radius: 0.5rem;
        background: #fff;
        position: relative;
    }
    .data-table:not(.daily-table) tbody tr:nth-child(even) { background: #fafbfc; }
    .data-table:not(.daily-table) td {
        padding: 0.2rem 0;
        border-bottom: none;
        white-space: normal;
        font-size: 0.82rem;
    }
    .data-table:not(.daily-table) td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 0.15rem;
    }
    /* Code cell spans full width (first visible cell, or second child when checkbox present) */
    .data-table:not(.daily-table) tbody tr td[data-label="Code"] {
        grid-column: 1 / -1;
        border-bottom: 1px solid var(--border-light);
        padding-bottom: 0.5rem;
        margin-bottom: 0.15rem;
    }
    /* Usage cell spans full width for progress bar */
    .data-table:not(.daily-table) tbody tr td[data-label="Usage"] {
        grid-column: 1 / -1;
    }
    /* Action cell spans full width */
    .data-table:not(.daily-table) tbody tr td:last-child {
        grid-column: 1 / -1;
        border-top: 1px solid var(--border-light);
        padding-top: 0.5rem;
        margin-top: 0.15rem;
    }
    .action-cell { flex-wrap: wrap; justify-content: flex-start; }
    .usage-cell { min-width: 0; }

    /* Bulk action bar mobile */
    .bulk-action-bar {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    .bulk-bar-actions { flex-wrap: wrap; gap: 0.25rem; }
    .bulk-bar-actions .btn { font-size: 0.72rem; padding: 0.25rem 0.5rem; }

    /* Checkbox in card layout: position top-right */
    .data-table:not(.daily-table) td.bulk-checkbox-col {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        width: auto;
        min-width: auto;
        max-width: none;
        padding: 0 !important;
        grid-column: auto;
        border: none !important;
    }
    .data-table:not(.daily-table) td.bulk-checkbox-col::before {
        display: none;
    }
    /* Daily table keeps traditional layout with horizontal scroll */
    .daily-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Vessel Cards */
    .vc-details { grid-template-columns: 1fr; }
    .vc-voucher-summary { grid-template-columns: repeat(2, 1fr); }
    .vd-grid { grid-template-columns: 1fr; }
    .vd-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .vd-wan-grid { grid-template-columns: repeat(3, 1fr); }
    .vc-actions { flex-direction: row; flex-wrap: wrap; }
    .vc-actions .btn { flex: none; }
    .vessel-card .vc-card-body { padding: 0.75rem; }

    /* Modal */
    .modal-content { max-width: 95vw; margin: 0.5rem; border-radius: 0.75rem; }
    .modal-header { border-radius: 0.75rem 0.75rem 0 0; padding: 1rem; }
    .modal-body { padding: 1rem; }
    .modal-footer { border-radius: 0 0 0.75rem 0.75rem; }

    /* Activity */
    .activity-item { flex-wrap: wrap; }
    .recent-item { flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; }

    /* Daily Usage Panel */
    .daily-usage-panel .section-header { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .daily-controls { flex-wrap: wrap; }
    .daily-controls .form-control { flex: 1; min-width: 100px; }
    .daily-summary-grid { grid-template-columns: 1fr; }
    .dvc-bars { height: 80px; }
    .dvc-bar-label { font-size: 0.55rem; }
    /* Daily table compact on mobile */
    .daily-table { font-size: 0.72rem; }
    .daily-table th.daily-col, .daily-table td.daily-col { min-width: 45px; padding: 0.3rem 0.2rem; font-size: 0.65rem; }
    .daily-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -0.75rem; padding: 0 0.75rem; }

    /* Overview breakdown */
    .vo-voucher-row { flex-wrap: wrap; gap: 0.35rem; }
    .vo-vr-info { min-width: 80px; flex-shrink: 0; }
    .vo-vr-bar-wrap { min-width: 100px; }
    .vo-stats { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
    .vo-header { flex-wrap: wrap; gap: 0.35rem; }
    .vo-header h3 { font-size: 0.92rem; }
    .vessel-overview-card { padding: 0.75rem; }
    .vessels-overview-grid { gap: 0.75rem; }

    /* Recent activity */
    .recent-item { flex-direction: row; flex-wrap: wrap; gap: 0.35rem; font-size: 0.78rem; }
    .recent-item > div { width: 100%; }

    /* Analytics toolbar stacking */
    #panel-analytics .toolbar-right { flex-direction: column; }
    #panel-analytics .toolbar-right .form-control,
    #panel-analytics .toolbar-right .btn { width: 100%; }
    #analytics-summary { grid-template-columns: 1fr 1fr; }

    /* Users table: username spans full width */
    #users-table tbody tr td[data-label="Username"] { grid-column: 1 / -1; border-bottom: 1px solid var(--border-light); padding-bottom: 0.5rem; }
    #users-table tbody tr td[data-label="Assigned Sites"] { grid-column: 1 / -1; }

    /* Port-calls table: site spans full width */
    #port-calls-table tbody tr td[data-label="Site"] { grid-column: 1 / -1; border-bottom: 1px solid var(--border-light); padding-bottom: 0.5rem; }

    /* Top consumers: code spans full width */
    #top-consumers-table tbody tr td[data-label="Code"] { grid-column: 1 / -1; border-bottom: 1px solid var(--border-light); padding-bottom: 0.5rem; }
    #top-consumers-table tbody tr td[data-label="Usage %"] { grid-column: 1 / -1; }

    /* Consumption tab toolbar */
    #panel-consumption .toolbar-right { flex-direction: row; flex-wrap: wrap; }
    #panel-consumption .toolbar-right .form-control { flex: 1; min-width: 100px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE: SMALL MOBILE (max-width: 480px)
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.35rem; }
    .stat-card { padding: 0.5rem; }
    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: 0.7rem; }
    .stat-icon { font-size: 1.25rem; }
    .app-title { font-size: 1rem; }
    .user-name { display: none; }
    .chevron { display: none; }
    .main-content { padding: 0.5rem; }
    .section-card { padding: 0.5rem; }
    .header { height: auto; min-height: 48px; }
    .dashboard-layout { margin-top: 48px; min-height: calc(100vh - 48px); }
    .sidebar { top: 48px; }
    .sidebar-overlay { top: 48px; }
    .logo-mark { width: 28px; height: 28px; font-size: 0.85rem; border-radius: 6px; }
    .header-inner { padding: 0 0.75rem; }

    /* Toolbar stacks fully */
    .toolbar-right .btn .icon { display: none; }
    .voucher-code { font-size: 0.75rem; padding: 0.15rem 0.35rem; }
    .badge-sm { font-size: 0.58rem; }

    /* Daily chart compact */
    .dvc-bars { height: 60px; }
    .dvc-bar-value { font-size: 0.5rem; }
    .dvc-bar-track { height: 45px; }
}

/* ================================================
   LOGIN SCREEN
   ================================================ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 50%, #1a365d 100%);
    padding: 1rem;
}
.login-container {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-logo svg {
    filter: drop-shadow(0 4px 12px rgba(0, 212, 170, 0.3));
}
.login-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e3a5f;
}
.login-header p {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
}
.login-brand {
    margin-top: 0.65rem;
}
.login-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--ideskr-primary, #00d4aa);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-shadow: 0 0 8px rgba(0, 212, 170, 0.2);
}
.login-brand-link:hover {
    color: var(--ideskr-secondary, #667eea);
    text-shadow: 0 0 12px rgba(102, 126, 234, 0.3);
}
.login-brand-icon {
    font-size: 0.55rem;
    color: var(--ideskr-primary, #00d4aa);
    filter: drop-shadow(0 0 3px rgba(0, 212, 170, 0.4));
}
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper .form-control {
    padding-right: 2.75rem;
}
.password-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}
.password-toggle:hover {
    color: #1e3a5f;
}
.login-form .form-group {
    margin-bottom: 1rem;
}
.login-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
}
.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
}
.btn-block {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}
.setup-section {
    margin-top: 1rem;
}
.setup-section h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
    color: #1e3a5f;
}
.setup-section p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 1rem;
}

/* ================================================
   USER MENU (header dropdown)
   ================================================ */
.user-menu {
    position: relative;
}
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 2rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    cursor: pointer;
    color: #fff;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.user-menu-btn:hover {
    background: rgba(255,255,255,0.25);
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.chevron { font-size: 0.65rem; opacity: 0.7; }
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 200px;
    z-index: 200;
    overflow: hidden;
}
.user-dropdown.show { display: block; }
.dropdown-header {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dropdown-header strong { color: #1e3a5f; font-size: 0.85rem; }
.dropdown-divider { height: 1px; background: #e2e8f0; }
.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    color: #374151;
    transition: background 0.2s;
}
.dropdown-item:hover { background: #f1f5f9; }

/* ================================================
   ANALYTICS
   ================================================ */
.vessel-usage-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.vessel-usage-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
}
.vuc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.vuc-header h4 { margin: 0; font-size: 0.95rem; }
.vuc-bar { margin-bottom: 0.75rem; }
.vuc-label { font-size: 0.8rem; color: #64748b; margin-top: 0.35rem; display: block; }
.vuc-details {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #64748b;
}
.analytics-period-label {
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #93c5fd;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e40af;
    text-align: center;
}
.vuc-wan-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-radius: 0.35rem;
    border: 1px solid #fde68a;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.vuc-wan-summary strong { color: var(--text-primary); }
.progress-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.progress-fill.progress-success { background: #22c55e; }
.progress-fill.progress-warning { background: #f59e0b; }
.progress-fill.progress-danger { background: #ef4444; }

.status-distribution { margin-top: 0.5rem; }
.status-bars { display: grid; gap: 0.75rem; }
.status-bar-item {}
.sb-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

/* ================================================
   USER MANAGEMENT
   ================================================ */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 0.25rem;
}
.checkbox-label:hover { background: #e2e8f0; }
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.tag {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin: 0.1rem;
}
.modal-lg {
    max-width: 650px;
}
.text-muted { color: #94a3b8; }
.text-green { color: #22c55e; }
.text-blue { color: #3b82f6; }

/* Recent Activity */
.recent-list { display: grid; gap: 0.5rem; }
.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

/* ─── Editable Assigned-To Field ──── */
.assigned-to-cell {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 100px;
}
.assigned-to-text {
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 0.85rem;
    min-width: 20px;
    display: inline-block;
}
.assigned-to-text:hover {
    border-color: var(--border-medium);
    background: #f8fafc;
}
.assigned-to-text.placeholder {
    color: var(--text-muted);
    font-style: italic;
}
.assigned-to-edit {
    display: none;
    align-items: center;
    gap: 0.25rem;
}
.assigned-to-edit input {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    border: 1px solid var(--primary-color);
    border-radius: 0.25rem;
    width: 120px;
    outline: none;
}
.assigned-to-edit .btn-save-assigned {
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    background: var(--success-color);
    color: #fff;
    border: none;
    border-radius: 0.2rem;
    cursor: pointer;
}
.assigned-to-edit .btn-cancel-assigned {
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 0.2rem;
    cursor: pointer;
}

/* ─── Router-synced voucher rows ──── */
.voucher-row-router { background: rgba(59, 130, 246, 0.03); }
.voucher-row-router:hover { background: rgba(59, 130, 246, 0.08) !important; }
.badge-sm { font-size: 0.62rem; padding: 0.12rem 0.4rem; margin-left: 0.35rem; vertical-align: middle; border-radius: 0.25rem; font-weight: 500; letter-spacing: 0.02em; }

/* ─── Overview: Per-vessel voucher breakdown ──── */
.vo-voucher-breakdown { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-light); }
.vo-breakdown-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 600; }
.vo-voucher-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.vo-vr-info { display: flex; align-items: center; gap: 0.35rem; min-width: 140px; }
.vo-vr-code { font-family: 'Courier New', monospace; font-size: 0.75rem; font-weight: 600; color: var(--text-primary); letter-spacing: 0.03em; }
.vo-vr-assigned { font-size: 0.7rem; color: var(--text-muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vo-vr-bar-wrap { flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.vo-vr-bar-wrap .progress-mini { flex: 1; }
.vo-vr-usage { font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; min-width: 70px; text-align: right; }
.vo-more-link { font-size: 0.75rem; color: var(--primary-color); cursor: pointer; margin-top: 0.35rem; text-align: center; }
.vo-more-link:hover { text-decoration: underline; }

/* ─── Daily Usage Panel ──── */
.daily-usage-panel { margin-top: 0; }
.daily-usage-panel .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.daily-usage-panel .section-header h2 { margin: 0; font-size: 1.1rem; }
.daily-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.daily-controls .form-control { font-size: 0.82rem; padding: 0.35rem 0.6rem; border-radius: 0.4rem; min-width: 120px; }

/* Vessel Daily Summary - Bar Chart */
.daily-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.daily-vessel-card {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: 0.6rem;
    padding: 1rem;
}
.dvc-header { margin-bottom: 0.75rem; }
.dvc-header h4 { margin: 0; font-size: 0.95rem; }
.dvc-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 100px;
    padding: 0 0.25rem;
}
.dvc-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}
.dvc-bar-value {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 600;
    height: 14px;
    line-height: 14px;
    white-space: nowrap;
}
.dvc-bar-track {
    width: 100%;
    max-width: 28px;
    height: 70px;
    background: #e2e8f0;
    border-radius: 3px 3px 0 0;
    position: relative;
    display: flex;
    align-items: flex-end;
}
.dvc-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease;
    min-height: 1px;
    position: relative;
    z-index: 2;
}
.dvc-wan-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    border-radius: 3px 3px 0 0;
    background: rgba(251, 191, 36, 0.25);
    border: 1px solid #fbbf24;
    border-bottom: none;
    z-index: 1;
    box-sizing: border-box;
}
.dvc-bar-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    transform: rotate(-35deg);
    transform-origin: center;
    margin-top: 2px;
}
.dvc-total {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

/* Daily Voucher Table */
.daily-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.daily-table { font-size: 0.8rem; }
.daily-table th.daily-col, .daily-table td.daily-col {
    text-align: center;
    min-width: 55px;
    padding: 0.4rem 0.3rem;
    font-size: 0.75rem;
}
.daily-high { background: rgba(239, 68, 68, 0.1); color: #dc2626; font-weight: 600; }
.daily-med { background: rgba(245, 158, 11, 0.08); color: #d97706; font-weight: 500; }
.daily-low { color: var(--text-secondary); }
.daily-zero { color: var(--text-muted); }
.daily-totals-row {
    background: linear-gradient(180deg, #f0f4ff, #e8f0fe) !important;
    font-weight: 600;
}
.daily-totals-row:hover { background: linear-gradient(180deg, #e8f0fe, #dce3f0) !important; }

/* ═══ Pagination ═══ */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: 1px solid var(--border-light);
    font-size: 0.82rem;
}
.pg-info { color: var(--text-secondary); white-space: nowrap; }
.pg-controls { display: flex; align-items: center; gap: 2px; }
.pg-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all 0.15s;
}
.pg-btn:hover:not([disabled]):not(.pg-active) { background: var(--bg-hover); border-color: var(--primary); }
.pg-btn.pg-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.pg-ellipsis { padding: 0.3rem 0.3rem; color: var(--text-muted); }
.pg-size { display: flex; align-items: center; gap: 0.4rem; }
.pg-size label { color: var(--text-secondary); font-size: 0.8rem; }
.pg-size select { padding: 0.25rem 0.4rem; border: 1px solid var(--border-light); border-radius: var(--radius); font-size: 0.8rem; background: var(--bg-card); }
@media (max-width: 576px) {
    .pagination-bar { flex-direction: column; align-items: stretch; text-align: center; }
    .pg-controls { justify-content: center; flex-wrap: wrap; }
    .pg-size { justify-content: center; }
}
