/* ============================================================
   MatoTrack — Agricultural Machinery Tracker UI
   Dark earth / amber luxury theme + Material Design 3 mobile
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    /* Light green agricultural theme — matches pivot-tracker */
    --bg-base:       #f0fdf4;
    --bg-surface:    #ffffff;
    --bg-elevated:   #ecfdf5;
    --bg-input:      #ecfdf5;
    --sidebar-bg:    #14532d;
    --accent:        #22c55e;
    --accent-glow:   #16a34a;
    --accent-dim:    rgba(34,197,94,0.12);
    --accent-border: rgba(34,197,94,0.30);
    --green:         #22c55e;
    --green-dim:     rgba(34,197,94,0.10);
    --green-border:  rgba(34,197,94,0.30);
    --blue:          #0891b2;
    --blue-dim:      rgba(8,145,178,0.10);
    --blue-border:   rgba(8,145,178,0.30);
    --red:           #dc2626;
    --red-dim:       rgba(220,38,38,0.10);
    --red-border:    rgba(220,38,38,0.30);
    --orange:        #d97706;
    --orange-dim:    rgba(217,119,6,0.10);
    --orange-border: rgba(217,119,6,0.30);
    --text-1:        #14532d;
    --text-2:        #166534;
    --text-3:        #4a7c59;
    --border:        #d1fae5;
    --border-light:  #a7f3d0;
    --sidebar-width: 240px;
    --bottom-nav-h:  66px;
    --mobile-header-h: 58px;
    --radius-sm:     6px;
    --radius:        10px;
    --radius-lg:     10px;
    --radius-xl:     16px;
    --shadow-sm:     0 1px 3px rgba(20,83,45,0.08);
    --shadow:        0 1px 4px rgba(20,83,45,0.10), 0 1px 2px rgba(20,83,45,0.06);
    --shadow-lg:     0 8px 28px rgba(20,83,45,0.14), 0 3px 8px rgba(20,83,45,0.08);
    --font-main:     'Cairo', sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
    --transition:    200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -webkit-tap-highlight-color: transparent; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-base);
    color: var(--text-1);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    overscroll-behavior-y: none;
}

[lang="en"], [lang="en"] * { direction: ltr; }
[lang="ar"], [lang="ar"] * { direction: rtl; }

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-main); cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: var(--font-main); color: var(--text-1); }
svg { display: block; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-elevated); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── App Layout ─────────────────────────────────────────────── */
#app {
    display: flex;
    min-height: 100dvh;
    position: relative;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-left: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    z-index: 100;
    overflow-y: auto;
    padding: 20px 0 16px;
}

[lang="en"] .sidebar { right: auto; left: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    margin-bottom: 8px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: rgba(34,197,94,0.20);
    border: 1px solid rgba(34,197,94,0.40);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4ade80;
    flex-shrink: 0;
}
.brand-icon--sm { width: 32px; height: 32px; border-radius: 8px; }
.brand-icon--sm svg { width: 20px; height: 20px; }
.brand-icon--lg { width: 64px; height: 64px; border-radius: 16px; }
.brand-icon--lg svg { width: 40px; height: 40px; }
.brand-icon svg { width: 24px; height: 24px; }

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 15px; font-weight: 700; color: #ffffff; letter-spacing: 0.3px; }
.brand-sub  { font-size: 11px; color: rgba(255,255,255,0.55); font-weight: 400; }

.sidebar-section { padding: 4px 10px; }
.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.38);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 10px 8px 4px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #86efac;
    font-size: 13px;
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #d1fae5; }
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #4ade80;
    border-color: rgba(74,222,128,0.25);
}
.nav-icon {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.nav-badge {
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    margin-inline-start: auto;
    font-family: var(--font-mono);
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid rgba(255,255,255,0.10);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(34,197,94,0.20);
    border: 1.5px solid rgba(34,197,94,0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #4ade80;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-actions {
    display: flex;
    gap: 4px;
    padding: 8px 8px 0;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: #86efac;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.icon-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-btn:hover { background: rgba(255,255,255,0.10); color: #d1fae5; }

/* Mobile header icon buttons (on white bg) */
.mobile-header .icon-btn { color: var(--text-3); }
.mobile-header .icon-btn:hover { background: var(--bg-elevated); color: var(--text-1); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-inline-start: var(--sidebar-width);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.page-outlet {
    flex: 1;
    padding: 28px 32px;
    max-width: 1200px;
    width: 100%;
    animation: pageEnter 250ms cubic-bezier(0.2, 0, 0, 1) both;
}

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

/* ── Mobile Header ──────────────────────────────────────────── */
.mobile-header {
    display: none;
    height: var(--mobile-header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(20,83,45,0.07);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-header-brand { display: flex; align-items: center; gap: 10px; }
.mobile-title { font-size: 16px; font-weight: 700; color: var(--text-1); }
.mobile-header-actions { display: flex; gap: 4px; }

/* ── Bottom Navigation ──────────────────────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 0 var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
    gap: 3px;
    position: relative;
    transition: color var(--transition);
    overflow: hidden;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    font-family: inherit;
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item.active .bottom-nav-icon::before {
    content: '';
    position: absolute;
    inset: -5px -18px;
    background: var(--accent-dim);
    border-radius: 20px;
    z-index: -1;
    transition: background var(--transition);
}

.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}

.bottom-nav-icon {
    position: relative;
    width: 24px;
    height: 24px;
}
.bottom-nav-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── FAB ────────────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom));
    inset-inline-end: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(34,197,94,0.35);
    z-index: 80;
    transition: transform var(--transition-spring), box-shadow var(--transition);
    animation: fabIn 400ms var(--transition-spring) both;
}
.fab:hover { transform: scale(1.06); box-shadow: 0 6px 28px rgba(34,197,94,0.45); }
.fab:active { transform: scale(0.95); }
.fab svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
}

@keyframes fabIn {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Badge ──────────────────────────────────────────────────── */
.icon-badge {
    position: absolute;
    top: -2px;
    inset-inline-end: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    border: 1.5px solid var(--bg-surface);
}

/* ── Bottom Sheet ───────────────────────────────────────────── */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    backdrop-filter: blur(4px);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 201;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 350ms cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 92dvh;
    overflow-y: auto;
    will-change: transform;
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 769px) {
    .toast-container { bottom: 24px; left: calc(var(--sidebar-width) / 2); }
    [lang="en"] .toast-container { left: auto; right: calc(var(--sidebar-width) / 2); }
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-1);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: toastIn 280ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
    pointer-events: auto;
    max-width: min(340px, 90vw);
    text-align: center;
}
.toast.success { border-color: var(--green-border); color: var(--green); }
.toast.error   { border-color: var(--red-border);   color: var(--red); }
.toast.warning { border-color: var(--orange-border); color: var(--orange); }
.toast.fade-out { animation: toastOut 280ms ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ── App Loader ─────────────────────────────────────────────── */
.app-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    transition: opacity 400ms ease;
}
.app-loader.hidden { opacity: 0; pointer-events: none; }

.loader-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-1);
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
}
.loader-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-glow));
    border-radius: 2px;
    animation: loadProgress 1.2s ease-in-out forwards, hideLoader 0s 2s forwards;
}
@keyframes loadProgress { from { width: 0; } to { width: 85%; } }
/* Failsafe: if JS doesn't hide loader, CSS will after 2s */
@keyframes hideLoader { to { opacity: 0; pointer-events: none; } }
.app-loader { animation: hideAppLoader 0s 2.5s forwards; }
@keyframes hideAppLoader { to { opacity: 0; pointer-events: none; visibility: hidden; } }

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.login-bg::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(34,197,94,0.10) 0%, transparent 70%);
    border-radius: 50%;
}
.login-bg::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(20,83,45,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: pageEnter 400ms cubic-bezier(0.2, 0, 0, 1) both;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}
.login-logo {
    width: 72px;
    height: 72px;
    background: var(--accent-dim);
    border: 1.5px solid var(--accent-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--accent);
}
.login-logo svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-title { font-size: 24px; font-weight: 800; color: var(--text-1); }
.login-subtitle { font-size: 14px; color: var(--text-2); margin-top: 4px; }

/* ── Form Elements ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-input {
    background: var(--bg-input);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 16px; /* 16px minimum prevents iOS auto-zoom on focus */
    color: var(--text-1);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-3); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a7c59' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}
[lang="ar"] .form-select {
    background-position: right 12px center;
    padding-right: 36px;
    padding-left: 14px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1.5px solid transparent;
    font-family: var(--font-main);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-glow); box-shadow: 0 4px 16px rgba(34,197,94,0.35); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-1);
    border-color: var(--border-light);
}
.btn-secondary:hover { background: var(--border); border-color: var(--border-light); }

.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-1); }

.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { background: rgba(224,85,85,0.2); }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: var(--radius); }
.btn-full { width: 100%; }

.btn-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-inline-start: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ripple */
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.5s ease, opacity 0.5s ease;
}
.btn:active::before { transform: scale(2); opacity: 1; transition: none; }

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--text-1); }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

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

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--stat-color, rgba(212,134,10,0.08)) 0%, transparent 70%);
    border-radius: 0 0 0 80px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    background: var(--stat-icon-bg, var(--accent-dim));
    border: 1px solid var(--stat-icon-border, var(--accent-border));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--stat-icon-color, var(--accent));
}
.stat-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-1);
    font-family: var(--font-mono);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-delta { font-size: 11px; color: var(--green); margin-top: 4px; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.card-body { padding: 20px; }

/* ── Machinery Card ───────────────────────────────────────────── */
.machinery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.machinery-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.machinery-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.machinery-card--working {
    border-color: var(--green-border);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(45,189,110,0.04) 100%);
}
.machinery-card--on_the_way {
    border-color: var(--blue-border);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(77,166,255,0.04) 100%);
}
.machinery-card--maintenance {
    border-color: var(--orange-border);
}

.machinery-card-header {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.machinery-number {
    font-size: 18px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-1);
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
}
.machinery-make { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.status-badge--working { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.status-badge--idle { background: var(--bg-elevated); color: var(--text-3); border: 1px solid var(--border); }
.status-badge--on_the_way { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue-border); }
.status-badge--maintenance { background: var(--orange-dim); color: var(--orange); border: 1px solid var(--orange-border); }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.status-dot--pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.8); } }

.machinery-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}
.machinery-stat {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 8px;
    text-align: center;
}
.machinery-stat-value { font-size: 13px; font-weight: 700; color: var(--text-1); font-family: var(--font-mono); }
.machinery-stat-label { font-size: 10px; color: var(--text-2); margin-top: 2px; }

/* Working machinery glow */
.machinery-card--working::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--green), transparent);
    animation: scanLine 2s ease-in-out infinite;
}
@keyframes scanLine { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* On-the-way moving indicator */
.machinery-card--on_the_way::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: auto;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    animation: slideAcross 1.8s ease-in-out infinite;
}
@keyframes slideAcross { from { left: -60%; } to { left: 100%; } }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    background: #f6fef8;
    padding: 12px 16px;
    text-align: start;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-elevated); }
.table tbody tr.clickable { cursor: pointer; }

.mono { font-family: var(--font-mono); font-size: 12px; }

/* ── Filters bar ────────────────────────────────────────────── */
.filters-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.filter-chips-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--border-light);
    color: var(--text-2);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all var(--transition);
}
.filter-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.filter-chip:hover:not(.active) { border-color: var(--text-3); color: var(--text-1); }

.search-input-wrap {
    position: relative;
    width: 100%;
    max-width: 360px;
}
.search-input-wrap svg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 12px;
    width: 16px;
    height: 16px;
    stroke: var(--text-3);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.search-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-light);
    border-radius: 20px;
    padding: 8px 14px 8px 36px;
    font-size: 13px;
    color: var(--text-1);
    outline: none;
    transition: border-color var(--transition);
}
[lang="ar"] .search-input { padding: 8px 36px 8px 14px; }
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-3); }

/* ── Alert items ────────────────────────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 10px; }

.alert-item {
    display: flex;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color var(--transition);
}
.alert-item:hover { border-color: var(--border-light); }
.alert-item--critical { border-color: var(--red-border); }
.alert-item--warning  { border-color: var(--orange-border); }

.alert-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.alert-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; }
.alert-icon--critical { background: var(--red-dim); color: var(--red); }
.alert-icon--warning  { background: var(--orange-dim); color: var(--orange); }
.alert-icon--info     { background: var(--blue-dim); color: var(--blue); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.alert-meta  { font-size: 12px; color: var(--text-2); }

.alert-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Map container ──────────────────────────────────────────── */
.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    height: 320px;
    background: var(--bg-elevated);
}

.leaflet-container { background: #d1fae5 !important; }

/* ── Session row ────────────────────────────────────────────── */
.session-status--open   { color: var(--green); }
.session-status--closed { color: var(--text-2); }

/* ── Detail grid ────────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.detail-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.detail-label { font-size: 11px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.detail-value { font-size: 15px; font-weight: 600; color: var(--text-1); }
.detail-value.mono { font-size: 14px; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-3);
    gap: 12px;
}
.empty-state svg { width: 48px; height: 48px; stroke: var(--text-3); fill: none; stroke-width: 1.25; stroke-linecap: round; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state-sub   { font-size: 13px; }

/* ── Loading skeleton ───────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-light) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Section title ──────────────────────────────────────────── */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 200ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    overflow-y: auto;
    animation: modalIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
    box-shadow: var(--shadow-lg);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2);
    transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text-1); }
.modal-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── More page (mobile menu) ────────────────────────────────── */
.more-list { display: flex; flex-direction: column; gap: 6px; }
.more-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-1);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.more-item:hover { background: var(--bg-elevated); border-color: var(--border-light); }
.more-item-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}
.more-item-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; }
.more-item-arrow {
    margin-inline-start: auto;
    color: var(--text-3);
}
.more-item-arrow svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ── Dashboard live section ─────────────────────────────────── */
/* ── Dashboard nav cards (mobile only) ─────────────────────── */
.dash-nav-cards {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.dash-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 14px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background var(--transition), transform var(--transition);
}
.dash-nav-card:active { background: var(--surface-2); transform: scale(0.95); }
.dash-nav-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dash-nav-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.dash-nav-card-icon--green  { background: rgba(22,163,74,.12);  color: var(--green); }
.dash-nav-card-icon--blue   { background: rgba(59,130,246,.12); color: #3b82f6; }
.dash-nav-card-icon--accent { background: var(--accent-dim);    color: var(--accent); }
.dash-nav-card-icon--red    { background: rgba(239,68,68,.12);  color: var(--red); }
.dash-nav-card-icon--purple { background: rgba(168,85,247,.12); color: #a855f7; }
.dash-nav-card-icon--default { background: var(--surface-2);   color: var(--text-2); }

.live-section {
    margin-bottom: 28px;
}
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}
.live-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 20px 0 0;
}
.page-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
    color: var(--text-2);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all var(--transition);
}
.page-btn.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.page-btn:hover:not(.active) { background: var(--bg-elevated); color: var(--text-1); }
.page-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ── Progress bar ───────────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill--green  { background: var(--green); }
.progress-fill--red    { background: var(--red); }
.progress-fill--orange { background: var(--orange); }

/* ── Oil change indicator ───────────────────────────────────── */
.oil-indicator {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.oil-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.oil-label { color: var(--text-2); }
.oil-value { font-family: var(--font-mono); font-weight: 600; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Fix sidebar offset — clears margin for both RTL and LTR */
    .sidebar { display: none; }
    .main-content { margin-inline-start: 0; }
    .mobile-header { display: flex; }
    .bottom-nav { display: flex; }

    .page-outlet {
        padding: 16px;
        padding-bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom));
    }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }

    .dash-nav-cards { display: grid; grid-template-columns: repeat(4, 1fr); }

    .machinery-grid { grid-template-columns: 1fr; gap: 10px; }
    .machinery-card { padding: 16px; }
    .machinery-card:active { transform: scale(0.98); }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    .page-actions { width: 100%; }

    /* Search full-width, chips scroll on their own row */
    .filters-bar { gap: 8px; }
    .search-input-wrap { width: 100%; max-width: 100%; min-width: 0; }
    .filter-chips-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filter-chips-row::-webkit-scrollbar { display: none; }
    .filter-chip { font-size: 11px; padding: 5px 12px; flex-shrink: 0; }

    /* Card header — prevent number from being squeezed */
    .machinery-card-header > div:first-child { flex: 1; min-width: 0; }
    .machinery-card-header > div:last-child  { flex-shrink: 0; }
    .dev-chip { font-size: 10px; padding: 2px 6px; }

    .modal { max-height: 95dvh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; }
    .modal-overlay { align-items: flex-end; padding: 0; }

    .table th, .table td { padding: 10px 12px; }

    .detail-grid { grid-template-columns: 1fr 1fr; }

    /* ── Responsive table → card layout ────────────────────── */
    .resp-table-wrap {
        border: none;
        background: transparent;
        overflow-x: visible;
        border-radius: 0;
    }
    .resp-table { display: block; }
    .resp-table thead { display: none; }
    .resp-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .resp-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        padding: 14px 16px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }
    .resp-table tbody td {
        display: flex;
        flex-direction: column;
        gap: 3px;
        border: none;
        padding: 0;
        vertical-align: top;
        word-break: break-word;
    }
    .resp-table tbody td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        color: var(--text-3);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    /* Full-width spans */
    .resp-table tbody td.cell-full {
        grid-column: 1 / -1;
    }
    /* Action cell at bottom spanning full width */
    .resp-table tbody td.cell-action {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px solid var(--border);
    }
    .resp-table tbody td.cell-action::before { display: none; }
    /* Report total row */
    .resp-table tbody tr.total-row {
        background: var(--bg-elevated);
        border-color: var(--border-light);
    }
    .btn-sm { min-height: 36px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    /* Single column cards on very small phones */
    .resp-table tbody tr { grid-template-columns: 1fr; }
    .resp-table tbody td.cell-full { grid-column: 1; }
    .resp-table tbody td.cell-action { grid-column: 1; }
}

@media (max-width: 400px) {
    .bottom-nav-item { font-size: 10px; gap: 3px; }
    .bottom-nav-icon, .bottom-nav-icon svg { width: 22px; height: 22px; }
    .page-outlet {
        padding: 12px;
        padding-bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom));
    }
    .dash-nav-cards { grid-template-columns: repeat(3, 1fr); }
    .dash-nav-card { padding: 12px 6px; font-size: 10px; }
    .dash-nav-card-icon { width: 36px; height: 36px; }
}

/* Reports page header: stack date + button on narrow screens */
@media (max-width: 600px) {
    .report-header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }
    .report-header-actions .form-input { width: 100%; }
    .report-header-actions .btn { width: 100%; justify-content: center; }
}

/* ── PWA standalone mode — status bar safe area ─────────────── */
@media (display-mode: standalone) {
    .mobile-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--mobile-header-h) + env(safe-area-inset-top));
    }
}

/* ── Touch UX — no text selection on UI chrome ──────────────── */
.nav-item, .bottom-nav-item, .btn, .icon-btn,
.filter-chip, .more-item, .machinery-card, .tab-btn {
    -webkit-user-select: none;
    user-select: none;
}

/* ── Touch active states ────────────────────────────────────── */
.btn:active          { transform: scale(0.97); opacity: 0.92; }
.bottom-nav-item:active { opacity: 0.6; }
.more-item:active    { background: var(--border); transform: scale(0.99); }
.machinery-card:active { transform: scale(0.99); box-shadow: none; }
.filter-chip:active  { opacity: 0.75; }

/* ── Native scroll on iOS ───────────────────────────────────── */
.page-outlet, .bottom-sheet, .modal, .table-wrap {
    -webkit-overflow-scrolling: touch;
}

/* ── Login full override (no sidebar) ──────────────────────── */
.login-view .sidebar,
.login-view .bottom-nav,
.login-view .mobile-header,
.login-view #fab { display: none !important; }

/* Main content takes full width and no margin when in login view */
.login-view .main-content {
    margin-inline-start: 0 !important;
}

/* Page outlet is full screen with no padding for login */
.login-view .page-outlet {
    padding: 0 !important;
    padding-bottom: 0 !important;
}

/* login-page fills the viewport */
.login-view .login-page {
    min-height: 100dvh;
}

/* ── Machinery detail layout ──────────────────────────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .detail-layout { grid-template-columns: 1fr; } }

/* ── Report table ───────────────────────────────────────────── */
.amount-cell { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }

/* ── User table role chip ───────────────────────────────────── */
.role-chip {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.role-chip--admin   { background: var(--accent-dim); color: var(--accent); }
.role-chip--client  { background: var(--blue-dim); color: var(--blue); }
.role-chip--machinery_owner   { background: var(--green-dim); color: var(--green); }
.role-chip--machinery_manager { background: var(--orange-dim); color: var(--orange); }

/* ── Number display ─────────────────────────────────────────── */
.num { font-family: var(--font-mono); }

/* ── Device connection chip ─────────────────────────────────── */
.dev-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.dev-chip--online  { background: var(--green-dim);  color: var(--green); }
.dev-chip--offline { background: var(--bg-elevated); color: var(--text-3); }
.dev-chip--none    { background: var(--bg-elevated); color: var(--text-3); }

/* ── Boundary recording ─────────────────────────────────────── */
.boundary-recording-dot {
    width: 10px;
    height: 10px;
    background: var(--red);
    border-radius: 50%;
    animation: pulse 1.2s ease-in-out infinite;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.boundary-exists-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-border);
}

/* ── Map layer toggle button ────────────────────────────────── */
.map-layer-toggle {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    font-family: var(--font-main);
}
.map-layer-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}
