/* vpnweb — plain and strict: one neutral palette, one accent, light/dark by
   prefers-color-scheme. System fonts only; no external resources. */
:root {
  --bg: #f6f6f5; --surface: #ffffff; --text: #1d1d1b; --muted: #5f5f5a;
  --line: #d9d9d5; --accent: #2f5d8a; --accent-text: #ffffff;
  --ok: #2f6b3f; --error: #9b2c2c; --focus: #2f5d8a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161716; --surface: #1f201f; --text: #e8e8e4; --muted: #a3a39d;
    --line: #3a3b39; --accent: #8fb3d9; --accent-text: #10161c;
    --ok: #8cc79b; --error: #e39b9b; --focus: #8fb3d9;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.page { max-width: 720px; margin: 0 auto; padding: 16px; }
.top { display: flex; align-items: center; justify-content: space-between;
       gap: 12px; margin: 4px 0 16px; }
/* The title wraps; "Выйти" stays on its row, right-aligned, at any width. */
.top h1 { flex: 1 1 auto; min-width: 0; }
.top .logout { flex: none; }
h1 { font-size: 1.375rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.125rem; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 1rem; margin: 0; font-weight: 600; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
       font-size: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
        padding: 16px; margin: 0 0 16px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.count { color: var(--muted); font-weight: 400; font-size: 0.9375rem; margin-left: 4px; white-space: nowrap; }
.hint, .meta, .label { color: var(--muted); font-size: 0.9375rem; }
.label { margin: 12px 0 4px; }
.notice { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px;
          padding: 10px 12px; background: var(--surface); }
.notice.ok { border-left-color: var(--ok); }
.notice.error { border-left-color: var(--error); }

/* Long values (subscription URL, phone): always wrap inside the box. */
.value { display: block; max-width: 100%; padding: 10px 12px; background: var(--bg);
         border: 1px solid var(--line); border-radius: 6px;
         overflow-wrap: anywhere; word-break: break-all; user-select: all; }

.facts { margin: 0 0 12px; display: grid; gap: 8px; }
.facts div { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: 8px; }
.facts dt { color: var(--muted); overflow-wrap: anywhere; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.status { font-weight: 600; }
.s-confirmed { color: var(--ok); }
.s-rejected, .s-pending { color: var(--error); }

.keys { list-style: none; margin: 0; padding: 0; }
.key { border-top: 1px solid var(--line); padding: 16px 0; min-width: 0; }
.key:first-child { border-top: 0; padding-top: 4px; }
.key-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions form { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center;
       min-height: 44px; min-width: 44px; padding: 8px 16px; border-radius: 6px;
       border: 1px solid var(--line); background: var(--surface); color: var(--text);
       font: inherit; text-decoration: none; cursor: pointer;
       white-space: nowrap; max-width: 100%; }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { border-color: var(--error); background: var(--error); color: var(--surface); }
.btn.danger-outline { color: var(--error); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.logout { margin: 0; }
.create { margin-top: 16px; }
.create .hint { margin-top: 8px; }

.qr-box { margin-top: 8px; }
.qr-box summary { list-style: none; width: fit-content; }
.qr-box summary::-webkit-details-marker { display: none; }
.qr-box[open] summary { margin-bottom: 12px; }
/* Narrow screens: action buttons full width, one per row. */
@media (max-width: 420px) {
  .actions { flex-direction: column; }
  .actions > *, .actions form .btn, .create .btn, .qr-box summary { width: 100%; }
}
.qr { display: block; width: 100%; max-width: 240px; height: auto;
      border: 1px solid var(--line); border-radius: 6px; }
