/* AnvixaAI dashboard — obsidian theme. Near-black canvas, #111 surfaces with
   1px #222 borders, white primary buttons, status chips per lifecycle state. */
:root {
  --bg: #0a0a0a;
  --surface: #111;
  --line: #222;
  --ink: #f2f3f5;
  --muted: #9aa0a6;
  --faint: #5c6166;
  --radius: 10px;
  --blue: #4a7dbd;
  --amber: #b58a2f;
  --green: #3f9d63;
  --red: #b0413e;
  --mono: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
/* The hidden ATTRIBUTE must always win over any author display rule. */
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 14.5px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: inherit; }

header {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 18px 24px;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; text-decoration: none; }
.brand span { color: var(--muted); }
.hright { display: flex; align-items: center; gap: 12px; }

main { max-width: 1100px; margin: 0 auto 90px; padding: 0 24px; }

h1 { font-size: 22px; margin: 8px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin: 0 0 14px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: 13.5px; }
.tiny { color: var(--muted); font-size: 12.5px; }
.tiny a { color: var(--muted); }
.tiny a:hover { color: var(--ink); }
.err { color: #d97b78; font-size: 13px; margin: 8px 0 0; }
.err.inline { margin: 0; }

input, textarea, select {
  font: inherit; color: var(--ink); background: #0d0d0d;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px;
  outline: none; transition: border-color 0.15s;
}
select { cursor: pointer; }
select:focus { border-color: #3d3d3d; }
input { flex: 1; min-width: 160px; }
input:focus, textarea:focus { border-color: #3d3d3d; }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { width: 100%; resize: vertical; }

button {
  font: inherit; font-weight: 600; padding: 10px 18px; border: 0;
  border-radius: 8px; cursor: pointer; background: #fff; color: #0a0a0a;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.15s, background 0.15s;
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid #2c2c2c; }
button.ghost:hover { background: #181818; opacity: 1; }
button.quiet { background: transparent; color: var(--muted); border: 0; }
button.quiet:hover { color: #d97b78; opacity: 1; }
button.small { padding: 7px 13px; font-size: 13px; }
button.wide { width: 100%; }

.spin {
  width: 12px; height: 12px; border: 2px solid rgba(10, 10, 10, 0.3);
  border-top-color: #0a0a0a; border-radius: 50%; animation: rot 0.7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* status chips: site pending/active + page discovered/crawled/draft/published/error */
.chip {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 10px;
  border-radius: 999px; border: 1px solid #3a3a3a; color: var(--muted);
  background: rgba(102, 102, 102, 0.12); flex: none;
}
.chip.crawled { color: #7fa8d9; border-color: rgba(74, 125, 189, 0.45); background: rgba(74, 125, 189, 0.12); }
.chip.draft { color: #d8b25e; border-color: rgba(181, 138, 47, 0.45); background: rgba(181, 138, 47, 0.12); }
.chip.published, .chip.active { color: #6cc492; border-color: rgba(63, 157, 99, 0.45); background: rgba(63, 157, 99, 0.12); }
.chip.error { color: #d97b78; border-color: rgba(176, 65, 62, 0.5); background: rgba(176, 65, 62, 0.12); }

/* auth */
.auth { display: flex; justify-content: center; padding-top: 9vh; }
.authcard {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px;
}
.authcard h1 { margin: 0 0 6px; }
.authcard input { width: 100%; margin: 14px 0 10px; }
.authcard .err { min-height: 18px; }

/* sites grid */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; margin: 0 0 22px;
}
.sitecard { display: block; text-decoration: none; margin: 0; transition: border-color 0.15s; }
.sitecard:hover { border-color: #383838; }
.sitename { font-weight: 650; font-size: 16px; }
.cardfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.keychip {
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* site workspace */
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.sitehead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
.sitehead h1 { margin: 0 0 1px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 20px; }
.tabs a {
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: #fff; }

/* pages table */
.tablebar { margin: 0 0 14px; }
.crawlmax { display: inline-flex; align-items: center; gap: 6px; }
.crawlmax input { width: 72px; min-width: 0; flex: none; padding: 6px 8px; }
.tablecard { padding: 4px 0; }
.tscroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line);
}
td { padding: 10px 16px; border-bottom: 1px solid #1a1a1a; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.pathcell { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.actions { white-space: nowrap; text-align: right; }
.actions button { margin-left: 6px; }

/* modal */
.modal-wrap {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow: auto;
}
.modal {
  background: var(--surface); border: 1px solid #262626; border-radius: 14px;
  padding: 24px; width: 100%; max-width: 640px;
}
.modal h2 { margin-top: 0; }
.modal .row { margin-top: 14px; }
textarea.jsonedit {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  min-height: 320px; white-space: pre;
}

pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  background: #0d0d0d; border: 1px solid var(--line); color: #dfe3e8;
  padding: 13px 15px; border-radius: 8px; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all; margin: 12px 0;
}
code {
  font-family: var(--mono); font-size: 12.5px; background: #191919;
  border: 1px solid #242424; padding: 1px 6px; border-radius: 5px;
}

/* profile form */
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.field input { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.formsect { margin: 20px 0 10px; }
.formfoot { margin-top: 18px; }
@media (max-width: 640px) { .formgrid { grid-template-columns: 1fr; } }

/* report tab — client-facing readiness report */
.reporthead { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin: 0 0 16px; }
.reporthead h2 { margin: 0 0 2px; }
.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 0 0 12px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; min-width: 0;
}
.statnum {
  font-size: 26px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.statlabel {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); margin-top: 3px;
}
.stat.warn { border-color: rgba(181, 138, 47, 0.45); }
.stat.warn .statnum { color: #d8b25e; }
.coverbar { height: 6px; background: #1a1a1a; border-radius: 999px; overflow: hidden; margin: 0 0 20px; }
.coverfill { height: 100%; background: #fff; border-radius: 999px; }
.chip.changed {
  color: #d8b25e; border-color: rgba(181, 138, 47, 0.45);
  background: rgba(181, 138, 47, 0.12); margin-left: 6px;
}
.reportcard td { font-variant-numeric: tabular-nums; }

/* print — the Report tab doubles as a clean client-facing document */
@media print {
  body { background: #fff; color: #000; }
  header, nav, .tabs, .tablebar, button, .crumb, .noprint { display: none !important; }
  .card, .stat, .tablecard { background: #fff; border-color: #bbb; color: #000; }
  table { color: #000; }
  th { color: #333; border-bottom-color: #bbb; }
  td { border-bottom-color: #ddd; }
  .muted, .tiny, .statlabel, td.muted, .pathcell { color: #333; }
  .statnum { color: #000; }
  .stat.warn { border-color: #b58a2f; }
  .stat.warn .statnum { color: #7a5410; }
  .chip { background: none !important; border: 1px solid #999 !important; color: #000 !important; }
  .coverbar { background: #eee; border: 1px solid #ccc; }
  .coverfill { background: #000; }
  a { color: #000; text-decoration: none; }
}
