:root {
  --text: #1f2328;
  --muted: #6b7280;
  --line: #d0d7de;
  --bg: #ffffff;
  --soft: #f6f8fa;
  --accent: #2563eb;
  --up: #15803d;
  --down: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--down); }
.ok { color: var(--up); }
.d-up { color: var(--up); }
.d-down { color: var(--down); }
.d-zero { color: var(--muted); }

/* buttons and inputs: close to browser defaults */
button, .btn { font: inherit; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #eaeef2; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.danger { color: var(--down); }
button.small, .btn.small { padding: 1px 7px; font-size: 13px; }
input, select, textarea { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

/* login */
.auth { max-width: 320px; margin: 15vh auto 0; display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }

/* header */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.top .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dd { position: relative; }
.dd summary { list-style: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); cursor: pointer; }
.dd summary::-webkit-details-marker { display: none; }
.dd summary::after { content: " ▾"; }
.dd-list { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 4px; z-index: 5; min-width: 180px; }
.dd-list a { display: block; padding: 6px 10px; color: var(--text); text-decoration: none; }
.dd-list a:hover { background: var(--soft); }

.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 20px 0; }
.bar #search { width: 340px; }
.progress, .warn { margin: 10px 20px 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); }
.warn { border-color: #e5c07b; background: #fdf8ec; }
.progress progress { width: 200px; vertical-align: middle; }
main { padding: 4px 20px 40px; }
.empty { padding: 40px 20px; color: var(--muted); }

/* blogger block: one-line head + a plain table of placements */
.blogger { border: 1px solid var(--line); border-radius: 4px; margin-top: 14px; }
.bhead { display: flex; align-items: center; gap: 14px; white-space: nowrap; padding: 7px 12px; background: var(--soft); border-bottom: 1px solid var(--line); }
.bhead .name { font-weight: 600; font-size: 15px; }
.bhead .stats { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bhead .stats > span { margin-right: 14px; }
.bhead .stat b { font-weight: 600; }
.bhead .tools { display: flex; gap: 6px; }
.bnote { padding: 6px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.berr { padding: 6px 12px; border-bottom: 1px solid var(--line); color: var(--down); }
.noposts { padding: 8px 12px; color: var(--muted); }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 4px 7px; border-bottom: 1px solid #eaeef2; text-align: left; vertical-align: middle; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12.5px; }
td.num, th.num { text-align: right; }
td.title { white-space: normal; min-width: 140px; }
td select { padding: 2px 4px; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.tbl-wrap { overflow-x: auto; }
td.tools { text-align: right; }
td.tools button { margin-left: 4px; }
.delta { font-size: 11.5px; margin-left: 3px; }
.draft { color: var(--muted); font-style: italic; }
tr.more > td { background: #fbfcfd; padding: 10px 12px; white-space: normal; }
.fields { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 8px; }
.fields .k { color: var(--muted); }
table.hist { width: auto; }
table.hist th, table.hist td { padding: 3px 10px; }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 6px; padding: 20px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(0, 0, 0, .3); }
dialog label { display: block; margin: 10px 0 3px; font-size: 13px; color: var(--muted); }
dialog input:not([type=file]), dialog select { width: 100%; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.dlg-actions .spacer { flex: 1; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
pre.log { background: var(--soft); border: 1px solid var(--line); padding: 8px; max-height: 300px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 4px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2328; color: #fff; padding: 8px 14px; border-radius: 4px; z-index: 50; }
