:root {
  --bg: #f6f6f9;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --border: #e3e3ea;
  --text: #1c1c28;
  --muted: #6e6f80;
  --accent: #6d4aff;
  --accent-soft: #ece7ff;
  --danger: #d23c3c;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111118;
    --surface: #1a1a24;
    --surface-2: #23232f;
    --border: #2e2e3c;
    --text: #ececf3;
    --muted: #8e8fa3;
    --accent: #8e74ff;
    --accent-soft: #2a2447;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
h2 { margin: 0; font-size: 1.1rem; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.small, .muted.small { display: block; }
.link { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.link:hover { text-decoration: underline; }
.error { color: var(--danger); font-size: 0.9rem; }
.notice { background: var(--accent-soft); color: var(--accent); padding: 10px 14px; border-radius: 10px; font-weight: 500; }
.pill { font-size: 0.72rem; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; vertical-align: 2px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand img { border-radius: 8px; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.card.highlight { border-color: var(--accent); }
.login, .device { width: min(380px, 100%); align-items: center; text-align: center; gap: 18px; padding: 32px 26px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-big { width: 100%; padding: 14px 18px; font-size: 1.05rem; border-radius: 14px; }
.btn-big svg { width: 20px; height: 20px; fill: currentColor; }
.btn-small { padding: 5px 11px; font-size: 0.85rem; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }

input { border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 9px 12px; outline: none; min-width: 0; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[name="code"] { text-transform: uppercase; letter-spacing: 0.12em; font-family: ui-monospace, monospace; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.inline input { flex: 1; min-width: 160px; }

.code { font-family: ui-monospace, monospace; font-size: 2.2rem; font-weight: 700; letter-spacing: 0.12em; }
.qr { width: 190px; background: #fff; border-radius: 12px; padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; max-width: 760px; margin: 0 auto; }
.topbar form { margin: 0; }
.topnav { display: flex; gap: 6px; align-items: center; }
.page-title { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.page { max-width: 760px; margin: 0 auto; padding: 8px 16px 60px; display: flex; flex-direction: column; gap: 18px; }
.section-title { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.app-tile { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.app-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.app-tile strong { display: block; font-size: 1.05rem; }
.app-icon { font-size: 1.8rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); flex: none; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rows li:last-child { border-bottom: 0; }
.rows form { margin: 0; }
