:root {
  --ground: #e6ebef;
  --side: #d9e1e8;
  --panel: #fbfcfd;
  --ink: #172431;
  --muted: #5a6a78;
  --line: #c4cfd8;
  --accent: #2b4bd6;
  --accent-soft: #dfe5fb;
  --ok: #1c7c5b;
  --warn: #b4451f;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
h2 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 650; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* каркас */
.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
aside { background: var(--side); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
aside h1 { font-size: 17px; font-weight: 700; padding: 0 8px; }
nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; flex: 1; }
nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 6px; color: var(--ink); text-decoration: none; }
nav a:hover { background: rgba(255,255,255,.55); }
nav a.cur { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.empty { color: var(--muted); padding: 8px; font-size: 14px; }
main { padding: 34px 40px 60px; max-width: 980px; display: flex; flex-direction: column; gap: 22px; }

/* версии как слоты: заполненные — хранится, пустые — свободно по правилу хранения */
.slots { display: inline-flex; gap: 2px; align-items: flex-end; flex: none; }
.slots i { width: 5px; height: 14px; border-radius: 2px; border: 1px solid var(--muted); opacity: .55; }
.slots i.on { background: var(--accent); border-color: var(--accent); opacity: 1; }
.slots.big { gap: 4px; }
.slots.big i { width: 12px; height: 34px; border-radius: 3px; }

/* панели */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
dl { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; }
dt { color: var(--muted); }
dd { overflow-wrap: anywhere; }
.path { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.note { background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.sub { color: var(--muted); }
.head { display: flex; flex-direction: column; gap: 6px; }
.stored { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.stored b { font-weight: 650; }

/* таблицы */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 10px 8px 0; }
td { padding: 9px 10px 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; padding-right: 0; }
.act { display: inline-flex; gap: 14px; justify-content: flex-end; }
.tag { font-size: 13px; border-radius: 4px; padding: 1px 8px; background: #dcefe7; color: var(--ok); }
.tag.queued { background: #f6ecd2; color: #8a5a00; }
.tag.revoked, .tag.expired { background: #f6e1d8; color: var(--warn); }

/* формы и кнопки */
form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > label { flex: 1 1 200px; }
input[type=text], input[type=password], input[type=number], select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); width: 100%;
}
button { font: inherit; cursor: pointer; border-radius: 6px; padding: 8px 14px; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
button:hover { background: rgba(23,36,49,.07); }
button.primary { background: var(--ink); color: #fff; }
button.primary:hover { background: #2a3b4b; }
button.danger { border-color: var(--warn); color: var(--warn); }
button.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; }
button.link.warn { color: var(--warn); }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
aside > button { width: 100%; }
aside > button.link { text-align: left; padding: 0 8px; width: auto; align-self: flex-start; color: var(--muted); }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }

/* диалоги */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: 0 18px 50px rgba(23,36,49,.28); }
dialog::backdrop { background: rgba(23,36,49,.45); }
dialog > form, dialog > div { padding: 24px; }
dialog h3 { font-size: 19px; }
pre { margin: 0; background: #eef2f5; border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 13px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .15s; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
#toast.err { background: var(--warn); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  main { padding: 22px 16px 40px; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
