@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0B1423;
  --bg-deep: #08101C;
  --card: #162438;
  --card-2: #1B2C44;
  --line: #24374F;
  --line-soft: #1D2E45;
  --ink: #E6EDF7;
  --ink-2: #A7B5C9;
  --ink-3: #6F819A;
  --blue: #2563EB;
  --blue-2: #3B82F6;
  --blue-soft: rgba(37, 99, 235, .14);
  --green: #22C55E;
  --green-soft: rgba(34, 197, 94, .13);
  --yellow: #EAB308;
  --yellow-soft: rgba(234, 179, 8, .14);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, .13);
  --sand: #D9B779;
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -18px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14.5px; -webkit-font-smoothing: antialiased; }
[dir=rtl], [dir=rtl] * { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif; }
[dir=rtl] .mono, [dir=rtl] .mono * { font-family: var(--mono); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(900px 500px at 85% -10%, rgba(37,99,235,.10), transparent 60%),
              radial-gradient(700px 400px at -10% 110%, rgba(217,183,121,.05), transparent 60%); }
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1:focus { outline: none; }
.mono { font-family: var(--mono); font-size: .9em; letter-spacing: -.01em; unicode-bidi: isolate; direction: ltr; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; border-radius: 6px; }

/* Shell */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.side { position: sticky; top: 0; height: 100dvh; background: var(--bg-deep); border-inline-end: 1px solid var(--line-soft); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, var(--blue), #1742A8); display: grid; place-items: center; box-shadow: 0 6px 18px -6px rgba(37,99,235,.7); }
.brand-t { font-weight: 700; font-size: 14px; line-height: 1.15; }
.brand-s { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav-link:hover { background: rgba(255,255,255,.03); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--blue-soft); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--blue-2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #22406B; color: #CFE0FF; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.who-n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-r { font-size: 11.5px; color: var(--ink-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: rgba(11,20,35,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.topbar .grow { flex: 1; }
.menu-btn { display: none; }
.demo-strip { display: flex; align-items: center; gap: 10px; padding: 9px 28px; background: linear-gradient(90deg, rgba(217,183,121,.12), rgba(217,183,121,.03)); border-bottom: 1px solid rgba(217,183,121,.18); color: #EBD6AE; font-size: 13px; }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; animation: rise .35s ease both; }

/* Page head */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.phead h1 { font-size: 26px; }
.phead p { margin: 5px 0 0; color: var(--ink-2); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--sand); margin-bottom: 6px; }
[dir=rtl] .eyebrow { letter-spacing: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 500; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--card-2); border-color: #30486A; text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1E54D6; border-color: #1E54D6; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #D83B3B; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.04); color: var(--ink); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.spin { animation: spin .9s linear infinite; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.card-h h2 { font-size: 15px; }
.card-b { padding: 18px; }

/* Stats */
.stats { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat-l { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.stat-v { font-size: 32px; font-weight: 600; margin-top: 8px; font-family: var(--mono); letter-spacing: -.03em; }
.stat-bar { height: 6px; border-radius: 6px; background: var(--line-soft); display: flex; overflow: hidden; margin-top: 12px; gap: 2px; }
.stat-bar span { display: block; height: 100%; transition: flex-grow .5s ease; }
.stat .glow { position: absolute; inset-inline-end: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; opacity: .5; filter: blur(30px); }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 6px; }

/* Status */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-green { color: #4ADE80; background: var(--green-soft); }
.s-yellow { color: #FACC15; background: var(--yellow-soft); }
.s-red { color: #F87171; background: var(--red-soft); }
.s-blue { color: #93B4FF; background: var(--blue-soft); }
.s-gray { color: var(--ink-2); background: rgba(255,255,255,.05); }
.s-sand { color: #EBD6AE; background: rgba(217,183,121,.12); }
.s-yellow .dot, .s-blue .dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip.ok { color: #86EFAC; border-color: rgba(34,197,94,.3); }
.chip.warn { color: #FCA5A5; border-color: rgba(239,68,68,.3); }

.fresh { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; }
.fresh-bar { display: inline-flex; gap: 2px; }
.fresh-bar b { width: 4px; height: 12px; border-radius: 2px; background: var(--line); }
.fresh.fresh-fresh b { background: var(--green); }
.fresh.fresh-aging b:nth-child(-n+2) { background: var(--yellow); }
.fresh.fresh-stale b:nth-child(1) { background: var(--red); }
.fresh-fresh { color: #86EFAC; } .fresh-aging { color: #FDE68A; } .fresh-stale { color: #FCA5A5; } .fresh-none { color: var(--ink-3); }

/* Layout grids */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Fleet list */
.fleet { list-style: none; margin: 0; padding: 6px; max-height: 560px; overflow: auto; }
.fleet li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 10px; transition: background .15s; }
.fleet li:hover { background: rgba(255,255,255,.025); }
.fleet li + li { border-top: 1px solid var(--line-soft); }
.pin { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.t-name { font-weight: 600; font-size: 13.5px; }
.t-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* Tables */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.err { font-size: 12px; color: #FCA5A5; }
.input, .select, textarea.input { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-deep); color: var(--ink); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; min-width: 0; }
textarea.input { height: auto; min-height: 78px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.22); }
.input::placeholder { color: var(--ink-3); }
.select { padding-inline-end: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236F819A' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir=rtl] .select { background-position: left 10px center; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .input { width: 100%; padding-inline-start: 36px; }
.search svg { position: absolute; inset-inline-start: 11px; top: 10px; color: var(--ink-3); }
input[type=date].input { color-scheme: dark; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; line-height: 1.45; background: var(--bg-deep); }
.check input { margin-top: 2px; accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.check:has(input:checked) { border-color: rgba(37,99,235,.55); background: rgba(37,99,235,.07); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-weight: 500; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: rgba(8,16,28,.4); }
[dir=rtl] .tbl th { letter-spacing: 0; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.02); }
.tbl .acts { display: flex; gap: 4px; justify-content: flex-end; }

/* Mobile card list fallback */
.mlist { display: none; }

/* Empty / error / skeleton */
.empty { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-ic { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: var(--blue-soft); color: #93B4FF; margin-bottom: 4px; border: 1px solid rgba(37,99,235,.25); }
.empty h3 { font-size: 16px; }
.empty p { margin: 0; color: var(--ink-2); max-width: 400px; line-height: 1.55; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; font-size: 13px; line-height: 1.5; border: 1px solid; }
.alert-err { background: var(--red-soft); border-color: rgba(239,68,68,.3); color: #FECACA; }
.alert-ok { background: var(--green-soft); border-color: rgba(34,197,94,.3); color: #BBF7D0; }
.alert-info { background: var(--blue-soft); border-color: rgba(37,99,235,.3); color: #C7D7FE; }
.alert-warn { background: var(--yellow-soft); border-color: rgba(234,179,8,.3); color: #FEF08A; }
.alert svg { flex: none; margin-top: 1px; }
.sk { background: linear-gradient(90deg, var(--line-soft) 0%, #23364F 50%, var(--line-soft) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 8px; }

/* Map */
.map-wrap { position: relative; min-height: 430px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; background: var(--bg-deep); }
.map-el { position: absolute; inset: 0; }
.map-over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8,16,28,.88); z-index: 2; padding: 20px; }
.map-tall { min-height: calc(100dvh - 240px); }
.seg { display: inline-flex; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { height: 28px; padding: 0 11px; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--card-2); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { animation: rise .25s ease both; box-shadow: 0 14px 40px -10px rgba(0,0,0,.7); }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 150; background: rgba(4,9,17,.72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; animation: fade .18s ease both; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 36px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); animation: pop .22s cubic-bezier(.2,.9,.3,1.1) both; }
.modal:focus { outline: none; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-h h2 { font-size: 16px; }
.modal-b { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: rgba(8,16,28,.3); border-radius: 0 0 16px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-opt { display: flex; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--bg-deep); text-align: start; color: var(--ink); font: inherit; width: 100%; }
.mode-opt.on { border-color: var(--blue); background: rgba(37,99,235,.08); }
.mode-opt:disabled { opacity: .45; cursor: not-allowed; }
.mode-opt .t { font-weight: 600; font-size: 13.5px; }
.mode-opt .d { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.tcard { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--bg-deep); border: 1px solid var(--line-soft); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }

/* Activity */
.act { list-style: none; margin: 0; padding: 4px 18px 12px; }
.act li { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; padding: 10px 0; position: relative; align-items: start; }
.act li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 26px; bottom: -6px; width: 1px; background: var(--line); }
.act li:last-child::before { display: none; }
.act .nd { width: 13px; height: 13px; border-radius: 50%; border: 3px solid var(--card); margin-top: 3px; box-shadow: 0 0 0 1px var(--line); }

/* Sign-in */
.signin { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; min-height: 560px; overflow: hidden; }
.signin-art { padding: 40px; background: radial-gradient(500px 300px at 20% 20%, rgba(37,99,235,.3), transparent), linear-gradient(160deg, #13233C, #0B1423); position: relative; display: flex; flex-direction: column; gap: 18px; }
.signin-art .grid-bg { position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px); background-size: 36px 36px; mask-image: radial-gradient(circle at 60% 60%, #000, transparent 75%); }
.signin-art > * { position: relative; }
.signin-pane { padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--card); }
.point { display: flex; gap: 12px; align-items: center; color: var(--ink-2); }
.point span:first-child { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.05); color: #93B4FF; flex: none; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Responsive */
@media (max-width: 1180px) {
  .dash-grid, .map-layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 264px; z-index: 120; transform: translateX(-100%); transition: transform .22s ease; }
  [dir=rtl] .side { transform: translateX(100%); }
  .shell.open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(4,9,17,.6); z-index: 110; }
  .menu-btn { display: inline-flex; }
  .topbar, .demo-strip { padding-inline: 16px; }
  .content { padding: 20px 16px 50px; }
  .signin { grid-template-columns: 1fr; }
  .signin-art { padding: 28px; }
}
@media (max-width: 720px) {
  .table-wrap.resp { display: none; }
  .mlist { display: block; list-style: none; margin: 0; padding: 0; }
  .mlist > li { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .phead h1 { font-size: 22px; }
  .stat-v { font-size: 26px; }
  .hide-sm { display: none !important; }
}
