:root {
  color-scheme: light;
  --red: #e2211c;
  --red-dark: #b81713;
  --ink: #171717;
  --muted: #6d6d6d;
  --line: #e8e8e8;
  --surface: #ffffff;
  --canvas: #f5f5f3;
  --success: #157347;
  --shadow: 0 14px 36px rgba(17,17,17,.08);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: "Segoe UI", Arial, sans-serif; }
button, input, textarea { font: inherit; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 800; font-size: 24px; border-radius: 50% 50% 46% 54%; }
.brand strong { display: block; letter-spacing: .08em; font-size: 15px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.top-actions, .inline { display: flex; align-items: center; gap: 10px; }
.environment, .secure-badge, .live-dot { border-radius: 99px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.environment { background: #171717; color: #fff; }
.secure-badge { background: #fce8e7; color: var(--red-dark); }
.live-dot { color: var(--success); background: #e9f6ef; }
.shell { display: grid; grid-template-columns: 228px minmax(0,1fr); min-height: calc(100vh - 120px); }
.sidebar { padding: 28px 16px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.nav-item { border: 0; background: transparent; padding: 12px 14px; border-radius: 10px; text-align: left; cursor: pointer; color: #555; font-weight: 600; }
.nav-item span { margin-right: 10px; color: var(--red); }
.nav-item.active { background: #fcebea; color: var(--ink); }
.sidebar-note { margin-top: auto; padding: 16px; border-radius: 12px; background: #191919; color: #fff; }
.sidebar-note p { color: #c7c7c7; font-size: 13px; line-height: 1.45; margin-bottom: 0; }
main { padding: 38px clamp(22px,4vw,60px); min-width: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
h1 { font-size: clamp(30px,4vw,45px); line-height: 1.05; margin: 7px 0 10px; letter-spacing: -.035em; }
h2 { margin: 4px 0; font-size: 22px; }
h3 { font-size: 15px; margin: 22px 0 10px; }
p { color: var(--muted); }
.eyebrow { color: var(--red); text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 800; }
.branch-control { min-width: 310px; }
label { display: block; color: #444; font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid #d7d7d7; border-radius: 8px; background: #fff; padding: 11px 12px; margin-top: 7px; color: var(--ink); }
input:focus, textarea:focus { outline: 3px solid rgba(226,33,28,.12); border-color: var(--red); }
.button { border: 1px solid #d5d5d5; border-radius: 8px; padding: 10px 14px; background: #fff; color: var(--ink); cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; }
.button:hover { border-color: #aaa; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: var(--red); border-color: var(--red); color: #fff; }
.button-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button-quiet { background: #f1f1f1; }
.notice { padding: 12px 15px; border-left: 4px solid var(--red); background: #fff; border-radius: 7px; margin-bottom: 18px; box-shadow: var(--shadow); }
.notice.success { border-color: var(--success); }
.section-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(330px,.8fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.device-list-card, .detail-card, .policy-card { padding: 22px; }
.provision-card { grid-column: 1 / -1; padding: 22px; }
.compact-grid { margin-top: 18px; }
.one-time-secret { margin-top: 18px; padding: 16px; border: 1px solid #d8dce3; border-radius: 8px; background: #f8f9fb; }
.one-time-secret input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; }
.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 18px; }
.card-heading p { margin: 4px 0; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: #777; text-transform: uppercase; letter-spacing: .07em; font-size: 11px; text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 15px 12px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.selected { background: #fff5f4; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 99px; background: #ececec; font-size: 12px; font-weight: 700; }
.status-pill.active { background: #e9f6ef; color: var(--success); }
.empty-state { text-align: center; padding: 50px 16px; }
.empty-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: #fcebea; color: var(--red); font-size: 28px; margin: 0 auto 15px; }
.mono { font-family: Consolas, monospace; font-size: 11px; word-break: break-all; }
.metrics { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 18px 0; }
.metrics div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; font-weight: 700; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.command-history ul { list-style: none; padding: 0; margin: 0; max-height: 190px; overflow-y: auto; }
.command-history li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.policy-card { max-width: 1000px; }
.section-intro { max-width: 760px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0 18px; }
.toggle-label { display: flex; align-items: center; gap: 8px; padding-top: 26px; }
.toggle-label input, .check-label input { width: auto; margin: 0; accent-color: var(--red); }
.hint { color: #888; font-weight: 400; }
.check-label { margin: 14px 0; display: flex; gap: 8px; align-items: center; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; }
.form-footer p { font-size: 13px; margin: 0; }
.login-card { max-width: 720px; margin: 9vh auto; background: #fff; border-radius: 18px; padding: clamp(30px,6vw,64px); box-shadow: var(--shadow); }
footer { height: 48px; display: grid; place-items: center; color: #777; font-size: 12px; background: #fff; border-top: 1px solid var(--line); }
@media (max-width: 950px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 18px; }
  .sidebar-note { display: none; }
  .section-grid { grid-template-columns: 1fr; }
  main { padding-top: 24px; }
}
@media (max-width: 650px) {
  .topbar { padding: 0 16px; }
  .brand small { display: none; }
  .page-heading, .form-footer { align-items: stretch; flex-direction: column; }
  .branch-control { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .toggle-label { padding-top: 0; }
  .action-grid { grid-template-columns: 1fr; }
}
