:root {
  --paper: #eef1f4;
  --panel: #ffffff;
  --ink: #18222d;
  --muted: #5e6b78;
  --line: #d5dbe1;
  --cobalt: #1f5fad;
  --cobalt-ink: #174a88;
  --ok: #2f7d55;
  --warn: #9a5b00;
  --danger: #b3261e;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 6px; font-weight: 650; }
h2 { font-size: 17px; margin: 28px 0 10px; font-weight: 650; }
p { margin: 0 0 12px; }
a { color: var(--cobalt); text-underline-offset: 2px; }
a:hover { color: var(--cobalt-ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.measure { max-width: 70ch; }
.num { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--cobalt) 45%, transparent); outline-offset: 2px; }

/* Top bar */
.bar {
  display: flex; align-items: center; gap: 28px;
  max-width: 1040px; margin: 0 auto; padding: 16px 20px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { font-weight: 400; color: var(--muted); }
.bar nav { display: flex; gap: 4px; flex: 1; }
.bar nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px;
}
.bar nav a:hover { color: var(--ink); background: #e2e7ec; }
.bar nav a[aria-current="page"] { color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 24px; }

/* Buttons & forms */
button, .button {
  font: inherit; font-weight: 550; cursor: pointer;
  display: inline-block; text-decoration: none;
  padding: 8px 14px; border-radius: 8px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
}
button:hover, .button:hover { border-color: #b8c1ca; color: var(--ink); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary, button.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.primary:hover, button.primary:hover { background: var(--cobalt-ink); color: #fff; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link { background: none; border: 0; padding: 6px 0; color: var(--muted); font-weight: 400; }
button.link:hover { color: var(--ink); }

label { display: block; font-weight: 550; font-size: 14px; }
input:not([type=hidden]):not([type=file]) {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input[type=file] { font: inherit; font-size: 14px; }
.stack { display: grid; gap: 12px; max-width: 420px; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.inline label { flex: 1 1 260px; max-width: 360px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.actions form { margin: 0; }

/* Notices */
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 auto 16px; border: 1px solid; }
.notice.ok { background: #e8f3ec; border-color: #bcdcc8; color: #1f5a3c; }
.notice.warn { background: #fbf1e1; border-color: #ecd3a8; color: #6e4300; }
.notice.danger { background: #fbeaea; border-color: #efc4c1; color: #8a1d16; }
.bar + .notice, .bar + .notice + main { margin-top: 0; }

/* Device glyph: hình iPhone thu nhỏ, màn hình đổi màu theo trạng thái */
.glyph {
  display: inline-block; flex: none; vertical-align: -4px; margin-right: 10px;
  width: 12px; height: 20px; border-radius: 3.5px;
  border: 1.5px solid var(--ink); position: relative; background: var(--ok);
  box-shadow: inset 0 0 0 1.5px var(--panel);
}
.glyph::after {
  content: ""; position: absolute; top: 1.5px; left: 50%; width: 4px; height: 1.5px;
  margin-left: -2px; border-radius: 1px; background: var(--ink);
}
.glyph.s-enrolling { background: var(--warn); }
.glyph.s-removed { background: #b9c1c9; }
.glyph.big { width: 44px; height: 76px; border-radius: 11px; border-width: 3px; box-shadow: inset 0 0 0 4px var(--panel); margin: 0; }
.glyph.big::after { top: 5px; width: 12px; height: 4px; margin-left: -6px; border-radius: 2px; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-left: 6px; background: #e4e9ee; color: var(--muted); }
.tag.s-enrolled, .tag.c-Acknowledged { background: #e3f1e8; color: var(--ok); }
.tag.s-enrolling, .tag.c-Queued, .tag.c-NotNow { background: #f8ecd8; color: var(--warn); }
.tag.c-Error, .tag.c-CommandFormatError { background: #f9e3e2; color: var(--danger); }
td .tag:first-child { margin-left: 0; }
.err { color: var(--danger); margin-top: 2px; }

/* Lists */
.head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.list { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.list th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list td { padding: 11px 14px; border-bottom: 1px solid #e8ecf0; vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.dev { color: var(--ink); font-weight: 600; text-decoration: none; }
.dev:hover { color: var(--cobalt); }

.empty { background: var(--panel); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); padding: 36px; max-width: 560px; }
.empty h2 { margin-top: 0; }

/* Device page */
.crumb { font-size: 14px; margin-bottom: 14px; }
.devhead { display: flex; gap: 20px; align-items: center; margin-bottom: 8px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; margin: 0 0 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts.card { background: var(--panel); padding: 16px 18px; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); max-width: 640px; }

details { border-top: 1px solid var(--line); padding: 10px 0; }
details > summary { cursor: pointer; font-weight: 550; }
details[open] > summary { margin-bottom: 10px; }
details.danger-zone > summary { color: var(--danger); }

pre { background: var(--panel); box-shadow: 0 0 0 1px var(--line); border-radius: var(--radius); padding: 16px; overflow: auto; font-size: 12.5px; line-height: 1.45; max-height: 70vh; }

/* Enrollment */
.enroll { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; background: var(--panel); padding: 28px; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); }
.enroll img { width: 240px; height: 240px; image-rendering: pixelated; }
.linkbox { background: var(--paper); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 4px; }

/* Push flow: các bước có thứ tự thật */
.flow { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; max-width: 720px; }
.flow > li { counter-increment: step; position: relative; padding: 0 0 22px 48px; }
.flow > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 650; font-size: 14px;
  background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted);
}
.flow > li:not(:last-child)::after { content: ""; position: absolute; left: 14.5px; top: 34px; bottom: 4px; width: 1.5px; background: var(--line); }
.flow > li.done::before { content: "✓"; background: var(--ok); color: #fff; box-shadow: none; }
.flow h2 { margin: 3px 0 6px; }

/* Login */
.login { max-width: 380px; margin: 12vh auto 0; background: var(--panel); padding: 32px; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.login .stack { max-width: none; margin-top: 20px; }

@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 10px 16px; }
  .bar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .cols, .enroll { grid-template-columns: 1fr; }
  .list th:nth-child(3), .list td:nth-child(3), .list th:nth-child(2), .list td:nth-child(2) { display: none; }
}

select { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.row-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }

/* l-mdm (Android) */
.stack.wide { max-width: none; }
textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); resize: vertical; }
