:root {
  --accent: #2c5803;
  --text: #111;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --field: #cfcfcf;
  --bg: #fafafa;
  --hover: #f1f1f1;
  --ok-bg: #c6e0b4;
  --ok-fg: #1e3a0e;
  --err-bg: #ffc7ce;
  --err-fg: #9c0006;
  --pad: 24px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* Layout with sidebar */
.shell { display: flex; min-height: 100vh; }
.side { width: 196px; flex: none; display: flex; flex-direction: column; gap: 28px; padding: 24px 10px; background: #fff; border-right: 1px solid var(--line); }
.side-logo { display: flex; justify-content: center; }
.logo { display: block; width: 110px; height: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; padding: 32px 40px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.empty { padding: 8px 0; font-size: 13px; color: var(--muted); }

/* Menu */
.nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 500; }
.nav-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #444; font: inherit; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--hover); }
.nav-item.active, .nav-item.active:hover { background: var(--accent); color: #fff; }
.side-exit { margin-top: auto; }
.exit { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: #444; font: inherit; font-size: 14px; font-weight: 500; text-align: center; cursor: pointer; }
.exit:hover { background: var(--hover); }

/* Login and device pages */
.card-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; padding: 36px 32px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08); }
.card-wide { max-width: 520px; }
.card-logo { display: flex; justify-content: center; }
.card-logo img { display: block; width: 120px; height: auto; }
.card-head { text-align: center; }
.card-head h1 { font-size: 20px; font-weight: 700; }
.card-head p { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.hint { font-size: 13px; color: var(--muted); }
.hint b { color: var(--text); font-weight: 600; }
.checks { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.check-ok::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.check-ko::before { content: "✕ "; color: var(--err-fg); font-weight: 700; }
.code { width: 100%; padding: 10px 12px; border: 1px solid var(--field); border-radius: 10px; background: var(--bg); font: 12px/1.5 ui-monospace, monospace; }
.link-muted { width: 100%; padding: 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; }

/* Forms and buttons */
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }
.input { height: 46px; padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; background: #fff; font: inherit; font-size: 15px; outline: 0; }
.input:focus { border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-outline { border-color: var(--field); background: #fff; color: var(--text); }
.btn-outline:hover { background: var(--hover); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.actions { display: flex; justify-content: flex-end; gap: 12px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.5; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-error { background: var(--err-bg); color: var(--err-fg); }

/* Collapsible sections */
.acc { width: 100%; max-width: 520px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--pad); background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; list-style: none; cursor: pointer; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: ""; width: 8px; height: 8px; margin: -4px 4px 0 0; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.acc[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.acc-body { display: flex; flex-direction: column; gap: 16px; padding: var(--pad); }
.acc-body-wide { gap: 20px; }
.count { margin-left: 10px; padding: 1px 9px; border-radius: 999px; background: #fff; color: var(--accent); font-size: 12px; font-weight: 700; }

/* Devices */
.sub { margin-bottom: 2px; font-size: 13px; font-weight: 700; }
.dev-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee; }
.dev-info { flex: 1 1 200px; min-width: 0; }
.dev-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.dev-meta { margin-top: 2px; font-size: 12px; color: var(--muted); }
.badge { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); font-size: 11px; font-weight: 700; vertical-align: 1px; }

/* Pop-ups */
.modal { width: calc(100% - 32px); max-width: 380px; padding: 28px; border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2); color: var(--text); }
.modal::backdrop { background: rgba(17, 17, 17, 0.45); }
.modal-body { display: flex; flex-direction: column; gap: 20px; }
.modal h2 { font-size: 18px; font-weight: 700; }
.modal p { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 860px) {
  :root { --pad: 14px; }
  .shell { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .logo { width: 44px; }
  .nav { flex: 1; min-width: 0; flex-direction: row; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; gap: 8px; }
  .side-exit { margin: 0 0 0 auto; }
  .exit { white-space: nowrap; }
  .main { gap: 16px; padding: 16px; }
}
