@font-face { font-family: Cairo; src: url(assets/Cairo.ttf); font-weight: 200 1000; }
@font-face { font-family: Inter; src: url(assets/Inter.ttf); font-weight: 100 900; }
:root { --blue:#1E6BFF; --blueDeep:#0B4FE0; --cyan:#22A7F0; --green:#2E9A1F; --greenBg:#E7F4E2; --navy:#0F2440; --side:#0B2A5B; --text2:#5B6475; --text3:#9AA1AE; --bg:#F5F7FC; --line:#E6E9F0; --red:#E53935; --redBg:#FDECEC; --orange:#F59E0B; --orangeBg:#FEF3DC; --tile:#E6EEFF; --radius:14px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, Cairo, system-ui, sans-serif; background: var(--bg); color: var(--navy); font-size: 14px; }
html[lang=ar] body { font-family: Cairo, Inter, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--side), var(--blueDeep) 60%, var(--cyan)); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 20px 60px rgba(11,42,91,.35); }
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-card .brand img { width: 52px; height: 52px; border-radius: 12px; }
.login-card h1 { font-size: 22px; margin: 0; }
.login-card p.sub { color: var(--text2); margin: 2px 0 0; }
.field { display: block; margin: 14px 0; }
.field span { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,107,255,.15); }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; background: var(--blue); color: #fff; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--blueDeep); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--red); } .btn.danger:hover { background: #c62828; }
.btn.ok { background: var(--green); } .btn.ok:hover { background: #237a17; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.err { background: var(--redBg); color: var(--red); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.lang-switch { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 700; }
.login .lang-switch { float: inline-end; }
.note { color: var(--text3); font-size: 12px; margin-top: 14px; }
/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side .brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.side .brand b { font-size: 17px; display: block; } .side .brand small { color: #9fb6dd; }
.nav button { display: flex; width: 100%; align-items: center; gap: 10px; background: transparent; border: 0; color: #cfdaf0; padding: 10px 12px; border-radius: 10px; text-align: start; font-weight: 600; }
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.on { background: var(--blue); color: #fff; }
.nav .ico { width: 20px; text-align: center; }
.nav .badge { margin-inline-start: auto; background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h2 { margin: 0; font-size: 20px; flex: 1; }
.top .who { color: var(--text2); font-weight: 600; }
.content { padding: 24px; }
/* cards / stats */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.stat .k { color: var(--text2); font-weight: 600; } .stat .v { font-size: 28px; font-weight: 800; }
.stat.warn .v { color: var(--orange); } .stat.bad .v { color: var(--red); }
.stat .tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tile); color: var(--blue); font-size: 18px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.bar { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 8px; margin: 8px 0; }
.bar .track { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 999px; }
html[dir=rtl] .bar .fill { background: linear-gradient(270deg, var(--blue), var(--cyan)); }
.bar .n { text-align: end; font-weight: 700; }
/* list */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.toolbar select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #FAFBFE; color: var(--text2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
html[lang=ar] th { text-transform: none; letter-spacing: 0; font-size: 13px; }
tbody tr { cursor: pointer; } tbody tr:hover { background: #F7F9FF; }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
td.trunc > .tc { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; } /* long names/brands/dealers: ellipsis, full text in the title tooltip */
.mini td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 40px; text-align: center; color: var(--text3); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; color: var(--text2); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tile); color: var(--blue); }
.pill.green { background: var(--greenBg); color: var(--green); } .pill.red { background: var(--redBg); color: var(--red); }
.pill.orange { background: var(--orangeBg); color: #b45309; } .pill.gray { background: #EEF0F4; color: var(--text2); }
/* drawer */
.overlay { position: fixed; inset: 0; background: rgba(15,36,64,.35); z-index: 20; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100%); background: #fff; z-index: 21; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(15,36,64,.2); }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer header h3 { margin: 0; flex: 1; font-size: 18px; }
.drawer .body { padding: 16px 20px; overflow: auto; flex: 1; }
.drawer .actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #FAFBFE; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--text2); font-weight: 600; } dl.kv dd { margin: 0; word-break: break-word; }
.sub-title { margin: 20px 0 8px; font-size: 14px; color: var(--text2); text-transform: uppercase; }
html[lang=ar] .sub-title { text-transform: none; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; } .thumbs img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.mini td, .mini th { padding: 7px 10px; font-size: 13px; }
/* modal */
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: rgba(15,36,64,.45); padding: 16px; }
.modal .box { background: #fff; border-radius: 16px; padding: 22px; width: min(440px, 100%); }
.modal h3 { margin: 0 0 8px; } .modal p { color: var(--text2); margin: 0 0 8px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
/* plans */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan.pop { border: 2px solid var(--blue); }
.plan .price { font-size: 26px; font-weight: 800; margin: 6px 0; } .plan .price small { font-size: 13px; color: var(--text2); font-weight: 600; }
.plan ul { padding-inline-start: 18px; color: var(--text2); } .plan li { margin: 4px 0; }
.plan .dealers { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; font-weight: 700; }
#toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; z-index: 40; pointer-events: none; }
html[dir=rtl] #toast { transform: translateX(50%); }
#toast.show { opacity: 1; } #toast.bad { background: var(--red); }
.loading { padding: 40px; text-align: center; color: var(--text3); }
code.json { display: block; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px; font-size: 12px; direction: ltr; text-align: left; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .nav { display: flex; flex-wrap: wrap; gap: 4px; } .nav button { width: auto; } dl.kv { grid-template-columns: 1fr; } }
