:root {
  --bg: #F3F6FB; --surface: #FFFFFF; --line: #E3E7EC; --line-strong: #D5DBE2;
  --text: #0F1B2D; --text-2: #33404F; --muted: #5B6676;
  --accent: #0E2FA8; --accent-soft: #E8EEFC;
  --ok-bg: #E4F4EA; --ok: #16653A; --err-bg: #FDECEA; --err: #A11F14;
  --off-bg: #F3F5F7; --teal-bg: #DDF8F5; --teal: #0B6E66; --blue-bg: #E3F2FE; --blue: #0A4F8F;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 'Onest', system-ui, sans-serif; }
body.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
a { color: var(--accent); }
h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 16px; }
p { margin: 0 0 12px; }
code { font: 13px ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); }
.small, small { font-size: 12px; }
.block { display: block; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.main { padding-top: 24px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 18px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.brand-text, .me-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 18px; }
.brand-text small, .me-text small { color: var(--muted); }
.me, .person { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.langs { display: flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.lang { min-width: 40px; min-height: 34px; padding: 0 8px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }
.lang.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(15, 27, 45, 0.12); }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a, .nav-soon { display: flex; align-items: center; min-height: 44px; padding: 0 10px; white-space: nowrap; font-weight: 500; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; }
.nav a.on { font-weight: 600; color: var(--accent); border-bottom-color: var(--accent); }
.nav-soon { color: #9AA3B0; cursor: default; }

/* buttons, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-logout { min-height: 40px; border-color: #F0C9C2; background: #FFF7F6; color: #A8362B; font-size: 13px; }
.btn-small { min-height: 36px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--accent); }
.btn-danger { color: var(--err); }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.form small { font-weight: 400; }
input[type=text], input[type=password], select { height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); padding: 0 12px; font: inherit; font-weight: 400; background: var(--surface); color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.span-all { grid-column: 1 / -1; margin: 0; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card.narrow { max-width: 460px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 12px 32px rgba(15, 27, 45, 0.06); }
.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { margin: 0; max-width: 640px; }
details.card summary { font-weight: 700; font-size: 16px; cursor: pointer; }
.alert { margin: 0; padding: 12px 14px; border-radius: 12px; }
.alert p { margin: 0; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-info { background: var(--accent-soft); color: var(--accent); }
.notice-text { font-weight: 600; overflow-wrap: anywhere; }

/* table */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { text-align: left; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid #F0F2F5; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.row-off .person, .row-off code { opacity: 0.55; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off, .badge-soon { background: var(--off-bg); color: var(--muted); }
.badge-role-admin { background: var(--accent-soft); color: var(--accent); }
.badge-role-om { background: var(--blue-bg); color: var(--blue); }
.badge-role-guard { background: var(--teal-bg); color: var(--teal); }
.sections { list-style: none; margin: 0; padding: 0; }
.sections li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-top: 1px solid #F0F2F5; font-weight: 500; }

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .me-text { display: none; }
  h1 { font-size: 22px; }
}
