/* Shared UI styles for the side panel and settings. Colours come from theme.css. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--ink);
  padding: 7px 12px; border-radius: var(--radius-sm); font: 600 13px/1.2 var(--font);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .help:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

/* Forms */
label.field { display: block; }
label.field > .label, .label {
  display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 4px;
}
input:not([type]), input[type="date"], input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="email"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font: 14px/1.4 var(--font);
}
textarea { resize: vertical; min-height: 70px; }
textarea.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.counter { font-size: 11px; color: var(--muted); text-align: right; }
.counter.bad { color: var(--warn); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 340px) { .grid2 { grid-template-columns: 1fr; } }

/* Help icon + tooltip */
.help {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--muted); background: transparent;
  color: var(--muted); font: italic 700 10px/14px Georgia, serif; padding: 0; cursor: help; flex: none;
}
.help:hover { border-color: var(--brand); color: var(--brand); }
.pws-tip {
  position: fixed; z-index: 1000; background: var(--ink); color: var(--bg);
  font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; transform: translateY(-2px);
  transition: opacity .12s, transform .12s;
}
.pws-tip.show { opacity: 1; transform: none; }

/* Cards */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 14px; }
.card.tint { background: var(--surface); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h3 { font-size: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.badge.auto { background: var(--brand-soft); color: var(--brand); }
.badge.manual { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.err { background: var(--danger-soft); color: var(--danger); }

.notice { border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13px; border: 1px solid; }
.notice.info { background: var(--brand-soft); border-color: transparent; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.notice.err { background: var(--danger-soft); border-color: transparent; color: var(--ink); }
.notice.ok { background: var(--success-soft); border-color: transparent; color: var(--ink); }

/* Manual checklist */
.manual-list { list-style: none; padding: 0; margin: 0; }
.manual-list li + li { margin-top: 8px; }
.manual-list .check span { font-size: 13px; }
.manual-list input:checked + span { color: var(--muted); text-decoration: line-through; }

/* Issues list */
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.issues li:first-child { border-top: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--muted); }
.dot.error { background: var(--danger); }
.dot.warning { background: var(--warn); }
.dot.ok { background: var(--success); }

/* Spinner */
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } * { transition: none !important; } }
