:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17243d;
  background: #f5f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 16px; background: radial-gradient(circle at 85% 0, #eef0ff 0, transparent 30%), #f5f7fb; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar { height: 68px; display: flex; align-items: center; gap: 18px; padding: 0 max(24px, 4vw); border-bottom: 1px solid #e7eaf1; background: rgba(255, 255, 255, .88); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #645cff, #866dff); color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 8px 20px rgba(100, 92, 255, .24); }
.topbar-label { padding-left: 18px; border-left: 1px solid #e0e4ec; color: #7b8497; font-size: 14px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 70px; }
.loading-card { display: flex; align-items: center; gap: 16px; width: min(440px, 100%); margin: 18vh auto 0; padding: 24px 26px; border: 1px solid #e5e8f0; border-radius: 18px; background: #fff; box-shadow: 0 18px 50px rgba(30, 42, 75, .08); }
.loading-card strong { display: block; font-size: 18px; }
.loading-card p { margin: 6px 0 0; color: #7a8497; }
.spinner { width: 28px; height: 28px; border: 3px solid #e5e7ff; border-top-color: #645cff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.message { max-width: 760px; margin: 18px auto; padding: 0 16px; color: #b5474a; text-align: center; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.eyebrow, .meta { color: #6d64ed; font-size: 12px; font-weight: 750; letter-spacing: .13em; }
h1 { margin: 10px 0 8px; font-size: clamp(32px, 4vw, 48px); line-height: 1.12; letter-spacing: -.045em; }
h2, h3 { margin: 0; letter-spacing: -.025em; }
p { color: #6e788c; line-height: 1.65; }
#identity { margin: 0; font-size: 16px; }
button { border: 0; border-radius: 11px; padding: 12px 19px; background: #625af6; color: #fff; font-weight: 700; box-shadow: 0 8px 18px rgba(98, 90, 246, .18); }
button:hover { background: #554dea; }
button:disabled { cursor: wait; opacity: .56; }
button.secondary { border: 1px solid #dfe3eb; background: #fff; color: #3c475c; box-shadow: none; }
button.secondary:hover { background: #f8f9fc; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 44px; }
.summary-card { display: flex; gap: 18px; min-height: 150px; padding: 24px; border: 1px solid #e5e8f0; border-radius: 18px; background: rgba(255, 255, 255, .9); box-shadow: 0 10px 30px rgba(30, 42, 75, .035); }
.summary-card h2 { margin-top: 5px; font-size: 21px; }
.summary-card p { margin: 9px 0 0; font-size: 14px; }
.summary-icon { flex: 0 0 auto; display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: #eeeefe; color: #6159f4; font-size: 20px; font-weight: 800; }
.summary-icon.success { background: #eaf8f0; color: #27905b; }

.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-title h2 { margin-top: 6px; font-size: 28px; }
.section-title p { margin: 7px 0 0; }
.admin-badge { flex: 0 0 auto; padding: 8px 12px; border: 1px solid #dedcff; border-radius: 999px; background: #f3f2ff; color: #5c54df; font-size: 13px; font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; }
.panel { border: 1px solid #e4e7ef; border-radius: 20px; background: #fff; box-shadow: 0 12px 34px rgba(34, 45, 78, .045); }
.policy-panel { padding: 26px; }
.side-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #eef0f4; }
.panel-heading h3 { margin-top: 5px; font-size: 20px; }
.count { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; background: #f0efff; color: #5b53e4; font-weight: 800; }

form { display: grid; gap: 24px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid #eef0f4; }
.switch-row strong { display: block; font-size: 17px; }
small { display: block; margin-top: 5px; color: #8991a1; font-size: 13px; font-weight: 450; line-height: 1.45; }
.switch { position: relative; flex: 0 0 auto; width: 48px; height: 28px; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #d9dde6; transition: .2s ease; }
.switch i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .18); transition: .2s ease; }
.switch input:checked + i { background: #625af6; }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid rgba(98, 90, 246, .25); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label > span:first-child { font-weight: 720; }
textarea { width: 100%; margin-top: 10px; padding: 13px 14px; border: 1px solid #dfe3eb; border-radius: 12px; background: #fafbfc; color: #263249; line-height: 1.5; resize: vertical; outline: none; }
textarea:focus { border-color: #857ff7; background: #fff; box-shadow: 0 0 0 3px rgba(98, 90, 246, .1); }
.form-footer { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.hint { flex: 1; margin: 0; font-size: 14px; }

.device-list, .readiness-list { display: grid; gap: 10px; padding-top: 14px; }
.device-card { position: relative; padding: 14px 14px 14px 30px; border-radius: 12px; background: #f8f9fc; }
.device-card::before { content: ""; position: absolute; top: 20px; left: 14px; width: 8px; height: 8px; border-radius: 50%; background: #a4aab6; }
.device-card.online::before { background: #2ca469; box-shadow: 0 0 0 4px #e4f6ec; }
.device-card h3 { font-size: 14px; line-height: 1.45; }
.device-card small { margin-top: 3px; }
.state-label { display: inline-block; margin-bottom: 5px; color: #70798b; font-size: 12px; font-weight: 700; }
.empty { margin: 8px 0; color: #8a93a4; font-size: 14px; }
.readiness-panel { margin-top: 18px; padding: 24px; }
.readiness-row { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(180px, 2fr); gap: 18px; align-items: center; padding: 13px 14px; border-radius: 12px; background: #f8f9fc; color: #525d72; font-size: 14px; }
.readiness-state { padding: 4px 9px; border-radius: 999px; background: #ecebff; color: #5c54e3; font-size: 12px; font-weight: 800; }

@media (max-width: 840px) {
  .summary-grid, .admin-grid, .field-grid { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 18px; }
  .topbar-label { display: none; }
  main { width: min(100% - 28px, 1180px); padding-top: 28px; }
  .hero, .section-title { flex-direction: column; align-items: stretch; }
  .hero button { align-self: flex-start; }
  .summary-card, .policy-panel, .side-panel, .readiness-panel { padding: 20px; }
  .readiness-row { grid-template-columns: 1fr; gap: 7px; }
}
