/* ═══════════════════════════════════════════════
   Geofence Notify — Stylesheet v2
   ═══════════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #22c55e;
    --success-light: #dcfce7;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.view { min-height: 100vh; }
[hidden] { display: none !important; }

.portal-shell {
    min-height: 100vh;
    display: block;
}

.portal-main {
    min-width: 0;
    margin-left: 64px;
    overflow-x: hidden;
}

.sidebar {
    background: #0f172a;
    color: #cbd5e1;
    border-right: 1px solid #1e293b;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    overflow: hidden;
    transition: width var(--transition), box-shadow var(--transition);
    z-index: 120;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.open {
    width: 240px;
    box-shadow: var(--shadow-lg);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar:hover .sidebar-top,
.sidebar:focus-within .sidebar-top,
.sidebar.open .sidebar-top {
    justify-content: flex-start;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    width: 100%;
    border: none;
    background: transparent;
    color: #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-align: left;
    justify-content: center;
}

.sidebar:hover .sidebar-link,
.sidebar:focus-within .sidebar-link,
.sidebar.open .sidebar-link {
    justify-content: flex-start;
}

.sidebar-link:hover {
    background: #1e293b;
    color: #fff;
}

.sidebar-link.active {
    background: #334155;
    color: #fff;
}

.role-badge-btn {
    border: none;
    cursor: pointer;
}

.role-badge-btn:hover {
    filter: brightness(0.92);
}

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

.sidebar:hover .sidebar-label,
.sidebar:focus-within .sidebar-label,
.sidebar.open .sidebar-label {
    display: inline;
}

.header-inline-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modules-head {
    padding: 24px 32px 12px;
}

.modules-head h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.modules-head p {
    color: var(--text-secondary);
}

.modules-grid {
    padding: 0 32px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.module-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    color: inherit;
}

.module-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.module-card-main h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.module-card-main p {
    font-size: 13px;
    color: var(--text-secondary);
}

.users-table-wrap {
    margin: 0 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

.users-table td,
.users-table th {
    white-space: nowrap;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

/* ─── SVG Icons ──────────────────────────────── */
.icon {
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.icon-xs  { width: 14px; height: 14px; }
.icon-sm  { width: 16px; height: 16px; }
.icon-md  { width: 24px; height: 24px; }
.icon-lg  { width: 28px; height: 28px; }
.icon-xl  { width: 48px; height: 48px; }
.icon-xxl { width: 64px; height: 64px; }

/* ─── Buttons ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--border); color: var(--text); }
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: var(--text-muted); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* Spinning animation for refresh */
.btn .icon.spinning {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─── Badges ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.badge-success {
    background: var(--success-light);
    color: #166534;
}
.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}
.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}
.badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}
.badge-success .dot { background: var(--success); }
.badge-danger .dot { background: var(--danger); animation: none; }

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

/* ─── Forms ──────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition);
    outline: none;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.delivery-mode-switch {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.delivery-mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

.delivery-mode-option input {
    flex-shrink: 0;
}

.delivery-mode-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

#manual-target-settings {
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

/* ─── Client tree (multi-vehicle) ────────────── */
.client-tree-wrap, .client-list-wrap {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    margin-bottom: 8px;
}
.client-tree-node {
    border-bottom: 1px solid var(--border);
}
.client-tree-node:last-child { border-bottom: none; }
.client-tree-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92em;
    background: #f8fafc;
    user-select: none;
}
.client-tree-header:hover { background: var(--primary-light); }
.client-tree-header .tree-chevron {
    transition: transform 0.15s;
    flex-shrink: 0;
    color: var(--text-muted);
}
.client-tree-header.open .tree-chevron { transform: rotate(90deg); }
.client-tree-vehicles {
    display: none;
    padding: 0 12px 4px 32px;
}
.client-tree-vehicles.open { display: block; }
.client-tree-vehicle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.88em;
    color: var(--text-secondary);
}
.client-tree-vehicle input[type="checkbox"] { flex-shrink: 0; }
.multi-vehicle-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--success);
    padding: 6px 0;
}
.vm-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78em;
    padding: 2px 10px;
    border-radius: 12px;
    margin: 4px 16px 0;
    font-weight: 500;
}
.vm-badge.vm-multi { background: #e8f0fe; color: #1a73e8; }
.vm-badge.vm-all { background: #e6f4ea; color: #137333; }

/* Client-all list */
.client-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    font-size: 0.92em;
}
.client-item:last-child { border-bottom: none; }
.client-item:hover { background: var(--primary-light); }
.client-item.selected { background: var(--primary-light); border-color: var(--primary); }
.client-item-count { color: var(--text-muted); font-size: 0.85em; }

/* ─── Manual targets (multi-recipient) ───────── */
.manual-targets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.manual-target-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 8px;
    background: var(--surface);
    position: relative;
}
.manual-target-entry .target-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 2px;
}
.manual-target-entry .form-group { margin-bottom: 8px; }
.manual-target-entry .form-group:last-child { margin-bottom: 0; }
.target-group-list-wrap {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 4px;
}

/* ─── Autocomplete ───────────────────────────── */
.autocomplete-wrap {
    position: relative;
}
.autocomplete-wrap .autocomplete-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.autocomplete-wrap input {
    padding-left: 36px !important;
}
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-md);
}
.autocomplete-item {
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background var(--transition);
}
.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--primary-light);
}
.autocomplete-item .ac-vehicle {
    font-weight: 600;
    color: var(--text);
}
.autocomplete-item .ac-client {
    font-size: 12px;
    color: var(--text-muted);
}
.autocomplete-item + .autocomplete-item {
    border-top: 1px solid var(--border);
}

/* Vehicle info preview */
.vehicle-info {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-left: 3px solid var(--primary);
}
.vi-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
}
.vi-row + .vi-row { margin-top: 4px; }
.vi-label {
    color: var(--text-muted);
    flex-shrink: 0;
}
.vi-value {
    color: var(--text);
    font-weight: 500;
}
.vi-mono {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* ─── Test mode toggle button ────────────────── */
.test-mode-toggle {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all var(--transition);
    user-select: none;
}
.test-mode-toggle:hover {
    filter: brightness(0.92);
    transform: scale(1.03);
}

.test-mode-panel {
    margin: 0 32px 20px;
    padding: 16px 18px;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.test-mode-panel-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.test-mode-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #991b1b;
    font-weight: 700;
}
.test-mode-panel-target {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.test-mode-target-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.test-mode-target-id {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #7f1d1d;
    word-break: break-all;
}
.test-mode-panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Test mode warning in create modal ──────── */
.test-mode-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--danger-light);
    border: 2px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--danger);
    animation: test-pulse 1.5s ease-in-out infinite;
}
.test-mode-warning strong {
    font-size: 14px;
    letter-spacing: 1px;
}
.test-mode-warning p {
    font-size: 13px;
    margin-top: 2px;
    color: #991b1b;
}

/* ─── Test banner per notification card ──────── */
.card-test-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--danger-light);
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    color: #991b1b;
    animation: test-pulse 1.5s ease-in-out infinite;
}
.card-test-banner strong {
    color: var(--danger);
    letter-spacing: 0.5px;
}
.card-test-banner em {
    font-style: normal;
    font-weight: 600;
    word-break: break-all;
}
.card-test-banner-id {
    display: block;
    margin-top: 2px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #7f1d1d;
}

.test-group-copy {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

@keyframes test-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    border-left: 4px solid var(--text-muted);
}
.toast.toast-success { border-left-color: var(--success); color: #166534; }
.toast.toast-error   { border-left-color: var(--danger);  color: var(--danger); }
.toast.toast-info    { border-left-color: var(--primary); color: var(--primary); }
.toast.toast-warning { border-left-color: var(--warning); color: #92400e; }
.toast.removing {
    animation: toast-out 0.3s ease forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ═══════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════ */

#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: var(--surface);
    padding: 48px 40px 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-logo {
    margin-bottom: 8px;
    color: var(--primary);
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}
.login-card .form-group { text-align: left; }
.login-card .btn { margin-top: 8px; padding: 12px; font-size: 15px; }

/* ═══════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-icon { color: var(--primary); }
.header-title {
    font-size: 20px;
    font-weight: 700;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerts-wrap {
    position: relative;
}

.bell-btn {
    position: relative;
}

.bell-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.alerts-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(440px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 80;
    overflow: hidden;
}

.alerts-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.alerts-panel-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.alerts-list {
    max-height: 360px;
    overflow-y: auto;
}

.alert-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item.unread {
    background: #fff8e8;
}

.alert-icon {
    color: var(--danger);
    margin-top: 2px;
}

.alert-main {
    flex: 1;
    min-width: 0;
}

.alert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.alert-source {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.alert-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.alert-message {
    font-size: 13px;
    color: var(--text);
    word-break: break-word;
}

.alert-read-btn {
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   STATS BAR
   ═══════════════════════════════════════════════ */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 24px 32px 0;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    color: var(--primary);
    opacity: 0.7;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   TOOLBAR
   ═══════════════════════════════════════════════ */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-title {
    font-size: 18px;
    font-weight: 700;
}
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ═══════════════════════════════════════════════
   NOTIFICATION CARDS
   ═══════════════════════════════════════════════ */

.notifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding: 0 32px 32px;
}

.notif-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.notif-card:hover { box-shadow: var(--shadow-md); }
.notif-card.disabled { opacity: 0.55; }

.notif-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.notif-vehicle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}
.notif-status {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.notif-status.active {
    background: var(--success-light);
    color: #166534;
}
.notif-status.inactive {
    background: #f1f5f9;
    color: var(--text-muted);
}

.notif-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}
.notif-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notif-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.notif-stat {
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.notif-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.notif-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notif-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}
.notif-actions .btn { flex: 1; justify-content: center; }

/* ─── Empty state ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
}
.empty-icon { color: var(--text-muted); margin-bottom: 12px; }
.empty-state p { font-size: 16px; }
.empty-hint {
    font-size: 14px !important;
    color: var(--text-muted) !important;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
}
.modal-wide { max-width: 640px; }
.modal-sm { max-width: 400px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}
.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}
.confirm-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ─── Logs table ─────────────────────────────── */
.logs-content {
    max-height: 60vh;
    overflow-y: auto;
}
.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.logs-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}
.logs-table td {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    vertical-align: top;
}
.log-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.log-status.success { background: var(--success-light); color: #166534; }
.log-status.error { background: var(--danger-light); color: var(--danger); }

.logs-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   WA GROUP PICKER (test group modal)
   ═══════════════════════════════════════════════ */

.wa-groups-wrap {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.wa-groups-hint {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-groups-hint--error {
    color: var(--danger);
    display: block;
}

.wa-group-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.wa-group-item:last-child { border-bottom: none; }

.wa-group-item:hover { background: var(--primary-light); }

.wa-group-item.selected {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    padding-left: 11px;
}

.wa-group-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.wa-group-id-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', Courier, monospace;
    margin-top: 2px;
}

.wa-selected-display {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--success-light);
    border: 1.5px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
}

.wa-selected-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.wa-selected-id {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   SVETOFOR IFRAME MODULE
   ═══════════════════════════════════════════════ */

/* Remove default padding for iframe sections so the frame fills the space */
.page-section-iframe {
    padding: 0 !important;
    margin: 0 !important;
    /* Fill full height: viewport minus portal header (60px) */
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

#svetofor-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* ── Portal layout ─────────────────────────── */
    .portal-main {
        margin-left: 0;
        padding-bottom: 64px; /* room for bottom nav */
        overflow-x: hidden;
    }

    /* ── Sidebar → bottom navigation bar ──────── */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: 60px;
        width: 100% !important;
        flex-direction: row;
        align-items: stretch;
        justify-content: space-around;
        padding: 0;
        gap: 0;
        border-right: none;
        border-top: 1px solid #1e293b;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
        overflow: visible;
        z-index: 120;
    }
    .sidebar:hover,
    .sidebar:focus-within,
    .sidebar.open {
        width: 100% !important;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
    }
    /* Hide brand in bottom nav */
    .sidebar-top {
        display: none;
    }
    .sidebar:hover .sidebar-top,
    .sidebar:focus-within .sidebar-top {
        display: none;
    }
    /* Nav links as vertical icon+label tiles */
    .sidebar-nav {
        flex-direction: row;
        width: 100%;
        gap: 0;
    }
    .sidebar-link,
    .sidebar:hover .sidebar-link,
    .sidebar:focus-within .sidebar-link,
    .sidebar.open .sidebar-link {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3px;
        padding: 6px 4px;
        border-radius: 0;
    }
    /* Always show labels in bottom bar */
    .sidebar-label,
    .sidebar:hover .sidebar-label,
    .sidebar:focus-within .sidebar-label,
    .sidebar.open .sidebar-label {
        display: block;
        font-size: 10px;
        line-height: 1;
    }

    /* ── Header ────────────────────────────────── */
    .header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-title { font-size: 16px; }
    .header-right { gap: 6px; }
    .badge-text, .hide-mobile { display: none; }
    .role-badge-btn { padding: 4px 10px; font-size: 12px; }
    .alerts-panel {
        right: 0;
        width: min(380px, calc(100vw - 24px));
    }

    /* ── Stats bar ─────────────────────────────── */
    .stats-bar {
        padding: 12px 12px 0;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card { padding: 14px 12px; gap: 10px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }

    /* ── Toolbar ───────────────────────────────── */
    .toolbar {
        padding: 12px 12px 10px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .toolbar-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .toolbar-actions .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* ── Test mode panel ───────────────────────── */
    .test-mode-panel {
        margin: 0 12px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .test-mode-panel-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* ── Notification cards ────────────────────── */
    .notifications-grid {
        grid-template-columns: 1fr;
        padding: 0 12px 12px;
    }

    /* ── Module cards ──────────────────────────── */
    .modules-head { padding: 12px 12px 8px; }
    .modules-grid {
        padding: 0 12px 12px;
        grid-template-columns: 1fr;
    }

    /* ── Users table ───────────────────────────── */
    .users-table-wrap { margin: 0 12px; }

    /* ── Modals ────────────────────────────────── */
    .modal { padding: 20px 16px; max-height: 85vh; }
}
