/* CC Device Migrator – UI */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-050: #eff6ff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
small { color: var(--muted); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .85em; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 10px; }
.sidebar__brand .logo {
  width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.sidebar__brand b { color: #fff; font-size: 15px; }
.sidebar__brand span { display: block; font-size: 11px; color: #64748b; }
.nav { padding: 8px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: var(--sidebar-2); text-decoration: none; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav__section { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #475569; padding: 14px 12px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { color: var(--muted); font-size: 13px; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary-050); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.content { padding: 24px; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__body { padding: 18px 20px; }
.card__head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__head h2, .card__head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stack > * + * { margin-top: 16px; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.9rem; font-weight: 700; margin-top: 4px; }
.kpi .value.green { color: #16a34a; }
.kpi .value.red { color: #dc2626; }
.kpi .value.blue { color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: .12s; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-600); }
.btn--danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.btn--danger:hover { background: #fee2e2; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--lg { padding: 12px 22px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-group .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-050); }
textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--slate  { background: #f1f5f9; color: #475569; }
.badge--blue   { background: #eff6ff; color: #2563eb; }
.badge--amber  { background: #fffbeb; color: #b45309; }
.badge--indigo { background: #eef2ff; color: #4f46e5; }
.badge--violet { background: #f5f3ff; color: #7c3aed; }
.badge--green  { background: #f0fdf4; color: #16a34a; }
.badge--red    { background: #fef2f2; color: #dc2626; }
.badge--gray   { background: #f3f4f6; color: #6b7280; }
.badge--plain  { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge--plain::before { display: none; }

/* ---------- Progress ---------- */
.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); }
.statusbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.statusbar > span { display: block; height: 100%; }
.seg-slate{background:#94a3b8}.seg-blue{background:#3b82f6}.seg-amber{background:#f59e0b}.seg-indigo{background:#6366f1}
.seg-violet{background:#8b5cf6}.seg-green{background:#22c55e}.seg-red{background:#ef4444}.seg-gray{background:#9ca3af}
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span::before { content:""; display:inline-block; width:9px;height:9px;border-radius:50%; margin-right:5px; vertical-align: middle; }

/* ---------- Alerts / flash ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.alert--success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert--error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert--info { background: var(--primary-050); color: var(--primary-600); border-color: #bfdbfe; }
.alert--warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.meta-list { list-style: none; padding: 0; margin: 0; }
.meta-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.meta-list li:last-child { border-bottom: none; }
.meta-list .k { color: var(--muted); }
.tag { display:inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.flow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.flow .arrow { color: #cbd5e1; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; }
.split { display: flex; gap: 24px; align-items: flex-start; }
.split .side { width: 320px; flex-shrink: 0; }
@media (max-width: 900px) { .split { flex-direction: column; } .split .side { width: 100%; } .sidebar { display: none; } }

/* ---------- Guest / Portal ---------- */
.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #eef2ff, #f4f6fb 60%); }
.auth-card, .portal-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 40px rgba(15,23,42,.10); padding: 32px; }
.portal-card { max-width: 560px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .logo { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 12px; background: linear-gradient(135deg,#3b82f6,#2563eb); display:grid;place-items:center;color:#fff;font-weight:700;font-size:20px; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 20px 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 44px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-050); color: var(--primary); font-weight: 700; display: grid; place-items: center; }
.steps li:not(:last-child)::after { content:""; position:absolute; left:15px; top:30px; bottom:2px; width:2px; background: var(--border); }
.device-chip { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; }
.device-chip .os { width: 42px; height: 42px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 20px; }
.done-check { width: 64px; height: 64px; border-radius: 50%; background: #f0fdf4; color: #16a34a; display: grid; place-items: center; font-size: 34px; margin: 0 auto 16px; }
