/* v4.77 — the console frame (redesign stage 5; consoleframe.js). Everything here is
   scoped to body.cf-on, which consoleframe.js sets only on a PC-sized window, so
   phones keep today's layout and removing the class restores the old look.
   cf-dash = the Dashboard (index2.html), cf-map = the Map view (index.html). */

:root {
    --cf-bar: #13233a;        /* the title bar, both themes */
    --cf-bar-2: #22344f;      /* its controls */
    --cf-bar-line: #34496a;
    --cf-bar-text: #ffffff;
    --cf-bar-muted: #b4c2d4;  /* 7.6:1 on the bar */
    --cf-bar-h: 48px;
}

/* ---- Search (both consoles) ---- */
body.cf-on .cf-search {
    position: relative; flex: 1 1 260px; max-width: 460px; min-width: 180px;
    display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
    background: var(--cf-bar-2); border: 1px solid var(--cf-bar-line); border-radius: 8px; color: var(--cf-bar-muted);
}
body.cf-on .cf-search:focus-within { border-color: #7fb3ff; box-shadow: 0 0 0 2px rgba(127, 179, 255, .35); }
body.cf-on .cf-search-ic { display: flex; font-size: 14px; }
body.cf-on .cf-search input {
    flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--cf-bar-text);
    font: inherit; font-size: 13px; padding: 0; margin: 0; height: 30px; box-shadow: none;
}
body.cf-on .cf-search input::placeholder { color: var(--cf-bar-muted); opacity: 1; }
body.cf-on .cf-kbd { font-family: inherit; font-size: 11px; border: 1px solid #4a6286; border-radius: 4px; padding: 1px 5px; color: var(--cf-bar-muted); white-space: nowrap; }
body.cf-on .cf-search-list {
    position: absolute; top: 38px; left: 0; right: 0; z-index: 20000; margin: 0; padding: 6px; list-style: none;
    background: #ffffff; color: #1b2433; border: 1px solid #dfe5ee; border-radius: 10px; box-shadow: 0 12px 30px rgba(19, 35, 58, .25);
    max-height: 60vh; overflow-y: auto;
}
body.cf-on .cf-opt { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
body.cf-on .cf-opt.on, body.cf-on .cf-opt:hover { background: #eef3fb; }
body.cf-on .cf-kind { flex: none; width: 64px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #5b6678; }
body.cf-on .cf-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.cf-on .cf-none { padding: 8px 10px; color: #5b6678; font-size: 14px; }

/* ---- Brand (both consoles) ---- */
body.cf-on .cf-brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--cf-bar-text); }
body.cf-on .cf-mark { width: 34px; height: 28px; background: #ffffff; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
body.cf-on .cf-mark img { width: 28px; height: auto; }
body.cf-on .cf-brand strong { font-size: 16px; white-space: nowrap; }
body.cf-on .cf-group { font-size: 14px; color: var(--cf-bar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
body.cf-on .cf-group:empty { display: none; }

/* ==== Dashboard ==== */
body.cf-on.cf-dash.app-layout {
    grid-template-columns: 84px 1fr;
    grid-template-rows: var(--cf-bar-h) 1fr;
}
body.cf-on.cf-dash .cf-titlebar {
    grid-column: 1 / -1; grid-row: 1; height: var(--cf-bar-h); box-sizing: border-box;
    display: flex; align-items: center; gap: 12px; padding: 0 14px;
    background: var(--cf-bar); color: var(--cf-bar-text); z-index: 1100; min-width: 0;
}
body.cf-on.cf-dash .cf-fill { flex: 1; }
body.cf-on.cf-dash .cf-live { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cf-bar-muted); flex: none; }
body.cf-on.cf-dash .cf-live .dot { width: 8px; height: 8px; }
body.cf-on.cf-dash .cf-titlebar .head-who { flex: none; }
body.cf-on.cf-dash .cf-titlebar #ctrl-status { color: var(--cf-bar-text) !important; font-size: 13px !important; }
body.cf-on.cf-dash .cf-titlebar .head-who .app-version { color: var(--cf-bar-muted) !important; background: transparent !important; border: 1px solid var(--cf-bar-line); }
body.cf-on.cf-dash .cf-titlebar .seg { background: var(--cf-bar-2); border-color: var(--cf-bar-line); }
body.cf-on.cf-dash .cf-titlebar .seg button { color: #c9d5e3; }
body.cf-on.cf-dash .cf-titlebar .seg button.on { background: #ffffff; color: var(--cf-bar); }
body.cf-on.cf-dash .cf-titlebar .btn-head { background: var(--cf-bar-2); color: var(--cf-bar-text); border-color: var(--cf-bar-line); }
body.cf-on.cf-dash .cf-titlebar .btn-head:hover { background: #2c4466; }
body.cf-on.cf-dash .cf-titlebar #btn-auth { border-color: #f1a7b2; color: #ffd6dc; }

/* The rail: the sidebar, slimmed. */
body.cf-on.cf-dash .sidebar { grid-column: 1; grid-row: 2; height: auto; background: var(--bg-card); border-right: 1px solid var(--border); color: var(--text-primary); }
body.cf-on.cf-dash .sidebar-brand, body.cf-on.cf-dash .nav-group, body.cf-on.cf-dash .sidebar-footer { display: none; }
body.cf-on.cf-dash .sidebar-nav { padding: 10px 6px; display: flex; flex-direction: column; gap: 4px; min-height: 100%; box-sizing: border-box; }
body.cf-on.cf-dash .sidebar .nav-item {
    flex-direction: column; gap: 4px; padding: 9px 0; margin: 0; border-radius: 10px; text-align: center;
    color: var(--text-secondary); font-size: 12px; font-weight: 600; box-shadow: none; background: transparent; border: 0; font-family: inherit; width: 100%;
}
body.cf-on.cf-dash .sidebar .nav-item .nav-icon { width: auto; font-size: 20px; }
body.cf-on.cf-dash .sidebar .nav-item:hover { background: var(--bg-app); color: var(--text-primary); }
body.cf-on.cf-dash .sidebar .nav-item.active { background: rgba(200, 16, 46, .10); color: #b0102a; box-shadow: none; }
body.dark-theme.cf-on.cf-dash .sidebar .nav-item.active { color: #ff8a98; }
/* New job and Phone job live in the toolbar now (still in the phone tab bar). */
body.cf-on.cf-dash .sidebar .nav-item[data-view="log-job"], body.cf-on.cf-dash .sidebar .nav-item.nav-phonejob { display: none; }
body.cf-on.cf-dash .cf-rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }

body.cf-on.cf-dash .main-content { grid-column: 2; grid-row: 2; height: auto; min-height: 0; }
body.cf-on.cf-dash .content-header { padding: 0; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; display: block; }
body.cf-on.cf-dash #job-ticker { display: none !important; }   /* shown as "Latest activity" (still updated underneath) */
body.cf-on.cf-dash .content-body { max-width: none; padding: 14px 24px 18px; }

/* The toolbar: heading, three counts, the actions as buttons. */
body.cf-on.cf-dash .ops-top { gap: 14px; margin-bottom: 14px; }
body.cf-on.cf-dash .ops-top .ops-title { font-size: 22px; margin: 0; }
body.cf-on.cf-dash .ops-top .dashboard-greeting { display: none; }
body.cf-on.cf-dash .ops-top .stats-grid { flex: 0 1 auto; gap: 8px; }
body.cf-on.cf-dash .ops-top .stat-card { border-radius: 999px; padding: 5px 12px; box-shadow: none; border: 1px solid var(--border); background: var(--bg-card); }
body.cf-on.cf-dash .ops-top .stat-card::before, body.cf-on.cf-dash .ops-top .stat-card::after { display: none; }
body.cf-on.cf-dash .ops-top .stat-card .stat-value { font-size: 15px; color: var(--text-primary); }
body.cf-on.cf-dash .ops-top .stat-card .stat-label { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--text-secondary); }
body.cf-on.cf-dash .ops-top .quick-actions { margin-left: auto; gap: 8px; flex-wrap: wrap; }
body.cf-on.cf-dash .ops-top .quick-action-card {
    height: 40px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-card);
    box-shadow: none; transform: none; font-family: inherit; color: var(--text-primary);
}
body.cf-on.cf-dash .ops-top .quick-action-card .qa-icon { font-size: 15px; width: auto; height: auto; background: none; color: inherit; }
body.cf-on.cf-dash .ops-top .quick-action-card .qa-text h4 { font-size: 14px; font-weight: 600; color: inherit; }
body.cf-on.cf-dash .ops-top .quick-action-card:first-child { background: #c8102e; border-color: #c8102e; color: #ffffff; }
body.cf-on.cf-dash .ops-top .quick-action-card:first-child .qa-text h4 { font-weight: 700; color: #ffffff; }

/* Three columns: Needs you | Moving + Done today | the side column. */
body.cf-on.cf-dash .ops-grid { grid-template-columns: minmax(0, 1fr) 330px; }
body.cf-on.cf-dash .ops-grid.panel-open { grid-template-columns: minmax(0, 1fr) 420px; }
body.cf-on.cf-dash .ops-board { background: transparent; border: 0; }
body.cf-on.cf-dash .ops-board > .dashboard-section-header { border: 0; padding: 0 0 8px; background: transparent; }
body.cf-on.cf-dash .ops-board > .dashboard-section-body { padding: 0; }
body.cf-on.cf-dash .lanes-wrap {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: auto 1fr;
    align-items: start; gap: 16px;
}
body.cf-on.cf-dash .lanes-wrap > .lane-needs { grid-column: 1; grid-row: 1 / span 2; }
body.cf-on.cf-dash .lanes-wrap > .lane-moving { grid-column: 2; grid-row: 1; grid-template-columns: minmax(0, 1fr); }
body.cf-on.cf-dash .lanes-wrap > .lane-done { grid-column: 2; grid-row: 2; }
body.cf-on.cf-dash .lane-col.lane-needs { grid-template-columns: minmax(0, 1fr); }
body.cf-on.cf-dash .lane-col { background: transparent; border: 0; padding: 0; min-height: 0; }
body.cf-on.cf-dash .lane-col.lane-needs.has-items { border: 0; background: transparent; }
body.cf-on.cf-dash .lane-col .lane-h { font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text-primary); }
body.cf-on.cf-dash .lane-col.lane-needs.has-items .lane-h { color: var(--text-primary); }
body.cf-on.cf-dash .lane-col .lane-empty { background: var(--bg-card); border: 1px dashed var(--border); border-radius: 10px; padding: 14px; }

/* Latest activity: the ticker as a list. */
body.cf-on.cf-dash .cf-activity-list { margin: 0; padding: 0 0 4px; list-style: none; }
body.cf-on.cf-dash .cf-act { padding: 7px 14px; border-bottom: 1px solid var(--border); line-height: 1.35; }
body.cf-on.cf-dash .cf-act:last-child { border-bottom: 0; }
body.cf-on.cf-dash .cf-act.muted { color: var(--text-secondary); }

/* ==== Map view: its header becomes the same title bar ==== */
body.cf-on.cf-map > header.cf-titlebar { background: var(--cf-bar); }
/* The Map view's header is already full (and holds the LATE line), so its search is a
   magnifier button that opens into a box over the header when clicked or on Ctrl+K. */
body.cf-on.cf-map .cf-search { flex: none; width: 36px; min-width: 0; padding: 0; justify-content: center; cursor: text; }
body.cf-on.cf-map .cf-search .cf-kbd { display: none; }
body.cf-on.cf-map .cf-search input { position: absolute; left: 0; top: 0; width: 34px; height: 30px; opacity: 0; padding: 0; }
body.cf-on.cf-map .cf-search:focus-within input {
    opacity: 1; width: 340px; height: 32px; top: -1px; left: -1px; padding: 0 10px; z-index: 20001;
    background: var(--cf-bar-2); border: 1px solid #7fb3ff; border-radius: 8px;
}
body.cf-on.cf-map .cf-search-list { right: auto; width: 420px; }
body.cf-on.cf-map > header.cf-titlebar .brand { display: flex; align-items: center; gap: 8px; }

/* ==== v4.79 — the Map view's own layout (redesign stage 6, plan 7.3; consoleframe.js
   buildMapLayout). The map fills the window under the title bar; the sidebar's contents
   are in floating panels (boxes.js boxes cf:jobs / cf:fleet / cf:job); Fit to fleet and
   the Map view menu sit in a bar along the bottom. cf-maplayout is set only once the
   panels exist, so if anything fails the old sidebar stays. ==== */
body.cf-on.cf-map.cf-maplayout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
body.cf-on.cf-map.cf-maplayout > header { grid-row: 1; grid-column: 1 / -1; }
body.cf-on.cf-map.cf-maplayout #map-container { grid-row: 2; grid-column: 1 / -1; }
body.cf-on.cf-map.cf-maplayout #panel-left,
body.cf-on.cf-map.cf-maplayout #resizer-left,
body.cf-on.cf-map.cf-maplayout #ticker-strip { display: none !important; }   /* emptied into the panels; the ticker is "Latest activity" */

/* The panels: below windows, alarms and menus; above the map. */
body.cf-on.cf-map .abx[data-box-id^="cf:"] { z-index: 1250 !important; min-height: 120px; }
body.cf-on.cf-map:has(.expand-panel.open) .abx[data-box-id^="cf:"] { display: none; }
body.cf-on.cf-map .cf-ppanel { text-align: left; }
body.cf-on.cf-map .cf-ppanel #list-jobs,
body.cf-on.cf-map .cf-ppanel #list-fleet,
body.cf-on.cf-map .cf-ppanel #list-history { height: auto !important; max-height: none !important; min-height: 0 !important; flex: none !important; overflow: visible !important; text-align: left !important; padding: 0; }
body.cf-on.cf-map .cf-ppanel #list-history { padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }
body.cf-on.cf-map .cf-ppanel .abx-popout-btn,
body.cf-on.cf-map .cf-ppanel .abx-swap-btn { display: none !important; }   /* the panel is already a box */
body.cf-on.cf-map .cf-ppanel .sidebar-h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }

/* New job, Phone job, Allocate: the existing buttons, as a row at the top of the jobs panel. */
body.cf-on.cf-map .cf-pactions { display: flex; gap: 6px; margin: 0 0 10px; }
body.cf-on.cf-map .cf-pactions > button {
    position: static !important; flex: 1 1 0; width: auto !important; height: 36px !important; min-width: 0;
    display: inline-flex !important; align-items: center; justify-content: center; gap: 6px;
    border-radius: 8px !important; padding: 0 10px !important; box-shadow: none !important;
    font-family: inherit; font-size: 13px !important; font-weight: 700 !important; cursor: pointer; white-space: nowrap;
}
body.cf-on.cf-map .cf-pactions #fab-newjob { background: #c8102e !important; color: #ffffff !important; border: 0 !important; }
body.cf-on.cf-map .cf-pactions #fab-newjob:hover { background: #a50d26 !important; }
body.cf-on.cf-map .cf-pactions #fab-phonejob,
body.cf-on.cf-map .cf-pactions .cf-alloc { background: transparent !important; color: inherit !important; border: 1px solid var(--border) !important; font-weight: 600 !important; }
body.cf-on.cf-map .cf-pactions #fab-phonejob:hover,
body.cf-on.cf-map .cf-pactions .cf-alloc:hover { background: rgba(127, 179, 255, .14) !important; }

/* Active fleet | Latest activity */
body.cf-on.cf-map .cf-tabs { display: flex; gap: 4px; margin: 0 0 8px; }
body.cf-on.cf-map .cf-tab { height: 30px; border: 0; border-radius: 7px; background: transparent; color: inherit; opacity: .8; font: inherit; font-size: 13px; font-weight: 600; padding: 0 10px; cursor: pointer; }
body.cf-on.cf-map .cf-tab.on { background: var(--cf-bar); color: #ffffff; opacity: 1; font-weight: 700; }
body.cf-on.cf-map .cf-pane[hidden] { display: none !important; }
body.cf-on.cf-map .cf-activity-list { margin: 0; padding: 0; list-style: none; }
body.cf-on.cf-map .cf-act { padding: 7px 4px; border-bottom: 1px solid var(--border); line-height: 1.35; }
body.cf-on.cf-map .cf-act:last-child { border-bottom: 0; }
body.cf-on.cf-map .cf-act.muted { color: var(--text-muted); }

/* The job opened on the right, and its row in the list. */
body.cf-on.cf-map #cf-jobsel .jc { margin: 0 !important; }
body.cf-on.cf-map .cf-selnote { margin: 6px 2px; color: var(--text-muted); font-size: .9rem; }
body.cf-on.cf-map #cf-jobs-panel .jc.cf-sel { box-shadow: 0 0 0 2px #3b82f6; }

/* The bar along the bottom of the map, centred in the room right of the panels. */
body.cf-on.cf-map .cf-mapbar {
    position: absolute; left: calc(50% + 186px); bottom: 14px; transform: translateX(-50%); z-index: 1290;
    display: flex; align-items: center; gap: 4px; padding: 5px; white-space: nowrap;
    background: var(--cf-bar); color: var(--cf-bar-text); border-radius: 12px; box-shadow: 0 6px 22px rgba(19, 35, 58, .3);
}
body.cf-on.cf-map .cf-mapbar #btn-fit-fleet,
body.cf-on.cf-map .cf-mapbar .btn-head,
body.cf-on.cf-map .cf-barbtn {
    position: static; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--cf-bar-text);
    box-shadow: none; font-family: inherit; font-size: 13px; font-weight: 600; padding: 0 12px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px;
}
body.cf-on.cf-map .cf-mapbar #btn-fit-fleet:hover,
body.cf-on.cf-map .cf-mapbar .btn-head:hover,
body.cf-on.cf-map .cf-barbtn:hover,
body.cf-on.cf-map .cf-barbtn[aria-pressed="true"] { background: #2c4468; }
body.cf-on.cf-map .cf-barsep { width: 1px; height: 22px; background: var(--cf-bar-line); }
body.cf-on.cf-map .cf-mapbar .hmenu-panel {
    top: auto; bottom: calc(100% + 10px); left: 0; right: auto;
    max-height: calc(100vh / var(--ui-z, 1) - 160px) !important; overflow-y: auto;
}
/* The map's zoom buttons: bottom right, above the chat button (the panels cover top left). */
body.cf-on.cf-map.cf-maplayout .leaflet-top.leaflet-left { top: auto; bottom: 150px; left: auto; right: 14px; }

/* Riders on the map: white name tags with what they are doing in words; red when late
   or SOS. (app.js draws the words; style.css hides them on other windows.) */
body.cf-on.cf-map .rider-label .rl-name,
body.cf-on.cf-map .rider-label .rl-word { display: inline; }
body.cf-on.cf-map .rider-wrapper .rider-label {
    background: #ffffff; color: #1b2433; border: 1px solid #c9d2de; border-radius: 999px;
    padding: 3px 10px 3px 4px; font-size: 12px; font-weight: 600; gap: 5px !important;
    box-shadow: 0 2px 6px rgba(19, 35, 58, .28); backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.cf-on.cf-map .rider-wrapper .rider-label > span:nth-of-type(1) { font-weight: 800; }
body.cf-on.cf-map .rider-wrapper .rl-word { color: #4a5568; }
body.cf-on.cf-map .rider-wrapper .rl-word::before { content: "\00B7\00A0"; }
body.cf-on.cf-map .rider-wrapper.rl-late .rider-label { background: #b91c1c; color: #ffffff; border-color: #b91c1c; }
body.cf-on.cf-map .rider-wrapper.rl-late .rl-word { color: #ffffff; font-weight: 700; }
