:root {
  color-scheme: dark;
  --bg: #0d1511;
  --surface: #121e17;
  --surface-2: #19291f;
  --surface-3: #20352a;
  --line: rgba(177, 208, 186, .14);
  --text: #edf6ef;
  --muted: #99ad9f;
  --muted-2: #738a7b;
  --accent: #62d6a0;
  --accent-2: #27895f;
  --green: #63d6a2;
  --red: #ff7b83;
  --amber: #ffc66d;
  --shadow: 0 18px 55px rgba(0,0,0,.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(1200px 600px at 85% -8%, rgba(39,137,95,.18), transparent 60%), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell { min-height: 100vh; }
.loading-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg,#92edbd,#299965); display: grid; place-items: center; color: #081b11; font-size: 15px; font-weight: 900; box-shadow: 0 8px 26px rgba(57,190,126,.25); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px,100%); background: rgba(18,30,23,.95); border: 1px solid var(--line); border-radius: 24px; padding: 34px; box-shadow: var(--shadow); }
.login-brand { display:flex; align-items:center; gap:13px; margin-bottom:28px; }
.login-brand h1 { font-size:22px; margin:0; letter-spacing:-.5px; }
.login-brand p { margin:4px 0 0; color:var(--muted); font-size:13px; }
.login-card h2 { margin: 0 0 8px; font-size: 22px; }
.login-card .intro { color: var(--muted); margin: 0 0 24px; line-height: 1.5; font-size: 14px; }
.field { display:flex; flex-direction:column; gap:7px; margin: 0 0 16px; }
.field label, .field-label { color:#b8caba; font-size:12px; font-weight:650; letter-spacing:.03em; }
input, select { color:var(--text); background:#0d1a13; border:1px solid var(--line); border-radius:11px; outline:none; padding:12px 13px; min-height:44px; width:100%; }
input:focus, select:focus { border-color:rgba(98,214,160,.7); box-shadow:0 0 0 3px rgba(98,214,160,.12); }
button.primary, .button-primary { border:0; border-radius:11px; background:linear-gradient(135deg,#9aefc1,#36ab74); color:#071b12; font-weight:750; padding:12px 17px; min-height:44px; }
button.primary:hover, .button-primary:hover { filter:brightness(1.07); }
button.secondary, .button-secondary { border:1px solid var(--line); border-radius:10px; background:var(--surface-2); color:var(--text); padding:10px 13px; min-height:40px; }
button.ghost { border:1px solid transparent; background:transparent; color:var(--muted); padding:9px 11px; border-radius:9px; }
button.danger { color:var(--red); border:1px solid rgba(255,123,131,.25); background:rgba(255,123,131,.07); border-radius:10px; padding:8px 11px; }
button:disabled { opacity:.45; cursor:not-allowed; }
.full { width:100%; }
.form-error { color:var(--red); font-size:13px; min-height:18px; margin: 6px 0 13px; }
.small-note { color:var(--muted-2); font-size:12px; line-height:1.55; margin:12px 0 0; }
.layout { display:grid; grid-template-columns:238px minmax(0,1fr); min-height:100vh; }
.sidebar { border-right:1px solid var(--line); background:rgba(13,23,17,.78); padding:24px 16px; display:flex; flex-direction:column; gap:30px; }
.sidebar-brand { display:flex; align-items:center; gap:12px; padding:0 10px; }
.sidebar-brand strong { font-size:17px; letter-spacing:-.4px; }
.sidebar-brand small { display:block; font-size:10px; color:var(--muted-2); letter-spacing:.14em; text-transform:uppercase; margin-top:3px; }
.nav-group { display:flex; flex-direction:column; gap:6px; }
.nav-link { display:flex; align-items:center; gap:12px; color:var(--muted); text-decoration:none; padding:11px 13px; border-radius:11px; font-size:13px; font-weight:620; border:1px solid transparent; }
.nav-link .nav-icon { width:20px; text-align:center; font-size:16px; }
.nav-link:hover { color:var(--text); background:rgba(255,255,255,.035); text-decoration:none; }
.nav-link.active { color:#d7ffea; background:rgba(55,166,112,.16); border-color:rgba(98,214,160,.22); }
.sidebar-foot { margin-top:auto; padding:12px; color:var(--muted-2); font-size:11px; line-height:1.6; }
.main-area { min-width:0; padding:0 30px 42px; }
.topbar { min-height:82px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); gap:16px; }
.topbar-title { display:flex; align-items:center; gap:11px; }
.topbar-title h1 { margin:0; font-size:20px; letter-spacing:-.5px; }
.topbar-title p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.topbar-right { display:flex; gap:12px; align-items:center; }
.user-chip { border:1px solid var(--line); background:rgba(255,255,255,.025); padding:8px 11px; border-radius:10px; color:#bdccbf; font-size:12px; }
.page-content { max-width:1600px; margin:0 auto; padding-top:25px; }
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:19px; }
.page-heading h2 { margin:0; font-size:23px; letter-spacing:-.7px; }
.page-heading p { margin:6px 0 0; color:var(--muted); font-size:13px; }
.status-line { color:var(--muted); font-size:12px; display:flex; align-items:center; gap:7px; }
.status-dot { width:7px;height:7px;border-radius:20px;background:var(--green);display:inline-block; box-shadow:0 0 10px rgba(99,214,162,.35); }
.status-dot.warn { background:var(--amber); box-shadow:none; }
.stats-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; margin-bottom:20px; }
.stat-card { border:1px solid var(--line); background:linear-gradient(145deg,rgba(29,48,35,.94),rgba(17,31,22,.94)); border-radius:15px; padding:17px 18px; }
.stat-card .label { color:var(--muted); font-size:11px; font-weight:650; text-transform:uppercase; letter-spacing:.08em; }
.stat-card .value { font-size:27px; font-weight:760; letter-spacing:-1px; margin-top:8px; }
.stat-card .sub { font-size:11px; color:var(--muted-2); margin-top:3px; }
.activity-panel, .panel { border:1px solid var(--line); border-radius:16px; background:rgba(18,30,23,.84); }
.activity-panel { margin-bottom:18px; overflow:hidden; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 17px; border-bottom:1px solid var(--line); }
.panel-head h3 { margin:0; font-size:13px; font-weight:700; }
.panel-head .hint { color:var(--muted-2); font-size:11px; }
.activity-strip { display:flex; gap:9px; overflow-x:auto; padding:12px 14px 14px; scrollbar-width:thin; }
.activity-item { flex:0 0 220px; min-width:200px; background:rgba(255,255,255,.025); border:1px solid var(--line); border-radius:11px; padding:10px 12px; }
.activity-item .event-time { color:var(--muted-2); font-size:10px; }
.activity-item .event-text { font-size:12px; line-height:1.4; margin-top:5px; }
.activity-item .event-kind { color:var(--accent); font-size:10px; margin-top:6px; text-transform:uppercase; letter-spacing:.05em; }
.empty-activity { color:var(--muted-2); font-size:12px; padding:8px; }
.toolbar { display:flex; align-items:center; gap:12px; justify-content:space-between; margin:17px 0 13px; flex-wrap:wrap; }
.searchbox { max-width:340px; flex:1 1 240px; position:relative; }
.searchbox input { padding-left:37px; }
.searchbox::before { content:'⌕'; position:absolute; z-index:1; top:7px; left:13px; color:var(--muted); font-size:24px; }
.filters { display:flex; gap:7px; overflow-x:auto; padding:3px 0 8px; scrollbar-width:thin; max-width:100%; }
.filter-pill { background:rgba(255,255,255,.025); color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:8px 13px; font-size:11px; white-space:nowrap; }
.filter-pill.active { color:#d7ffea; border-color:rgba(98,214,160,.4); background:rgba(47,145,98,.2); }
.table-panel { overflow:hidden; }
.table-scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; min-width:1000px; }
th { text-align:left; color:var(--muted-2); font-size:10px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; padding:13px 15px; background:rgba(255,255,255,.018); border-bottom:1px solid var(--line); }
td { padding:12px 15px; border-bottom:1px solid rgba(177,208,186,.09); font-size:12px; color:#cbdacf; white-space:nowrap; }
tr:last-child td { border-bottom:0; }
tbody tr:hover { background:rgba(255,255,255,.025); }
.vehicle-code { color:#e7f7ec; font-weight:750; letter-spacing:.02em; }
.trip-link { color:#8ce4b5; font-weight:650; }
.line-badge { display:inline-block; background:rgba(98,214,160,.16); border:1px solid rgba(98,214,160,.2); color:#c6f5dc; font-size:11px; font-weight:800; border-radius:6px; padding:3px 7px; }
.line-destination { color:#d4e0d7; margin-left:7px; }
.line-key-link { color:#a2b8a8; text-decoration:underline; text-decoration-color:rgba(162,184,168,.35); text-underline-offset:3px; }
.duty-link { color:#a8eac2; font-weight:700; }
.category-tag { font-size:10px; color:var(--muted); border:1px solid var(--line); border-radius:6px; padding:4px 7px; }
.mobile-vehicles { display:none; padding:8px; }
.vehicle-card { border:1px solid var(--line); border-radius:13px; padding:13px; margin:7px 0; background:rgba(255,255,255,.02); }
.vehicle-card-top { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.vehicle-card-main { font-weight:800; font-size:14px; }
.vehicle-card-sub { color:var(--muted); font-size:12px; margin-top:8px; }
.vehicle-card-meta { display:flex; gap:12px; flex-wrap:wrap; margin-top:9px; font-size:11px; color:#b6c8b9; }
.vehicle-card-meta span { white-space:nowrap; }
.empty-state { text-align:center; color:var(--muted); padding:38px 15px; font-size:13px; }
.section-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.panel-body { padding:17px; }
.list-row { display:flex; justify-content:space-between; align-items:center; gap:15px; padding:12px 0; border-bottom:1px solid var(--line); }
.list-row:last-child { border-bottom:0; }
.list-row strong { display:block; font-size:13px; }
.list-row small { color:var(--muted); font-size:11px; display:block; margin-top:4px; }
.watch-meta { color:var(--muted-2); font-size:10px; margin-top:5px; }
.inline-actions { display:flex; gap:7px; align-items:center; }
.checkline { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); margin:10px 0; }
.checkline input { width:15px; height:15px; min-height:0; accent-color:var(--accent); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.form-grid .field { margin:0; }
.form-actions { margin-top:15px; display:flex; justify-content:flex-end; }
.rule-explain { padding:11px 13px; background:rgba(98,214,160,.07); border:1px solid rgba(98,214,160,.16); border-radius:10px; color:#b5dec8; font-size:11px; line-height:1.5; margin:10px 0 15px; }
.activity-list { padding:0 17px; }
.activity-row { display:flex; align-items:flex-start; gap:14px; padding:14px 0; border-bottom:1px solid var(--line); }
.activity-row:last-child { border-bottom:0; }
.activity-icon { width:31px;height:31px;border-radius:10px;background:rgba(98,214,160,.12);display:grid;place-items:center;flex:0 0 auto;color:var(--accent);font-size:13px; }
.activity-copy { min-width:0; flex:1; }
.activity-copy strong { font-size:12px; }
.activity-copy p { margin:4px 0 0; color:var(--muted); font-size:12px; line-height:1.45; }
.activity-copy time { display:block; color:var(--muted-2); font-size:10px; margin-top:5px; }
.device-row { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:11px 0; border-bottom:1px solid var(--line); }
.device-row:last-child { border-bottom:0; }
.device-row strong { font-size:12px; }
.device-row small { display:block; color:var(--muted-2); font-size:10px; margin-top:4px; }
.notice { border-radius:11px; padding:12px 14px; border:1px solid rgba(255,198,109,.18); background:rgba(255,198,109,.06); color:#e8c996; font-size:12px; line-height:1.5; margin:12px 0; }
.notice.success { background:rgba(99,214,162,.06); border-color:rgba(99,214,162,.18); color:#a5e7c7; }
.mobile-nav { display:none; }
.toast-region { position:fixed; right:20px; bottom:20px; z-index:99; display:flex; flex-direction:column; gap:8px; }
.toast { background:#193b2d; border:1px solid rgba(98,214,160,.22); box-shadow:var(--shadow); border-radius:12px; padding:12px 15px; color:#e6fff0; font-size:12px; max-width:min(360px,calc(100vw - 32px)); animation:toast-in .2s ease-out; }
@keyframes toast-in { from {opacity:0;transform:translateY(8px)} to {opacity:1;transform:translateY(0)} }
.muted { color:var(--muted); }
.hidden { display:none !important; }
@media (max-width: 1050px) {
 .layout { grid-template-columns:205px minmax(0,1fr); }
 .main-area { padding:0 20px 36px; }
 .section-grid { grid-template-columns:1fr; }
}
@media (max-width: 760px) {
 .layout { display:block; padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
 .sidebar { display:none; }
 .main-area { padding:0 13px 24px; }
 .topbar { min-height:65px; }
 .topbar-title h1 { font-size:17px; }
 .topbar-title p { display:none; }
 .topbar-right { gap:7px; }
 .user-chip { font-size:10px; padding:7px 8px; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
 .topbar-right button { font-size:11px; padding:7px 9px; min-height:34px; }
 .page-content { padding-top:17px; }
 .page-heading { align-items:flex-start; margin-bottom:14px; }
 .page-heading h2 { font-size:20px; }
 .page-heading p { font-size:12px; }
 .stats-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin-bottom:13px; }
 .stat-card { padding:12px 10px; border-radius:12px; }
 .stat-card .label { font-size:9px; letter-spacing:.03em; }
 .stat-card .value { font-size:22px; margin-top:5px; }
 .stat-card .sub { font-size:9px; }
 .activity-panel { margin-bottom:13px; border-radius:13px; }
 .panel-head { padding:11px 12px; }
 .activity-strip { padding:9px 10px 11px; }
 .activity-item { flex-basis:190px; min-width:190px; padding:9px 10px; }
 .toolbar { margin:12px 0 8px; gap:8px; }
 .searchbox { flex-basis:100%; max-width:none; }
 .filters { width:100%; gap:6px; }
 .filter-pill { padding:7px 11px; }
 .table-scroll { display:none; }
 .mobile-vehicles { display:block; }
 .panel { border-radius:13px; }
 .form-grid { grid-template-columns:1fr; }
 .login-card { padding:25px 22px; }
 .mobile-nav { display:flex; position:fixed; z-index:50; left:0; right:0; bottom:0; padding:8px 8px calc(8px + env(safe-area-inset-bottom)); background:rgba(12,21,15,.96); border-top:1px solid var(--line); backdrop-filter:blur(16px); justify-content:space-around; }
 .mobile-nav .nav-link { display:flex; flex-direction:column; justify-content:center; gap:4px; border:0; padding:6px 10px; min-width:66px; font-size:9px; }
 .mobile-nav .nav-icon { font-size:17px; width:auto; }
 .toast-region { left:12px; right:12px; bottom:calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
 .main-area { padding-left:10px; padding-right:10px; }
 .stats-grid { gap:5px; }
 .stat-card .value { font-size:20px; }
 .topbar-title h1 { font-size:15px; }
}


/* v1.2.1 focused layout, watchlist, status and semantic event styling */
.layout.sidebar-collapsed { grid-template-columns:76px minmax(0,1fr); }
.sidebar-brand { position:relative; }
.sidebar-toggle { position:absolute; top:-9px; right:-7px; width:25px; height:25px; min-height:25px; padding:0; border:1px solid var(--line); border-radius:8px; background:var(--surface-2); color:var(--accent); font-size:19px; line-height:1; }
.sidebar-toggle:hover { background:var(--surface-3); }
.sidebar-collapsed .sidebar { padding:24px 10px; gap:30px; }
.sidebar-collapsed .sidebar-brand { justify-content:center; padding:0; }
.sidebar-collapsed .sidebar-brand .brand-copy,
.sidebar-collapsed .nav-link .nav-label,
.sidebar-collapsed .sidebar-foot { display:none; }
.sidebar-collapsed .nav-link { justify-content:center; gap:0; padding:12px 4px; }
.sidebar-collapsed .nav-link .nav-icon { width:auto; font-size:19px; }
.sidebar-collapsed .sidebar-toggle { top:49px; right:14px; }

.watch-query-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:22px; }
.watch-query-card { min-width:0; overflow:hidden; }
.watch-query-title { display:flex; align-items:center; gap:12px; padding:16px 17px 13px; border-bottom:1px solid var(--line); }
.watch-query-title h3 { margin:0; font-size:14px; }
.watch-query-title p { margin:4px 0 0; color:var(--muted-2); font-size:11px; line-height:1.4; }
.query-icon { width:35px; height:35px; flex:0 0 auto; display:grid; place-items:center; border-radius:11px; color:var(--accent); background:rgba(98,214,160,.12); font-size:18px; }
.watch-query-form { display:flex; flex-direction:column; gap:10px; }
.watch-query-form .field { margin:0; }
.watch-alert-options { display:flex; gap:12px; flex-wrap:wrap; padding:5px 0 9px; }
.watch-alert-options .checkline { margin:0; gap:5px; font-size:11px; }
.watch-alert-options .checkline input { accent-color:var(--accent); }
.watchlist-section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:4px 0 11px; }
.watchlist-section-head h3 { margin:0; font-size:15px; }
.watchlist-section-head p { margin:4px 0 0; color:var(--muted-2); font-size:11px; }
.watchlist-row { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:15px 0; border-bottom:1px solid var(--line); }
.watchlist-row:last-child { border-bottom:0; }
.watchlist-main { min-width:0; flex:1; }
.watchlist-title-row { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.watchlist-title-row strong { font-size:13px; }
.watch-kind { color:var(--muted-2); border:1px solid var(--line); border-radius:999px; padding:3px 8px; font-size:9px; text-transform:uppercase; letter-spacing:.06em; }
.watch-query-description { color:var(--muted); font-size:11px; margin-top:5px; }
.watch-status-list { display:flex; gap:7px; flex-wrap:wrap; margin-top:11px; }
.watch-status { display:inline-flex; align-items:center; gap:7px; border-radius:999px; padding:5px 10px; border:1px solid; font-size:9px; line-height:1; box-shadow:0 0 12px rgba(0,0,0,.12); }
.watch-status strong { font-size:10px; letter-spacing:.02em; }
.watch-status span { font-size:8px; font-weight:850; letter-spacing:.08em; }
.watch-status.online { color:#a5f2ca; background:rgba(37,161,99,.17); border-color:rgba(72,218,145,.4); box-shadow:0 0 13px rgba(45,190,117,.12); }
.watch-status.offline { color:#ffb6ba; background:rgba(190,55,67,.16); border-color:rgba(255,111,121,.38); box-shadow:0 0 13px rgba(230,70,83,.1); }
.watch-more { display:inline-flex; align-items:center; color:var(--muted); border:1px dashed var(--line); border-radius:999px; padding:5px 9px; font-size:10px; }
.watch-counts { display:flex; gap:10px; margin-top:7px; font-size:10px; }
.status-count.online-count { color:#82e6b1; }
.status-count.offline-count { color:#ff929a; }
.watch-empty-match { color:var(--muted-2); margin-top:10px; font-size:11px; }
.watchlist-row .watch-meta { margin-top:9px; }
.watchlist-actions { flex:0 0 auto; }
.watchlist-actions button { white-space:nowrap; }
.watch-add-btn { min-height:30px; padding:6px 9px; border:1px solid rgba(98,214,160,.28); border-radius:8px; background:rgba(98,214,160,.09); color:#9de8bd; font-size:10px; font-weight:750; white-space:nowrap; }
.watch-add-btn:hover { background:rgba(98,214,160,.17); }
.watch-add-btn:disabled { opacity:.5; }
.vehicle-card-actions { display:flex; justify-content:flex-end; margin-top:10px; }
.danger-permanent { border-color:rgba(255,123,131,.4) !important; background:rgba(255,123,131,.13) !important; }

.activity-item-head { display:flex; align-items:center; gap:8px; }
.activity-item .activity-icon { width:24px; height:24px; border-radius:8px; font-size:13px; }
.activity-icon.event-online { background:rgba(55,190,119,.18); color:#70e1a7; box-shadow:0 0 12px rgba(55,190,119,.14); }
.activity-icon.event-offline { background:rgba(224,71,82,.18); color:#ff858e; box-shadow:0 0 12px rgba(224,71,82,.13); }
.activity-icon.event-joined { background:rgba(66,145,232,.2); color:#83bcff; box-shadow:0 0 12px rgba(66,145,232,.15); }
.activity-icon.event-neutral { background:rgba(98,214,160,.12); color:var(--accent); }
.activity-item .event-kind.event-online { color:#70e1a7; }
.activity-item .event-kind.event-offline { color:#ff858e; }
.activity-item .event-kind.event-joined { color:#83bcff; }

@media (max-width: 1050px) {
  .watch-query-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .watch-query-card:last-child { grid-column:1 / -1; }
}
@media (max-width: 760px) {
  .watch-query-grid { grid-template-columns:1fr; gap:11px; }
  .watch-query-card:last-child { grid-column:auto; }
  .watchlist-row { flex-direction:column; gap:12px; }
  .watchlist-actions { width:100%; justify-content:flex-end; }
  .watchlist-section-head { align-items:flex-start; }
  .watch-status-list { gap:6px; }
  .watch-alert-options { gap:10px; }
  .activity-item .event-kind { font-size:9px; }
}
