:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1d2330; --muted: #677085; --line: #e1e4ea;
  --accent: #1f5fbf; --accent-text: #fff; --ok: #1d7a46; --ok-bg: #e5f4ec; --warn: #8a5a00; --warn-bg: #fdf3dc;
  --err: #b42318; --err-bg: #fde8e6; --tag: #eef1f6;
}
/* Тёмная тема: по системе, пока пользователь не выбрал сам (data-theme на <html>, см. theme.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171d; --surface: #1c2028; --text: #e6e8ee; --muted: #9aa2b4; --line: #2c323d;
    --accent: #5b9bff; --accent-text: #0b1220; --ok: #6fd19a; --ok-bg: #173323; --warn: #f1c46b; --warn-bg: #3a2e12;
    --err: #ff8b80; --err-bg: #3d1916; --tag: #262c37;
  }
}
:root[data-theme="dark"] {
    --bg: #14171d; --surface: #1c2028; --text: #e6e8ee; --muted: #9aa2b4; --line: #2c323d;
    --accent: #5b9bff; --accent-text: #0b1220; --ok: #6fd19a; --ok-bg: #173323; --warn: #f1c46b; --warn-bg: #3a2e12;
    --err: #ff8b80; --err-bg: #3d1916; --tag: #262c37;
}
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; } h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { background: var(--tag); padding: 0 .3em; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }

.top { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.top nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); }
.top nav a.on, .top nav a:hover { background: var(--tag); color: var(--text); text-decoration: none; }
.me { display: flex; gap: .75rem; align-items: center; font-size: .9rem; }
.me form { margin: 0; }
.theme-toggle { background: none; border: 1px solid var(--line); border-radius: 99px; padding: .2rem .65rem; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.theme-toggle:hover { color: var(--text); }
.login-theme { position: fixed; top: 12px; right: 16px; }
main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }

input, select, textarea, button, .btn { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; min-width: 0; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .btn { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .9rem; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.danger { color: var(--err); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
button.link.danger { color: var(--err); }

.stack { display: flex; flex-direction: column; gap: .9rem; } .stack label { display: flex; flex-direction: column; gap: .3rem; }
.narrow { max-width: 420px; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.addr { display: flex; align-items: center; gap: .35rem; } .addr input { flex: 1; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; } .filters input[type=search] { flex: 1; min-width: 200px; }
form.inline { display: inline; margin-left: .75rem; }

.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); } .flash.warn { background: var(--warn-bg); color: var(--warn); }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: .5rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.list tr:last-child td { border-bottom: 0; }
.list .num { text-align: right; white-space: nowrap; } .list .cb { width: 2rem; }
.bulkbar { display: flex; gap: 1rem; align-items: center; margin-bottom: .5rem; color: var(--muted); font-size: .9rem; }

.st { font-size: .8rem; padding: .1rem .5rem; border-radius: 99px; white-space: nowrap; }
.st.ok { background: var(--ok-bg); color: var(--ok); } .st.warn { background: var(--warn-bg); color: var(--warn); } .st.off { background: var(--err-bg); color: var(--err); }
.tag { font-size: .75rem; padding: .05rem .45rem; border-radius: 4px; background: var(--tag); color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; }
.panel form { margin: 0 0 .75rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dl.kv.big { font-size: 1.1rem; }
.pw { font-family: ui-monospace, Menlo, monospace; font-weight: 600; letter-spacing: .03em; }
.skipped { padding-left: 1.2rem; }

.login { max-width: 360px; margin: 10vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.75rem; }
.login h1 { margin-bottom: 0; }

.cards { display: none; }
@media print {
  @page { margin: 12mm; }
  .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .top, .noprint, .flash { display: none !important; }
  main { padding: 0; max-width: none; }
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
  .card { border: 1px dashed #888; padding: 5mm; break-inside: avoid; }
  .card h3 { margin: 0 0 2mm; font-size: 12pt; }
  .card .who { margin: 0 0 2mm; font-weight: 600; }
  .card dl { display: grid; grid-template-columns: max-content 1fr; gap: 1mm 4mm; margin: 0 0 2mm; }
  .card dt { color: #555; } .card dd { margin: 0; }
  .card p { margin: 1mm 0; } .card .small { font-size: 8.5pt; color: #444; }
  .card .pw { font-size: 13pt; }
}
