:root {
  --primary: #D50032; --primary-dark: #990024; --bg: #F6F7F9; --card: #ffffff; --ink: #1B2430; --muted: #5B6675;
  --line: #E3E7EC; --ok: #1F7A4D; --warn: #8a5a00; --bad: #B3261E; --radius: 14px; --tap: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.brand b { display: block; font-size: 18px; }
.brand small { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: var(--tap); padding: 0 18px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: #c9cfd7; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; min-height: var(--tap); padding: 0 14px; border: 1px solid #c9cfd7; border-radius: 12px; font: inherit; background: #fff; color: var(--ink);
}
textarea { padding: 10px 14px; min-height: 90px; resize: vertical; }
input:focus-visible, .btn:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #f4a3b3; outline-offset: 1px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 8px 0; }
label.check input { width: 20px; height: 20px; flex: none; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.err { color: var(--bad); margin: 10px 0 0; min-height: 1.2em; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.gate { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.gate .card { width: min(440px, 94vw); }
.gate .emblem { width: 56px; height: 56px; border-radius: 14px; }
.gate h1 { font-size: 24px; margin: 8px 0 4px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 40; max-width: 92vw; }
dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(560px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(20, 28, 40, .45); }
dialog h2 { font-size: 21px; margin-bottom: 8px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; vertical-align: 1px; background: #eceff3; color: #56606e; }
.pill.ok { background: #e5f4ec; color: #1a6b43; } .pill.warn { background: #fff1d6; color: var(--warn); } .pill.bad { background: #fde8e6; color: var(--bad); } .pill.blue { background: #e3effd; color: #1b5aa6; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
