/* =========================================================
   LATRA Fleet Dashboard - Enterprise Theme
   Reference: field-service / asset-management dashboard
   Visual language: white cards, #F5F6F8 canvas, 1px #E1E3E6
   borders, compact typography (Montserrat), narrow dark sidebar.
   ========================================================= */

:root {
    --canvas:     #F5F6F8;
    --surface:    #FFFFFF;
    --border:     #E1E3E6;
    --border-2:   #D5D8DC;
    --ink:        #20252B;
    --muted:      #6D737A;
    --faint:      #9AA0A6;
    --accent:     #2F6BEB;
    --accent-ink: #1D4FD8;
    --accent-bg:  #EBF1FE;
    --danger:     #E0433C;
    --danger-bg:  #FDE9E8;
    --warn:       #E8920C;
    --warn-bg:    #FBF1DE;
    --ok:         #2F9E57;
    --ok-bg:      #E4F4EA;
    --sidebar:    #171B22;
    --sidebar-2:  #1E242D;
    --sidebar-ic: #9BA3AF;
    --radius:     6px;
    --radius-sm:  4px;
    --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --shadow: 0 1px 2px rgba(32, 37, 43, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { min-width: 320px; }

body {
    font-family: var(--font);
    background-color: var(--canvas);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.45;
    height: 100vh;
    overflow: hidden;
}

button, input, select, textarea { max-width: 100%; font-family: inherit; }
a { color: var(--accent-ink); }

/* ---------------------------------------------------------
   App shell (fills the viewport)
   --------------------------------------------------------- */
.app-wrapper {
    height: 100vh;
    background: var(--surface);
    display: flex;
    overflow: hidden;
}
.app-main {
    flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas);
    /* Full width — the topbar spans the whole screen. */
    padding-left: 0;
}

/* ---------------------------------------------------------
   Floating navigation dock (macOS-style)
   Sits above the app on the left edge; does NOT span height.
   --------------------------------------------------------- */
.sidemenu {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 950;
    --dock-w: 42px;
}
.dock {
    width: var(--dock-w);
    background: rgba(23, 27, 34, .92);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    backdrop-filter: blur(12px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(10, 13, 18, .35), 0 2px 8px rgba(10, 13, 18, .2);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 5px 7px;
    overflow: hidden;
    max-height: calc(100vh - 48px);
}

/* Nav */
.dock-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.dock-nav::-webkit-scrollbar { display: none; }

/* Item — icon-only tile */
.dock-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9BA3AF;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}
.dock-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    font-size: 16px;
    transition: transform .18s ease, color .18s ease;
}

/* Hover feedback (icon grows slightly, background appears) */
.dock-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.dock-item:hover .dock-ico { transform: scale(1.15); }

/* Active state — accent capsule + glow */
.dock-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 107, 235, .35);
}
.dock-item.active .dock-ico { color: #fff; }
.dock-item.active::after {
    content: "";
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 15px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 6px rgba(47, 107, 235, .6);
}

/* Dock footer (version) */
.dock-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}
.dock-ver {
    font-size: 7.5px;
    color: #5B6470;
    letter-spacing: 0;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
}

/* Tooltips — shown beside the dock */
.dock-item[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 16px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #20252B;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    padding: 5px 9px;
    border-radius: 7px;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(20, 24, 30, .22);
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
    z-index: 20;
}
.dock-item[data-tip]:hover::after,
.dock-item[data-tip]:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Keyboard focus */
.dock-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------------------------------------------------------
   Top header
   --------------------------------------------------------- */
.topbar {
    height: 38px;
    flex: 0 0 38px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    gap: 12px;
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; letter-spacing: .06em; color: #14171C; white-space: nowrap; }
.brand-pin { color: #E8920C; font-size: 14px; }

.tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Dropdowns in the header */
.tb-dd { position: relative; }
.tb-dd-btn {
    height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 9px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s;
}
.tb-dd-btn:hover { border-color: var(--border-2); }
.tb-dd-btn .tm { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }

.tb-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 168px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(20, 23, 28, .16);
    padding: 5px;
    z-index: 500;
}
.tb-dd.open .tb-dd-btn { border-color: var(--accent); color: var(--ink); }
.tb-dd.open .tb-dd-menu { display: block; }
.tb-dd-opt {
    display: block;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}
.tb-dd-opt:hover { background: var(--accent-bg); color: var(--accent-ink); }
.tb-dd-sep { height: 1px; background: var(--border); margin: 4px 2px; }

.tb-user { display: flex; align-items: center; gap: 8px; padding-left: 4px; border-left: 1px solid var(--border); }
.tb-user-name { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tb-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--sidebar);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ---------------------------------------------------------
   Scrollable workspace + page container
   --------------------------------------------------------- */
/* The floating dock reserves a left zone over the scrollable content;
   margins are kept symmetric so the content stays centered. */
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; background: var(--canvas); padding: 0 76px; }
.page-container { width: 100%; max-width: 1260px; margin: 0 auto; padding: 14px 18px 24px; }

/* Page header */
.page-header { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header h1 { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.page-header h1 .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; font-size: 13px; transition: color .15s; }
.back-link:hover { color: var(--accent-ink); }

/* ---------------------------------------------------------
   Section heading + info icon (reference style)
   --------------------------------------------------------- */
.section-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 0 8px;
}
.section-head h2 { font-size: 14px; font-weight: 600; color: var(--ink); }
.section-head:first-child { margin-top: 0; }
.icon-info {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid currentColor;
    color: var(--faint);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    cursor: help;
}
.section-head .spacer { flex: 1; }

/* ---------------------------------------------------------
   Pipeline statistics card
   --------------------------------------------------------- */
.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
}
.pp-col {
    padding: 11px 14px 12px;
    min-width: 0;
    border-right: 1px solid var(--border);
    position: relative;
    transition: background .15s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.pp-col:last-child { border-right: 0; }
.pp-col:hover { background: #FAFBFC; }
.pp-head { display: flex; align-items: center; gap: 4px; min-height: 15px; }
.pp-head .nm { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-urgent { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 600; color: var(--danger); flex-shrink: 0; }
.pp-urgent .bd { min-width: 14px; height: 14px; padding: 0 3px; border-radius: 3px; background: var(--danger); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; }

.pp-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.pp-metric > .v { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; line-height: 1.15; }
.pp-metric > .l { font-size: 9px; color: var(--faint); text-transform: uppercase; letter-spacing: .03em; margin-top: 1px; }

/* ---------------------------------------------------------
   General cards
   --------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.card-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}
.card-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); min-width: 0; }
.card-title i { color: var(--accent); font-size: 13px; }
.card-title h3 { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-body { padding: 12px 14px; flex: 1; min-width: 0; }
.card-footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* Down-equipment / locations left card */
.down-metrics { display: flex; gap: 28px; padding: 2px 0 12px; }
.down-metrics .pp-metric > .v { font-size: 15px; }

.loc-block { border-top: 1px solid var(--border); padding-top: 10px; }
.loc-head { display: flex; align-items: center; gap: 6px; }
.loc-title { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.loc-count { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); margin: 7px 0 4px; }
.loc-count i { color: var(--accent); font-size: 14px; }
.loc-pills { display: flex; gap: 12px; flex-wrap: wrap; }
.loc-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }
.loc-pill .n {
    min-width: 22px; height: 18px;
    padding: 0 6px;
    border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}
.loc-pill.blue .n { background: var(--accent-bg); color: var(--accent-ink); }
.loc-pill.orange .n { background: var(--warn-bg); color: var(--warn); }
.loc-pill.red .n { background: var(--danger-bg); color: var(--danger); }

.map-wrap { margin: 10px -0 0; border-top: 1px solid var(--border); height: 230px; position: relative; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.map-wrap .leaflet-container { height: 100%; width: 100%; background: #E7EAEE; }

/* Map segment control (Map / Satellite) */
.map-seg {
    position: absolute;
    top: 8px; left: 8px;
    z-index: 600;
    display: flex;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.map-seg button {
    height: 24px;
    padding: 0 10px;
    border: 0;
    background: #fff;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
}
.map-seg button + button { border-left: 1px solid var(--border); }
.map-seg button.active { background: var(--accent); color: #fff; }

/* Larger map wrapper used on the vehicle detail page and live monitoring */
.map-wrap-lg {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    height: 520px;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #E7EAEE;
}
.map-wrap-lg .leaflet-container { height: 100%; width: 100%; }

/* Live monitoring feed — scrolls to match the map height */
.lf-feed-body { max-height: 520px; overflow-y: auto; }
.lf-feed-body thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.lf-feed-body td.v-cell { width: 40%; }
.lf-feed-body td { white-space: nowrap; }

/* ---------------------------------------------------------
   Customer updates feed
   --------------------------------------------------------- */
.update-card { display: flex; flex-direction: column; min-height: 0; }
.feed-tools { display: flex; align-items: center; gap: 6px; }
.mini-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.mini-toggle .s {
    width: 26px; height: 15px;
    border-radius: 8px;
    background: #C9CDD3;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}
.mini-toggle .s::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.mini-toggle.on .s { background: var(--accent); }
.mini-toggle.on .s::after { transform: translateX(11px); }

.tb-dd.small .tb-dd-btn { height: 24px; padding: 0 8px; font-size: 12px; }
.icon-btn {
    width: 24px; height: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.feed-tabs { display: flex; gap: 16px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); }
.feed-tab {
    position: relative;
    padding: 4px 0 7px;
    background: none;
    border: 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.feed-tab .c { font-size: 11px; color: var(--faint); font-weight: 500; }
.feed-tab.active { color: var(--accent-ink); font-weight: 600; }
.feed-tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.feed { flex: 1; min-height: 340px; max-height: calc(90vh - 250px); overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.f-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: box-shadow .15s;
}
.f-item:hover { box-shadow: 0 2px 8px rgba(32, 37, 43, .08); }
.f-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.f-text { font-size: 12px; line-height: 1.5; color: var(--ink); }
.f-text b { font-weight: 600; }
.f-time { font-size: 11px; color: var(--faint); white-space: nowrap; flex-shrink: 0; }
.f-tag-new {
    align-self: flex-start;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--danger);
    background: var(--danger-bg);
    border-radius: 3px;
    padding: 1px 5px;
}
.f-card {
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.f-top { font-size: 11px; color: var(--muted); }
.f-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.f-thumb {
    width: 26px; height: 26px;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent-ink);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.f-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-meta { display: flex; align-items: center; gap: 12px; font-size: 10.5px; color: var(--faint); }
.f-meta i { font-size: 11px; margin-right: 3px; }

/* Status chips (reference-style small badges) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 18px;
    padding: 0 7px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}
.chip-blue   { background: var(--accent-bg); color: var(--accent-ink); }
.chip-green  { background: var(--ok-bg); color: var(--ok); }
.chip-red    { background: var(--danger-bg); color: var(--danger); }
.chip-orange { background: var(--warn-bg); color: var(--warn); }
.chip-gray   { background: #ECEEF1; color: var(--muted); }

.feed-empty { text-align: center; padding: 40px 10px; color: var(--faint); font-size: 13px; }
.feed-empty i { display: block; font-size: 26px; margin-bottom: 8px; opacity: .5; }

/* ---------------------------------------------------------
   Lower grid (45 / 55)
   --------------------------------------------------------- */
.lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 45%) minmax(0, 55%);
    gap: 14px;
    margin-top: 14px;
    align-items: stretch;
}
.lower-grid .card { min-height: 0; }

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 30px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff !important; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { background: #F0F2F4; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #E6E9EC; }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-danger:hover { background: #C83A33; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-warning { background: var(--warn); color: #fff !important; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 34px; padding: 0 16px; font-size: 14px; }
.btn-icon {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: all .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-icon-sm {
    width: 24px; height: 24px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
}
.btn-icon-sm:hover { background: #ECEEF1; color: var(--accent-ink); }
.w-100 { width: 100%; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table-responsive { overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: #FAFBFC;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid #EDEEF1; vertical-align: middle; }
.data-table tr:hover td { background: #FAFBFC; }
.data-table tr:last-child td { border-bottom: none; }
.data-table th.col-check, .data-table td.col-check { width: 38px; padding: 8px 6px 8px 12px; }

/* Generic badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-info    { background: var(--accent-bg); color: var(--accent-ink); }
.badge-secondary { background: #ECEEF1; color: var(--muted); }

/* Status dot */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.active { background: var(--ok); box-shadow: 0 0 0 2px rgba(47, 158, 87, .18); }
.status-dot.inactive { background: var(--muted); }
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: #F59E0B; }
.status-dot.bad { background: var(--danger); }
.status-dot.none { background: var(--muted); }

/* Live monitoring feed */
.lf-stats .stat-card { margin-bottom: 12px; }
.lf-row { margin-top: 4px; }
.lf-legend { display: inline-flex; align-items: center; margin-left: 14px; font-size: 13px; color: var(--muted); }
.lf-legend .status-dot { margin-right: 5px; }
.lf-legend .status-dot.none { margin-left: 2px; }
.live-autorefresh input { accent-color: #2F9E57; }

/* Vehicle cell */
.vehicle-cell { display: flex; flex-direction: column; }
.vehicle-reg { font-weight: 600; color: var(--ink); font-size: 13px; }
.vehicle-name { font-size: 12px; color: var(--muted); }

/* Empty state */
.empty-state { text-align: center; padding: 40px 14px !important; color: var(--muted); }
.empty-state i { font-size: 30px; margin-bottom: 10px; display: block; opacity: .4; }
.empty-state p { font-size: 13px; }
.empty-state a { color: var(--accent-ink); }

/* ---------------------------------------------------------
   Stats (legacy host pages)
   --------------------------------------------------------- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); min-width: 0; }
.stat-icon { width: 34px; height: 34px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; flex-shrink: 0; }
.bg-primary { background: var(--accent); }
.bg-success { background: var(--ok); }
.bg-warning { background: var(--warn); }
.bg-danger  { background: var(--danger); }
.bg-info    { background: #1394B6; }
.bg-secondary { background: var(--muted); }
.stat-info { min-width: 0; }
.stat-value { display: block; font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.stat-label { font-size: 12px; color: var(--muted); }

/* Grid layouts */
.dashboard-grid { display: flex; flex-direction: column; gap: 14px; }
.dashboard-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.dashboard-col-3 { grid-column: span 3; min-width: 0; }
.dashboard-col-4 { grid-column: span 4; min-width: 0; }
.dashboard-col-5 { grid-column: span 5; min-width: 0; }
.dashboard-col-6 { grid-column: span 6; min-width: 0; }
.dashboard-col-7 { grid-column: span 7; min-width: 0; }
.dashboard-col-8 { grid-column: span 8; min-width: 0; }
.dashboard-col-12 { grid-column: 1 / -1; min-width: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 14px; }

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.form-input {
    height: 32px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: var(--surface);
    color: var(--ink);
}
textarea.form-input { height: auto; min-height: 80px; padding: 8px 11px; }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 235, .12); }
select.form-input { cursor: pointer; }
.form-control {
    height: 32px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
}
.form-control.select2 { height: auto; padding: 0; display: flex; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 0; }
.checkbox-label { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.form-help { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Searchable dropdown */
.searchable-dropdown { position: relative; min-width: 240px; }
.searchable-dropdown > select[hidden] { display: none; }
.searchable-dropdown-button {
    height: 32px; width: 100%;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: left; cursor: pointer;
    font-size: 13px; color: var(--ink);
}
.searchable-dropdown-button::after { content: '\25BC'; color: var(--muted); font-size: 9.5px; margin-left: 10px; }
.searchable-dropdown.open .searchable-dropdown-button { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,235,.12); }
.searchable-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 300; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20,23,28,.14); }
.searchable-dropdown.open .searchable-dropdown-menu { display: block; }
.searchable-dropdown-input { width: 100%; height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 13px; outline: none; margin-bottom: 6px; }
.searchable-dropdown-input:focus { border-color: var(--accent); }
.searchable-dropdown-options { max-height: 260px; overflow-y: auto; }
.searchable-dropdown-option { display: block; width: 100%; padding: 7px 9px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.searchable-dropdown-option:hover, .searchable-dropdown-option[aria-selected="true"] { background: var(--accent-bg); color: var(--accent-ink); }
.searchable-dropdown-empty { padding: 8px; color: var(--muted); font-size: 13px; }

/* Filters bar */
.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; width: min(100%, 300px); }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.search-box input { width: 100%; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; background: var(--surface); }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,235,.12); }

/* Alerts */
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #C7E8D3; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #F5C9C6; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid #F0DCBC; }
.alert-info { background: var(--accent-bg); color: var(--accent-ink); border: 1px solid #D3E0FB; }

/* Activity grid/cards */
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.activity-card { background: var(--surface); border-radius: var(--radius); padding: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); transition: border-color .2s; display: flex; flex-direction: column; }
.activity-card.enabled { border-color: #B9DEC6; background: #F2FBF5; }
.activity-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.activity-toggle { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.activity-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-bg); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.activity-info { flex: 1; }
.activity-info h4 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.activity-category { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.activity-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; flex: 1; overflow-wrap: anywhere; }
.activity-form { padding-top: 10px; border-top: 1px solid var(--border); margin-top: auto; }
.addon-schema { margin-top: 6px; padding: 7px; background: var(--canvas); border-radius: var(--radius-sm); overflow-wrap: anywhere; word-break: break-word; font-size: 12px; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 21px; vertical-align: middle; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #C9CDD3; border-radius: 21px; transition: .25s; }
.toggle-slider:before { position: absolute; content: ""; height: 15px; width: 15px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(17px); }

/* Detail cards */
.detail-card { background: var(--surface); border-radius: var(--radius); padding: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.detail-card h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.detail-card h3 i { color: var(--accent); font-size: 13px; }
.detail-list { display: flex; flex-direction: column; gap: 9px; }
.detail-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid #EDEEF1; }
.detail-item:last-child { border-bottom: none; padding-bottom: 0; }
.detail-label { font-size: 12.5px; color: var(--muted); }
.detail-value { font-size: 13.5px; font-weight: 500; color: var(--ink); text-align: right; overflow-wrap: anywhere; }

/* Activity mini list */
.activity-mini-list { display: flex; flex-direction: column; gap: 6px; }
.activity-mini-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.activity-mini-item.enabled { background: #F2FBF5; }
.activity-mini-item.disabled { background: #F0F2F4; opacity: .6; }
.activity-mini-item i { width: 16px; text-align: center; font-size: 12px; }

/* Map */
.map-container { width: 100%; border-radius: 0 0 var(--radius) var(--radius); z-index: 1; }
.start-marker { color: var(--ok); font-size: 18px; }
.end-marker { color: var(--danger); font-size: 18px; }

/* Quick actions */
.quick-actions { display: flex; flex-direction: column; gap: 6px; }
.section-title { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.action-btn { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 500; transition: all .15s; }
.action-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-btn i { color: var(--accent); width: 16px; text-align: center; font-size: 13px; }
.action-btn:hover i { color: #fff; }

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 18, 23, .55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 600px; max-height: min(88vh, 760px); overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.modal-wide { max-width: 900px; }
.modal-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.modal-body { padding: 16px; overflow-y: auto; max-height: calc(88vh - 120px); }
.json-view { background: #10141B; color: #DCE2EA; padding: 12px; border-radius: var(--radius-sm); font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.payload-editor { width: 100%; min-height: 300px; resize: vertical; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #10141B; color: #DCE2EA; font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------------------------------------------------------
   Pagination
   --------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px; }
.page-link { min-width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; border: 1px solid var(--border); transition: all .15s; background: var(--surface); }
.page-link:hover, .page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-ellipsis { color: var(--muted); padding: 0 4px; }

/* Action group */
.action-group { display: flex; gap: 4px; }
.payload-actions { display: inline-flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------
   Progress modal (automation)
   --------------------------------------------------------- */
.progress-modal-overlay { position: fixed; inset: 0; background: rgba(15, 18, 23, .6); display: flex; align-items: center; justify-content: center; z-index: 9000; padding: 20px; animation: pmFadeIn .2s ease; }
@keyframes pmFadeIn { from { opacity: 0; } to { opacity: 1; } }
.progress-modal-box { background: var(--surface); border-radius: 10px; width: 100%; max-width: 520px; box-shadow: 0 24px 60px rgba(0,0,0,.3); overflow: hidden; animation: pmSlideUp .25s cubic-bezier(.34,1.56,.64,1); }
@keyframes pmSlideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.progress-modal-header { padding: 18px 20px 0; display: flex; align-items: center; gap: 12px; }
.progress-modal-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
.progress-modal-icon.icon-success { background: var(--ok); }
.progress-modal-icon.icon-error { background: var(--danger); }
.progress-modal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.progress-modal-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.progress-modal-body { padding: 16px 20px; }
.progress-counters { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.progress-counters .pct { color: var(--accent); font-size: 16px; font-weight: 700; }
.progress-counters .eta { color: var(--muted); }
.progress-track { height: 8px; background: #E4E7EB; border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s cubic-bezier(.4,0,.2,1); width: 0%; }
.progress-fill.fill-success { background: var(--ok); }
.progress-fill.fill-error { background: var(--danger); }
.progress-status-text { font-size: 13px; color: var(--muted); min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-log { margin-top: 12px; max-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-family: 'SF Mono', Monaco, Consolas, monospace; background: #FAFBFC; }
.progress-log-entry { padding: 5px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; animation: plFade .2s ease; }
.progress-log-entry:last-child { border-bottom: none; }
@keyframes plFade { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.progress-log-entry .pl-icon { font-size: 11px; width: 14px; text-align: center; flex-shrink: 0; }
.progress-log-entry .pl-ok { color: var(--ok); }
.progress-log-entry .pl-fail { color: var(--danger); }
.progress-log-entry .pl-info { color: var(--accent); }
.progress-log-entry .pl-text { flex: 1; color: var(--ink); }
.progress-log-entry .pl-meta { color: var(--muted); white-space: nowrap; }
.progress-modal-footer { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }

/* Bulk actions bar */
.bulk-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1E242D;
    color: #fff;
    padding: 0 28px;
    min-height: 0; max-height: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    z-index: 500;
    transition: max-height .3s cubic-bezier(.4,0,.2,1), padding .3s ease, box-shadow .3s ease;
}
.bulk-bar.visible { max-height: 120px; padding-top: 12px; padding-bottom: 12px; box-shadow: 0 -4px 24px rgba(0,0,0,.3); }
.bulk-bar-selection { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bulk-bar-count { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #AEB6C2; white-space: nowrap; flex-shrink: 0; }
.bulk-bar-count i { color: #7FA8F5; font-size: 13px; }
.bulk-bar-count strong { color: #fff; }
.bulk-bar-divider { width: 1px; height: 26px; background: #3A4450; flex-shrink: 0; }
.bulk-bar-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bulk-bar-label { font-size: 12.5px; color: #AEB6C2; white-space: nowrap; flex-shrink: 0; }
.bulk-bar select { height: 30px; padding: 0 10px; border: 1px solid #3A4450; border-radius: var(--radius-sm); background: #141922; color: #fff; font-size: 13px; outline: none; width: min(280px, 28vw); min-width: 200px; cursor: pointer; }
.bulk-bar select:focus { border-color: var(--accent); }
.bulk-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.bulk-bar-btn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.bulk-bar-btn-secondary { background: #3A4450; color: #fff; }
.bulk-bar-btn-secondary:hover { background: #4A5563; }
.bulk-bar-btn-primary { background: var(--accent); color: #fff; }
.bulk-bar-btn-primary:hover { background: var(--accent-ink); }
.bulk-bar-btn-success { background: var(--ok); color: #fff; }
.bulk-bar-btn-success:hover { background: #257C45; }
.bulk-bar-btn:disabled { opacity: .5; cursor: not-allowed; }
.row-checkbox { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.data-table tr.row-selected td { background: var(--accent-bg); }

/* Utilities */
.text-muted { color: var(--muted); }
.text-primary { color: var(--accent-ink) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warn) !important; }
.text-success { color: var(--ok) !important; }
.font-mono { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 12.5px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 20px; }
code { background: #F0F2F4; padding: 1px 5px; border-radius: 4px; font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 12px; color: var(--ink); }

/* Select2 compact override */
.select2-container .select2-selection--single { height: 32px; }
.select2-container--default .select2-selection--single { border: 1px solid var(--border) !important; border-radius: var(--radius-sm) !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 30px; font-size: 13px; color: var(--ink) !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 30px; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 1100px) {
    .pipeline-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pp-col:nth-child(3) { border-right: 0; }
    .pp-col:nth-child(n+3) { border-top: 1px solid var(--border); }
    .pp-col:nth-child(even) { border-right: 0; }
}
@media (max-width: 900px) {
    .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    body { align-items: stretch; }
    .sidemenu { left: 10px; --dock-w: 38px; }
    .dock { border-radius: 14px; padding: 9px 4px 6px; }
    .dock-item { width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px; }
    .dock-ico { font-size: 15px; }
    .dock-item.active::after { left: -8px; }
    .page-scroll { padding: 0 58px; }
    .tb-user-name { display: none; }
    .topbar { gap: 6px; padding: 0 8px; }
    .tb-dd-btn .tm { display: none; }
    .tb-dd-btn { width: 30px; padding: 0; justify-content: center; }
    .pipeline-card { grid-template-columns: repeat(1, 1fr); }
    .pp-col { border-right: 0; border-top: 1px solid var(--border); }
    .pp-col:first-child { border-top: 0; }
    .page-container { padding: 12px 10px 20px; }
    .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
    .activity-grid { grid-template-columns: 1fr; }
    .card-header, .card-body, .card-footer { padding-left: 12px; padding-right: 12px; }
    .feed-tabs { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================
   Dashboard preview modal
   ===================================================== */
.f-item { cursor: pointer; }

.down-metrics .pp-metric { cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 3px 6px; transition: border-color var(--curve-fast), background var(--curve-fast); }
.down-metrics .pp-metric:hover, .down-metrics .pp-metric:focus-visible { border-color: var(--border-2); background: #FAFBFC; }

.loc-pill { cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px 6px; transition: border-color var(--curve-fast), background var(--curve-fast); }
.loc-pill:hover, .loc-pill:focus-visible { border-color: var(--border-2); background: #FAFBFC; }

.preview-overlay .modal { max-width: 640px; }
.preview-overlay .modal-header .icon-btn { margin: 0 0 0 auto; }
.pv-subtitle { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.pv-details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.pv-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #F8F9FB; padding: 9px 10px; text-align: center; }
.pv-cell .v { display: block; font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.pv-cell .l { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pv-list { display: flex; flex-direction: column; gap: 8px; }
.pv-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; background: #FDFDFD; }
.pv-line { display: flex; align-items: center; gap: 8px; }
.pv-title { font-size: 13.5px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.pv-title b { font-weight: 700; }
.pv-dim { color: var(--muted); font-weight: 400; font-size: 13px; }
.pv-sub { font-size: 13px; color: var(--ink); margin-top: 2px; }
.pv-meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pv-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 10px; }
.pv-empty i { display: block; margin-bottom: 8px; font-size: 20px; }
.pv-error { color: var(--danger); }
.pv-detail { display: grid; grid-template-columns: 1fr; gap: 6px; }
.pv-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--border); align-items: start; }
.pv-row:last-child { border-bottom: 0; }
.pv-k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.pv-v { font-size: 13.5px; color: var(--ink); min-width: 0; word-break: break-word; }
.pv-pre { background: #F4F6F8; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-family: 'SFMono-Regular', Consolas, Menlo, monospace; font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word; color: #2B323B; }

/* =====================================================
   Dashboard filters, presence list, quick-push helper
   ===================================================== */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent-bg); color: var(--accent-ink);
    border: 1px solid #D6E2FB; border-radius: 999px;
    padding: 4px 10px; font-size: 13px; font-weight: 500;
}
.filter-chip i { font-size: 12px; }
.filter-chip a { color: var(--accent-ink); text-decoration: none; font-size: 15px; line-height: 1; padding: 0 2px; border-radius: 999px; }
.filter-chip a:hover { color: var(--danger); }

.tb-dd-menu.maxh { max-height: 320px; overflow-y: auto; }

.status-summary { display: flex; align-items: stretch; gap: 10px; margin-bottom: 10px; }
.status-total {
    display: flex; align-items: center; gap: 9px;
    flex: 1; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #FDFDFD; cursor: pointer; font-size: 13px; color: var(--muted);
    transition: border-color var(--curve-fast), background var(--curve-fast);
}
.status-total i { font-size: 15px; }
.status-total.ok i { color: var(--ok); }
.status-total.bad i { color: var(--danger); }
.status-total b { font-size: 22px; color: var(--ink); line-height: 1; }
.status-total:hover, .status-total:focus-visible { border-color: var(--border-2); background: #FAFBFC; }

.swal-scope { text-align: left; margin: 4px 0 0; }
.swal-scope-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.swal-scope-select { width: 100%; padding: 8px 10px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); font-size: 14px; background: var(--surface); color: var(--ink); }
.swal-scope-hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ============================================================
   Lucide icons (replaces FontAwesome)
   The runtime renders <i data-lucide> as 24px-viewbox SVGs with
   class "lucide lucide-<name>". Size/colour them like FA glyphs.
   ============================================================ */
.lucide { width: 1em; height: 1em; vertical-align: -0.2em; flex-shrink: 0; }
.lucide, .lucide svg { stroke-width: 2.5; }

.tb-dd-btn .lucide-chevron-down { width: 11px; height: 11px; color: var(--faint); }
.card-title .lucide, .loc-count .lucide, .detail-card h3 .lucide { color: var(--accent); }
.f-meta .lucide { width: 12px; height: 12px; margin-right: 3px; }
.feed-empty .lucide { display: block; max-width: 30px; margin: 0 auto 8px; opacity: .5; }
.empty-state .lucide { min-width: 30px; margin: 0 auto 10px; display: block; opacity: .4; }
.search-box .lucide { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.activity-mini-item .lucide { width: 15px; height: 15px; }
.action-btn .lucide { width: 15px; height: 15px; }
.action-btn:hover .lucide { color: #fff; }
.bulk-bar-count .lucide { color: #7FA8F5; }
.pv-empty .lucide { display: block; max-width: 24px; margin: 0 auto 8px; }
.pv-empty.pv-error .lucide { color: var(--danger); }
.filter-chip .lucide { width: 12px; height: 12px; }
.status-total .lucide { width: 16px; height: 16px; }
.status-total.ok .lucide { color: var(--ok); }
.status-total.bad .lucide { color: var(--danger); }

@keyframes lc-spin { to { transform: rotate(360deg); } }
.lucide-loader-circle { animation: lc-spin .9s linear infinite; }

/* ============================================================
   SweetAlert2 — match body font sizing so popups/notifications
   read clearly at the same scale as page content.
   ============================================================ */
.swal2-popup { font-size: 15px; }
.swal2-title { font-size: 1.25em; line-height: 1.3; }
.swal2-html-container { font-size: 1em; line-height: 1.45; }
.swal2-confirm, .swal2-cancel, .swal2-deny { font-size: 1em; }
.swal2-icon { font-size: 1em; }
.swal2-success-ring, .swal2-icon.swal2-success .swal2-success-ring { font-size: inherit; }
.swal2-toast { font-size: 15px; }
.swal2-toast .swal2-title { font-size: 1em; }
.swal2-toast .swal2-html-container { font-size: .95em; }
.swal2-input, .swal2-file, .swal2-textarea,
.swal2-select, .swal2-radio, .swal2-checkbox { font-size: 1em; }

/* ============================================================
   Settings page
   ============================================================ */
.settings-tabs { margin-bottom: 22px; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}
.settings-stack,
.settings-single { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.settings-stack .card { margin: 0; }

.settings-stack .card-header,
.settings-stack .card-body,
.settings-single .card-header,
.settings-single .card-body { padding-left: 18px; padding-right: 18px; }
.settings-stack .card-header,
.settings-single .card-header { padding-top: 13px; padding-bottom: 13px; }
.settings-stack .card-body,
.settings-single .card-body { padding-top: 14px; padding-bottom: 18px; }

.settings-stack .detail-item,
.settings-single .detail-item { padding-top: 6px; padding-bottom: 12px; }

.settings-sep { height: 1px; background: var(--border); margin: 8px 0 18px; }

.settings-form { display: flex; flex-direction: column; gap: 15px; }
.settings-form .form-group { gap: 6px; }
.settings-form .form-actions { padding-top: 2px; }

@media (max-width: 960px) {
    .settings-grid { grid-template-columns: 1fr; }
}

/* --- Users page ---------------------------------------------------- */
.form-input-sm { width: 150px; }
.role-inline,
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.role-saved {
    display: inline-block;
    font-size: 11px;
    color: var(--ok, #16a34a);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.role-saved.shown { opacity: 1; }
.btn-icon-danger:hover { color: #dc2626; }
