:root {
  --bg: #f7f7f7; --card: #fff; --text: #1f1f1f; --muted: #666; --line: #e3e3e3;
  --blue: #0a7cff; --green: #28a745; --red: #dc3545; --yellow: #f5c518; --ok: #1e7a1e; --bad: #c62828;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 40px; }
a { color: var(--blue); }
h2 { font-size: 20px; margin: 0 0 16px; }
h3 { font-size: 16px; margin: 20px 0 10px; }
small { color: var(--muted); }
code { background: #f0f0f0; padding: 1px 4px; border-radius: 3px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; gap: 12px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.who { display: flex; align-items: center; gap: 8px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; margin: -8px 0 18px; }
.nav a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--text); }
.nav a:hover { background: #ececec; }
.nav a.on { background: var(--text); color: #fff; }

.card { background: var(--card); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.07); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 380px; margin: 40px auto; }
.card.wide-ish { max-width: 520px; }
.table-wrap { overflow-x: auto; }

label { display: block; margin: 10px 0 4px; font-weight: 600; }
label.chk { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
label.chk input { margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=file], select {
  font: inherit; padding: 7px 10px; border: 1px solid #c8c8c8; border-radius: 6px; background: #fff; max-width: 100%;
}
.card.narrow input[type=text], .card.narrow input[type=password], .card.narrow input[type=number] { width: 100%; }
input:focus, select:focus { outline: 2px solid rgba(10,124,255,.35); border-color: var(--blue); }
input.num { width: 110px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 14px 0; padding: 6px 14px 12px; }
legend { font-weight: 600; padding: 0 4px; }

.btn { display: inline-block; font: inherit; border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; color: #fff; background: #777; text-decoration: none; line-height: 1.3; }
.btn.primary { background: var(--blue); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.yellow { background: var(--yellow); color: #222; }
.btn.sm { padding: 4px 10px; font-size: 14px; }
.btn.block { width: 100%; margin-top: 18px; }
.btn:hover { filter: brightness(.94); }
.btn[disabled] { opacity: .6; cursor: wait; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--blue); }
button.link.danger { color: var(--red); }
form.inline { display: inline; margin: 0; }
.reset { color: var(--muted); text-decoration: none; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert.ok { background: #e7f5e9; color: #1b5e20; }
.alert.err { background: #fdecea; color: #b00020; }
.msg-err { color: red; margin: 10px 0 0; }
.hint { color: var(--muted); }
.notfound { font-size: 17px; margin: 0; }
.st-ok { color: var(--ok); }
.st-bad { color: var(--bad); }
.nowrap { white-space: nowrap; }

.search { display: flex; gap: 10px; align-items: center; }
.search input[type=text] { flex: 1; font-size: 16px; padding: 9px 12px; border: 2px solid #222; }
.search input.bad { border-color: var(--red); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; font-size: 14px; background: #fafafa; }
table.results td { font-size: 14px; }
table.list td.actions { white-space: nowrap; }
td.actions > * { vertical-align: middle; }
.ua { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form label { margin: 0; font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filters label { margin: 0; font-weight: 400; }
.settings { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; max-width: 720px; }
.settings label { margin: 0; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.grid2 input { width: 100%; }
.help { color: #444; font-size: 14px; }
.help p { margin: 8px 0; }
.tag { display: inline-block; background: #f0f0f0; border-radius: 4px; padding: 3px 8px; margin: 2px 4px 2px 0; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 12px; }

details.pw { display: inline-block; position: relative; }
details.pw summary { list-style: none; }
details.pw summary::-webkit-details-marker { display: none; }
details.pw[open] .pw-form { position: absolute; right: 0; z-index: 5; background: #fff; padding: 10px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.15); display: flex; gap: 6px; margin-top: 4px; }

@media (max-width: 640px) {
  .search { flex-wrap: wrap; }
  .search input[type=text] { flex-basis: 100%; }
  .settings { grid-template-columns: 1fr; }
}

.card > h3:first-child { margin-top: 0; }
.import-form + .help { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
