:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --line: #e5e5ea;
  --accent: #0a84ff;
  --accent-ink: #0060df;
  --ok: #1f9d55;
  --ok-bg: #e6f6ec;
  --warn: #b25e00;
  --warn-bg: #fff3e0;
  --bad: #d70015;
  --bad-bg: #ffe9eb;
  --pilot: #7a3ff2;
  --pilot-bg: #f0e9ff;
  --muted-bg: #f0f0f3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
small { font-size: 12.5px; }
code, .mono, pre { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.muted { color: var(--ink-2); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.bad-text, .danger-text { color: var(--bad); }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: rgba(255, 255, 255, .72); backdrop-filter: saturate(180%) blur(20px); border-inline-end: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); padding: 4px 8px 20px; }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 16px; }
.brand small { color: var(--ink-2); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, #ff9f0a, #ff375f); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; }
.brand-mark.lg svg { width: 38px; height: 38px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); font-weight: 500; }
.side nav a svg { width: 19px; height: 19px; color: var(--ink-2); }
.side nav a:hover { background: var(--muted-bg); text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.side nav a.on svg { color: #fff; }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 8px; color: var(--ink-2); font-size: 13px; }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }

/* ---------- cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2.wide-first { grid-template-columns: 1.6fr 1fr; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 18px; }
.empty { color: var(--ink-2); text-align: center; padding: 24px 12px; margin: 0; }
.hint { color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }
.hint.pad { padding: 10px 20px 14px; margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; color: var(--ink); display: flex; flex-direction: column; }
.tile:hover { text-decoration: none; box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .07); }
.tile b { font-size: 32px; font-weight: 700; line-height: 1.2; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.tile small { color: var(--ink-2); }
.tile.warn b { color: var(--warn); }
.tile.bad b { color: var(--bad); }

/* ---------- tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-inline-start: 20px; }
.table .num { font-variant-numeric: tabular-nums; text-align: end; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { display: inline; }
.notes { color: var(--ink-2); font-size: 13px; margin-top: 4px; max-width: 340px; }

.app-cell, .dev-cell { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.app-cell:hover, .dev-cell:hover { text-decoration: none; }
.app-cell span, .dev-cell span:last-child { display: flex; flex-direction: column; }
.app-cell small { color: var(--ink-2); }
.app-icon { border-radius: 22%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: var(--muted-bg); }
.app-icon.placeholder { color: #fff; font-weight: 700; }
.app-title { display: flex; gap: 16px; align-items: center; }
.app-title .app-icon { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.app-title p { margin: 0; }

.adopt { min-width: 220px; }
.bar { height: 8px; background: var(--muted-bg); border-radius: 8px; overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 8px; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.app-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; gap: 14px; align-items: center; color: var(--ink); }
.app-card:hover { text-decoration: none; box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .08); }
.app-card div { display: flex; flex-direction: column; min-width: 0; }
.app-card small { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.app-card .meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ---------- chips, dots */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--muted-bg); color: var(--ink-2); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.pilot { background: var(--pilot-bg); color: var(--pilot); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c7c7cc; flex: none; }
.dot.on { background: #30d158; box-shadow: 0 0 0 3px rgba(48, 209, 88, .18); }
.dot.big { width: 12px; height: 12px; vertical-align: middle; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.app-chip { position: relative; display: inline-flex; }
.app-chip i { position: absolute; inset-block-end: -3px; inset-inline-start: -3px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #c7c7cc; }
.app-chip.ok i { background: #30d158; }
.app-chip.outdated i, .app-chip.missing i { background: #ff9f0a; }
.app-chip.failed i { background: #ff3b30; }
.app-chip.optional i { background: #c7c7cc; }
.app-chip.optional .app-icon { opacity: .45; }
.legend { color: var(--ink-2); font-size: 13px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend .app-chip { width: 12px; height: 12px; }
.legend .app-chip i { inset: 0; }
.dev-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.batt { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.batt.low { color: var(--bad); font-weight: 600; }

/* ---------- lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li a { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.list.events li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.list.events li span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.list.events time { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.list.compact li { padding: 5px 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--ink-2); font-size: 13px; }
.facts dd { margin: 0; }
details.more { margin-top: 12px; }
details.more summary, details summary { cursor: pointer; color: var(--accent-ink); font-weight: 500; }

/* ---------- forms */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink); }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 12px; border: 1px solid #d2d2d7; border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 132, 255, .2); }
input.inline { border-color: transparent; background: transparent; padding: 5px 8px; font-weight: 600; }
input.inline:hover, input.inline:focus { border-color: #d2d2d7; background: #fff; }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > label:not(.radio):not(.check) { flex: 1 1 220px; }
.row.tight { gap: 4px; }
.row.center { align-items: center; }
.radio, .check { flex-direction: row; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; }
.group-picks { display: flex; gap: 14px; flex-wrap: wrap; width: 100%; padding: 10px 12px; background: var(--muted-bg); border-radius: 10px; }
.drop { position: relative; border: 2px dashed #c7c7cc; border-radius: 12px; padding: 26px; text-align: center; color: var(--ink-2); font-weight: 500; cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(10, 132, 255, .04); color: var(--accent-ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has { border-style: solid; border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.progress { height: 26px; background: var(--muted-bg); border-radius: 8px; position: relative; overflow: hidden; }
.progress i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: 13px; line-height: 26px; font-weight: 600; mix-blend-mode: difference; color: #fff; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 260px; }
.seg { display: inline-flex; background: #e8e8ed; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: none; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 8px; color: var(--ink); cursor: pointer; font-weight: 500; }
.seg a:hover { text-decoration: none; }
.seg .on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.switch { position: relative; display: inline-block; width: 42px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #e5e5ea; border-radius: 26px; cursor: pointer; transition: .2s; }
.switch i::before { content: ""; position: absolute; width: 22px; height: 22px; inset-block-start: 2px; inset-inline-start: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s; }
.switch input:checked + i { background: #34c759; }
.switch input:checked + i::before { transform: translateX(-16px); }
[dir=ltr] .switch input:checked + i::before { transform: translateX(16px); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 10px; border: 1px solid #d2d2d7; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #fafafa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger-ghost:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-ink); }
.btn.ghost:hover { background: rgba(10, 132, 255, .08); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn.big { padding: 14px; font-size: 17px; border-radius: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
button.link { background: none; border: 0; color: var(--accent-ink); font: inherit; cursor: pointer; padding: 0; }
.inline-edit { position: relative; }
.inline-edit[open] form { position: absolute; z-index: 5; inset-inline-end: 0; top: 34px; background: #fff; padding: 12px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); width: 320px; }
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.pager { display: flex; justify-content: space-between; padding: 12px 20px; }

/* ---------- flash */
.flash { padding: 11px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- setup */
.enroll-code { background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); padding: 10px 18px; text-align: center; }
.enroll-code small { display: block; color: var(--ink-2); font-weight: 600; }
.enroll-code code { font-size: 28px; font-weight: 700; letter-spacing: .08em; direction: ltr; display: block; }
code.code { font-size: 15px; font-weight: 600; letter-spacing: .06em; background: var(--muted-bg); padding: 3px 9px; border-radius: 7px; direction: ltr; display: inline-block; }
.setup-grid { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; }
.qr-box { text-align: center; }
.qr-box #qr { background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.qr-box #qr svg, .qr-box #qr img { display: block; width: 300px; height: 300px; }
.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 8px; }
pre.cmd { background: #1d1d1f; color: #f5f5f7; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; text-align: left; }

/* ---------- bare pages */
body.bare { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
body.bare > .flash { position: fixed; top: 16px; inset-inline: 16px; }
.center-card { background: var(--card); border-radius: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .08); padding: 34px 30px; width: 100%; max-width: 400px; }
.center-card.get { max-width: 460px; }
.brand-big { text-align: center; margin-bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.brand-big p { margin: 0; }
.get .steps { margin-top: 18px; color: var(--ink-2); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 6px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .brand { padding: 4px; }
  .side-foot { margin: 0; }
  .main { padding: 18px 14px 40px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid2, .grid2.wide-first, .setup-grid { grid-template-columns: 1fr; }
  .card.flush { overflow-x: auto; }
}
