:root {
  --ink: #0f172a;
  --muted: #64748b;
  --green: #059669;
  --green-deep: #047857;
  --accent-bg: #ecfdf5;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.55 Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  border: 0;
  font-weight: 600;
  transition: all 0.16s ease;
  touch-action: manipulation;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 10px 13px;
  background: #fff;
  border-radius: 10px;
  color: var(--ink);
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
input[type=checkbox] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}
label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1 {
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin: 6px 0 8px;
}
h1 em { font-style: normal; color: var(--green); }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--green); text-decoration: none; font-weight: 600; }
.ui-icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

/* Brand & Sidebar */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  letter-spacing: -0.5px;
  font-weight: 800;
  color: #fff;
}
.brand-light { font-weight: 400; color: #34d399; }
.brand small {
  display: block;
  letter-spacing: 1.2px;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  margin-top: 2px;
}
.brand-mark {
  display: flex;
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  display: flex;
  gap: 8px;
  align-items: center;
}
.tiny-line { height: 2px; width: 16px; background: var(--green); border-radius: 2px; }
.muted { color: var(--muted); font-size: 13px; }

/* Buttons */
.primary, .secondary, .light, .ghost, .icon-btn, .danger-btn {
  padding: 10px 16px;
  border-radius: 10px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
}
.primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}
.primary:hover:not(:disabled) { background: var(--green-deep); transform: translateY(-1px); }
.danger-btn {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.danger-btn:hover:not(:disabled) { background: #dc2626; }
.secondary {
  background: #fff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}
.secondary:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
.light { background: #fff; color: #0f172a; font-weight: 700; }
.ghost {
  color: #94a3b8;
  background: transparent;
  justify-content: flex-start;
  width: 100%;
  padding: 10px 12px;
}
.ghost:hover { color: #fff; background: rgba(255,255,255,0.06); }
.text-btn {
  color: var(--green);
  background: none;
  padding: 6px 10px;
  min-height: 36px;
  font-size: 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.text-btn:hover { background: var(--accent-bg); }
.icon-btn {
  padding: 8px;
  background: #f1f5f9;
  color: #334155;
  min-width: 38px;
  min-height: 38px;
  border-radius: 9px;
}
.icon-btn:hover { background: #e2e8f0; }
.wide { width: 100%; justify-content: center; }
.badge {
  display: inline-flex;
  background: var(--accent-bg);
  color: var(--green-deep);
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.6px;
  font-weight: 800;
}

/* Login Screen */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  padding: 60px 10%;
  background: linear-gradient(145deg, #0f172a 0%, #064e3b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-art h1 { font-size: clamp(38px, 4vw, 56px); margin-top: 40px; color: #fff; }
.login-art p { color: #cbd5e1; font-size: 16px; max-width: 420px; }
.orbit {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 18px;
  border-radius: 999px;
  width: fit-content;
  margin: 24px 0;
  font-size: 12px;
  letter-spacing: 1.5px;
  font-weight: 700;
}
.fine { font-size: 11px; color: #6ee7b7; letter-spacing: 1.2px; margin-top: 30px; }
.login-form { max-width: 420px; margin: auto; padding: 40px; width: 100%; }
#otp {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 8px;
  height: 58px;
  background: #f8fafc;
}

/* Sidebar Layout */
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: #0f172a;
  color: #f8fafc;
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 800;
  color: #64748b;
  margin: 32px 12px 10px;
}
nav { display: grid; gap: 6px; }
nav button {
  background: none;
  text-align: left;
  color: #cbd5e1;
  padding: 11px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
}
nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
nav button.active {
  background: var(--green);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}
.aside-bottom { margin-top: auto; display: grid; gap: 10px; }
.sidebar-note {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 12px;
  border-radius: 10px;
}
.sidebar-note small { display: block; font-size: 11px; color: #94a3b8; margin-top: 4px; }
.live-dot { font-size: 12px; font-weight: 700; color: #34d399; display: flex; align-items: center; gap: 8px; }
.live-dot:before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* Header & Main Content */
.main-wrap { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
header {
  height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 15;
}
#breadcrumb { font-weight: 700; color: #334155; font-size: 13px; }
.header-search {
  width: 280px;
  position: relative;
  margin-left: auto;
  margin-right: 16px;
}
.header-search input {
  font-size: 13px;
  min-height: 38px;
  background: #f1f5f9;
  border: 1px solid transparent;
  padding-left: 34px;
  border-radius: 999px;
}
.header-search input:focus { background: #fff; border-color: var(--green); }
.header-search .ui-icon { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: #64748b; }
.header-search kbd { position: absolute; right: 12px; top: 9px; font-size: 11px; color: #94a3b8; }
.header-right { display: flex; align-items: center; gap: 12px; }
.clock-pill {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
}
.owner {
  background: #0f172a;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
}

main { max-width: 1360px; width: 100%; margin: 0 auto; padding: 28px 32px; flex: 1; }
.intro {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

/* Stats Row */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.stats article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-top small { font-size: 11px; font-weight: 800; letter-spacing: 0.8px; color: #64748b; }
.stat-top .ui-icon { color: var(--green); }
.stats strong { font-size: 32px; font-weight: 800; color: #0f172a; line-height: 1.1; }
.stats article > span { font-size: 12px; color: var(--muted); }

/* Overview Layout */
.overview-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 22px;
}
.overview-map-card { padding: 0; overflow: hidden; }
.overview-map-card .section-head { padding: 18px 22px; margin: 0; }
.overview-map-card select { max-width: 210px; min-height: 38px; padding: 6px 10px; font-size: 13px; }
#overviewMap { height: 330px; z-index: 0; background: #e2e8f0; }
.map-card-foot {
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}
.map-card-foot b { font-size: 14px; display: block; }
.map-card-foot span { font-size: 12px; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.section-head h2, .section-head h3 { margin: 0; }

.dark {
  background: linear-gradient(135deg, #0f172a 0%, #065f46 100%);
  color: #fff;
  border: 0;
}
.dark h2 { font-size: 22px; margin: 10px 0; color: #fff; }
.dark p { color: #cbd5e1; font-size: 13px; margin-bottom: 18px; }
.dark .eyebrow { color: #6ee7b7; }

/* Connection Card */
.connection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  background: #f8fafc;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.connection-grid > div { display: grid; gap: 4px; }
.connection-grid small { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #64748b; }
.connection-grid b { font-size: 15px; font-weight: 700; color: #0f172a; }
.connection-grid span { font-size: 12px; color: #475569; overflow-wrap: anywhere; }
.connection-foot {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

/* Lists & Rows */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}
.list-row:last-child { border-bottom: 0; }
.list-row strong { font-size: 14px; display: block; margin-bottom: 2px; }
.list-row small { color: var(--muted); font-size: 12px; }
.date-tile {
  background: var(--accent-bg);
  color: var(--green-deep);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 48px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
}
.date-tile small { display: block; font-size: 9px; text-transform: uppercase; }
.row-start { display: flex; align-items: center; gap: 14px; }
.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  background: #f1f5f9;
  color: #475569;
}
.status-pill.running { background: #dcfce7; color: #15803d; }
.status-pill.completed { background: #e0f2fe; color: #0369a1; }
.status-pill.cancelled, .status-pill.failed { background: #fee2e2; color: #b91c1c; }

/* Route Library */
.library-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
.folder-card { align-self: start; padding: 16px; }
.folder-card button.folder {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  background: none;
  color: #475569;
  font-size: 13px;
}
.folder-card button.folder small {
  margin-left: auto;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.folder-card button.folder.active {
  background: var(--accent-bg);
  color: var(--green-deep);
  font-weight: 700;
}
.library-search { margin-bottom: 18px; position: relative; display: flex; align-items: center; }
.library-search > .ui-icon { position: absolute; left: 14px; color: #64748b; }
.search-input { padding-left: 40px; font-size: 14px; }
.library-search > span { position: absolute; right: 14px; font-size: 12px; color: var(--muted); }
.route-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.route-card { padding: 0; overflow: hidden; transition: transform 0.15s, box-shadow 0.15s; }
.route-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1); }
.route-card-head { padding: 18px 20px 0; }
.route-card h3 { font-size: 18px; margin: 6px 0 0; }
.route-mini { height: 120px; background: #f1f5f9; position: relative; margin-top: 14px; }
.route-mini svg { width: 100%; height: 100%; }
.route-mini .mini-label {
  position: absolute;
  left: 12px;
  top: 10px;
  background: rgba(255,255,255,0.9);
  color: #0f172a;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 800;
  border-radius: 6px;
}
.route-meta { display: flex; gap: 24px; padding: 14px 20px; border-bottom: 1px solid #f1f5f9; }
.route-meta div { font-size: 14px; font-weight: 800; }
.route-meta small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.route-path-label { display: flex; gap: 8px; align-items: center; padding: 12px 20px 0; font-size: 12px; color: #475569; }
.route-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 20px 18px; }

/* Calendar */
.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; min-width: 0; }
.week-head, #calendarGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-head { text-align: center; font-size: 11px; font-weight: 800; color: #64748b; margin: 16px 0 10px; }
#calendarGrid button {
  min-height: 52px;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}
#calendarGrid button:hover { background: #ecfdf5; border-color: #6ee7b7; }
#calendarGrid button.today { border: 2px solid var(--green); font-weight: 800; }
#calendarGrid button.selected { background: var(--green); color: #fff; border-color: var(--green); }
#calendarGrid .event-dot { display: block; width: 6px; height: 6px; background: #f59e0b; border-radius: 50%; margin: 4px auto 0; }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.weekdays label { display: flex; align-items: center; gap: 6px; margin: 0; background: #f1f5f9; padding: 8px 12px; border-radius: 8px; }
.hint {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}
.error { color: #dc2626; font-size: 13px; font-weight: 600; }

/* LIVE BROWSER SIDE-BY-SIDE WORKSPACE */
.live-top-bar { display: grid; gap: 14px; margin-bottom: 18px; }
.browser-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}
.browser-summary > div { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.browser-summary small { color: var(--muted); font-size: 12px; }
.live-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}
.live-route-preview {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.live-route-preview > label { flex: 1; min-width: 180px; margin: 0; }
.live-route-preview > small { width: 100%; color: var(--muted); font-size: 12px; margin-top: 4px; }

.live-browser-card { padding: 0; overflow: hidden; }
.browser-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
}
.browser-toolbar input { flex: 1; margin: 0; background: #fff; }
.browser-arrows { display: flex; gap: 6px; }
.browser-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}
.browser-caption > div { display: flex; align-items: center; gap: 10px; }
.phone-profile-pill { background: #f1f5f9; color: #334155; padding: 4px 10px; border-radius: 999px; font-size: 11px; }
.transport-pill { color: var(--green); font-size: 11px; font-weight: 700; }

.browser-workspace-grid {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  align-items: start;
}
.browser-stage {
  background: #0f172a;
  min-height: 540px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.browser-stage p { color: #94a3b8; }
.browser-stage canvas, .browser-stage img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 75vh;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  touch-action: none;
}
.browser-input-panel { padding: 24px; border-left: 1px solid var(--line); }
.browser-input-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.browser-type-row { display: flex; gap: 8px; }
.browser-type-row input { flex: 1; }
.browser-keys { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.remote-keyboard { position: fixed; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Dialogs & Modals */
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  max-height: 92dvh;
  max-width: 1140px;
  width: calc(100% - 40px);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.25);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px); }
.dialog-head {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.editor-layout { display: grid; grid-template-columns: 420px 1fr; min-height: 500px; }
.editor-fields { padding: 20px 24px; max-height: 68dvh; overflow-y: auto; }
.editor-map { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
#editMap { flex: 1; min-height: 440px; z-index: 0; }
.map-caption { padding: 12px 18px; font-size: 12px; background: #f8fafc; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.search-box { display: flex; align-items: end; gap: 8px; margin-bottom: 12px; }
.search-box label { flex: 1; margin: 0; }
.builder-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0 18px; }
.stop-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.stop-card .stop-title { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.stop-num {
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}
.stop-bottom { display: flex; align-items: center; justify-content: space-between; }
.stop-bottom label { display: flex; align-items: center; gap: 6px; margin: 0; }
.dialog-foot {
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}
.dialog-foot > div { display: flex; gap: 10px; }
#runDialog { max-width: 960px; }
.run-body { padding: 24px; }
.run-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.run-status strong { font-size: 32px; font-weight: 800; }
#runMap, #mapPreviewMap { height: 350px; border-radius: 12px; margin-top: 14px; border: 1px solid var(--line); }
.run-controls { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
progress { width: 100%; height: 8px; accent-color: var(--green); margin-top: 14px; }
#smallDialog, #startDialog, #accountDialog { max-width: 440px; }
.number-pin {
  border-radius: 50%;
  border: 2px solid var(--green-deep);
  background: #fff;
  color: #0f172a;
  line-height: 24px;
  text-align: center;
  font-weight: 800;
  font-size: 12px;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  background: #0f172a;
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  font-weight: 600;
}

@media (max-width: 960px) {
  .overview-layout, .two-col, .browser-workspace-grid, .editor-layout, .library-layout, .route-grid, .connection-grid {
    grid-template-columns: 1fr;
  }
  .browser-input-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  aside {
    inset: auto 0 0 0;
    width: 100%;
    height: auto;
    padding: 6px 8px;
    flex-direction: row;
  }
  aside .brand, .aside-bottom, .nav-label { display: none; }
  nav { display: flex; width: 100%; justify-content: space-around; }
  nav button { flex-direction: column; gap: 4px; font-size: 10px; padding: 8px; min-height: 48px; }
  .main-wrap { margin-left: 0; padding-bottom: 74px; }
  header { padding: 0 16px; }
  .header-search { display: none; }
  main { padding: 20px 16px; }
  .stats { grid-template-columns: 1fr; }
}

/* Live browser focus view: keep browser navigation and keyboard reachable. */
body.browser-focused { overflow: hidden; }
.live-browser-card.focused {
 position: fixed; inset: 12px; z-index: 1000; margin: 0;
 height: calc(100dvh - 24px); display: flex; flex-direction: column;
 background: #fff; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(15,23,42,.6);
}
.live-browser-card.focused .browser-toolbar,
.live-browser-card.focused .browser-caption { flex-shrink: 0; }
.live-browser-card.focused .browser-toolbar input { min-width: 0; }
.live-browser-card.focused .browser-caption { flex-wrap: wrap; gap: 6px; }
.live-browser-card.focused .browser-caption > div { flex-wrap: wrap; gap: 8px; }
.live-browser-card.focused .browser-workspace-grid { flex: 1; min-height: 0; display: flex; }
.live-browser-card.focused .browser-stage { flex: 1; height: 100%; min-height: 0; min-width: 0; padding: 10px; }
.live-browser-card.focused .browser-stage canvas,
.live-browser-card.focused .browser-stage img { max-height: 100%; max-width: 100%; object-fit: contain; }
.live-browser-card.focused .browser-input-panel { display: none; }
.live-browser-card.focused ~ #browserError:not(:empty) {
 position: fixed; bottom: 16px; left: 24px; right: 24px; z-index: 1001;
 margin: 0; padding: 8px 12px; background: #fff; border-radius: 8px;
}
@media (max-width: 600px) {
 .live-browser-card.focused { inset: 0; height: 100dvh; border-radius: 0; }
 .live-browser-card.focused .browser-toolbar { padding: 8px; gap: 6px; }
 .live-browser-card.focused .browser-arrows { gap: 2px; }
 .live-browser-card.focused .browser-caption { padding: 6px 8px; }
 .live-browser-card.focused .phone-profile-pill { display: none; }
}

/* Add-on: independent live browser location map, below the existing Tip. */
.live-location-card { margin-top: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; }
.live-location-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:18px 18px 0; }
.live-location-head h4 { margin:5px 0 0; font-size:17px; letter-spacing:-.3px; }
.live-location-head .eyebrow { font-size:10px; }
.live-location-source { padding:0 18px; margin:8px 0 14px; font-size:11px; color:var(--muted); }
.live-location-status { font-size:10px; font-weight:700; color:#64748b; white-space:nowrap; border-radius:999px; padding:5px 8px; background:#f1f5f9; }
.live-location-status.fresh { color:#167347; background:#e9f7ee; }
.live-location-status::before { content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background:currentColor; margin-right:5px; }
.live-location-tabs { display:flex; align-items:center; gap:4px; border-bottom:1px solid var(--line); padding:0 12px; }
.live-location-tabs [role=tab] { background:transparent; color:var(--muted); border:0; border-bottom:2px solid transparent; border-radius:0; padding:10px 12px; font-size:12px; box-shadow:none; }
.live-location-tabs [aria-selected=true] { border-color:#269960; color:#167347; font-weight:700; }
.live-location-tabs #liveLocationExpand { margin-left:auto; font-size:11px; }
.live-location-map { height:280px; width:100%; z-index:0; background:#e8eee6; }
.live-location-marker { background:transparent; border:0; }
.live-location-dot { display:block; position:relative; width:18px; height:18px; background:#21ad68; border:3px solid white; border-radius:50%; box-shadow:0 2px 8px #145d3a55; }
.live-location-dot::before,.live-location-dot::after { content:''; position:absolute; inset:-9px; border-radius:50%; border:2px solid #21ad68; animation:live-location-pulse 2.2s ease-out infinite; pointer-events:none; }
.live-location-dot::after { animation-delay:1.1s; }
.live-location-marker.stale .live-location-dot { background:#94a3b8; }
.live-location-marker.stale .live-location-dot::before,.live-location-marker.stale .live-location-dot::after { animation:none; border-color:#94a3b855; }
@keyframes live-location-pulse { 0%{transform:scale(.55);opacity:.7} 100%{transform:scale(1.5);opacity:0} }
.live-location-map-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:7px 12px; border-bottom:1px solid var(--line); background:#f8faf9; }
.live-location-map-tools button { font-size:11px; padding:5px; }
.live-location-map-tools [aria-pressed=true] { color:#167347; font-weight:700; }
.live-location-map-tools span { color:var(--muted); font-size:10px; margin-left:auto; }
.live-location-address { padding:16px 18px; }
.live-location-coordinates { font-size:14px; font-weight:700; font-variant-numeric:tabular-nums; color:#1d5339; overflow-wrap:anywhere; margin-bottom:13px; }
.live-location-address-label { font-size:9px; font-weight:700; letter-spacing:1px; color:var(--muted); }
#liveLocationAddress { font-size:12px; line-height:1.6; margin:6px 0 9px; overflow-wrap:anywhere; }
.live-location-address-footer { display:flex; gap:10px; align-items:start; }
.live-location-address-footer small { flex:1; color:var(--muted); font-size:10px; line-height:1.5; }
#liveLocationRefresh { font-size:10px; white-space:nowrap; padding:0; }
.live-location-details { display:grid; grid-template-columns:1fr 1fr; gap:15px 18px; padding:20px 18px; margin:0; }
.live-location-details div { min-width:0; }
.live-location-details dt { color:var(--muted); font-size:10px; margin-bottom:5px; }
.live-location-details dd { margin:0; font-size:12px; font-weight:600; overflow-wrap:anywhere; }
body.location-map-expanded { overflow:hidden; }
.live-location-card.is-expanded { position:fixed; inset:12px; margin:0; z-index:1100; display:flex; flex-direction:column; box-shadow:0 0 0 100vmax #0f172aa6; }
.live-location-card.is-expanded #liveLocationMapPanel { flex:1; min-height:0; display:flex; flex-direction:column; }
.live-location-card.is-expanded .live-location-map { flex:1; min-height:120px; }
.live-location-card.is-expanded .live-location-map-tools { flex-shrink:0; }
.live-location-card.is-expanded .live-location-address { flex-shrink:0; }
.live-location-card.is-expanded #liveLocationDetailsPanel { overflow:auto; }
@media(max-width:600px) {
 .live-location-map { height:300px; }
 .live-location-head { align-items:start; }
 .live-location-head h4 { font-size:15px; }
 .live-location-map-tools span { flex-basis:100%; margin-left:0; }
 .live-location-card.is-expanded { inset:0; border-radius:0; }
 .live-location-card.is-expanded .live-location-address { padding:10px 14px; }
 .live-location-card.is-expanded .live-location-coordinates { margin-bottom:7px; }
}
@media(prefers-reduced-motion:reduce) { .live-location-dot::before,.live-location-dot::after { animation:none; opacity:.3; } }
