/* AI Interior Designer - dev-only browser UI (P2-M12). Plain CSS, no framework, no CDN. */

:root {
  --ink: #1f2933;
  --muted: #616e7c;
  --line: #d9dee3;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #2c5f8a;
  --danger-bg: #fdecec;
  --danger-ink: #8a1f1f;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5200;
  --ok-bg: #e6f4ea;
  --ok-ink: #1e6b34;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header.topbar h1 { font-size: 1.1rem; margin: 0; }
header.topbar .spacer { flex: 1; }
header.topbar code { font-size: 0.85em; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
/* P8-A3: a long unbroken id (e.g. the unlock purchase_reference) wraps instead of widening the page. */
code { overflow-wrap: anywhere; word-break: break-word; }

section.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
section.panel h2 { margin-top: 0; font-size: 1.15rem; }
section.panel h3 { font-size: 1rem; margin-bottom: 0.4rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85em; }

.badge {
  display: inline-block;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  font-size: 0.8em;
  border: 1px solid var(--line);
  background: var(--bg);
  white-space: nowrap;
}
.badge.state { background: var(--accent); color: #fff; border-color: var(--accent); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #e6c979; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: #a9d7b5; }
.badge.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: #efb3b3; }

.notice {
  border-left: 4px solid var(--accent);
  background: #eef4f9;
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0;
}
.notice.warn { border-left-color: #e6a700; background: var(--warn-bg); color: var(--warn-ink); }

.error {
  border: 1px solid #efb3b3;
  border-left: 4px solid #c62828;
  background: var(--danger-bg);
  color: var(--danger-ink);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0;
}
.error strong { display: block; margin-bottom: 0.25rem; }
.error pre { margin: 0.4rem 0 0; white-space: pre-wrap; font-size: 0.8em; }
.error:empty { display: none; }

form.stack { display: grid; gap: 0.6rem; max-width: 520px; }
form.stack label { display: grid; gap: 0.2rem; }
form.stack input[type="text"],
form.stack input[type="email"],
form.stack input[type="password"],
form.stack select,
form.stack textarea {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

table { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
/* P8-A2: a table wider than its container scrolls inside this box, not the whole page. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
th, td { border-bottom: 1px solid var(--line); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
th { font-weight: 600; background: var(--bg); }
td.num { text-align: right; white-space: nowrap; }

ul.plain { list-style: none; padding: 0; margin: 0.4rem 0; }
ul.plain li { padding: 0.25rem 0; border-bottom: 1px dotted var(--line); }

.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .dual { grid-template-columns: 1fr; } }
.render-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: var(--bg);
  min-height: 240px;
}
.render-box h3 { margin-top: 0; }
.render-box img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 180px;
  border: 2px dashed #b9c2cc;
  border-radius: 6px;
  color: var(--muted);
  padding: 1rem;
  background: repeating-linear-gradient(45deg, #f2f4f7, #f2f4f7 10px, #e9edf1 10px, #e9edf1 20px);
}

details summary { cursor: pointer; color: var(--muted); }

/* --- credit balance + packages on the dashboard (P4-N1) ------------------------------ */
.credit-balance-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.credit-balance { font-size: 1.5rem; color: var(--accent); min-width: 2ch; }
table.packages { max-width: 720px; }
table.packages td code { font-size: 0.8em; }

/* --- geometry review / confirmation screen (P4-N2B) -----------------------------------
 * Certainty is encoded per element by app.js from its REAL confidence/source: the class
 * (geo-confirmed = solid / geo-estimated = dashed) and the inline opacity are set there;
 * these rules only give each element kind its colour. */
svg.geometry-plan { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.geo-background { fill: #fff; }
.geo-wall { stroke: var(--ink); stroke-linecap: square; }
.geo-door { stroke: #b5651d; stroke-linecap: butt; }
.geo-window { stroke: #2a8ccf; stroke-linecap: butt; }
.geo-obstacle { fill: #d7dde4; stroke: var(--muted); stroke-width: 1.5; }
.geo-label { font: 11px system-ui, sans-serif; fill: var(--muted); }
svg .geo-confirmed { stroke-dasharray: none; }
.geometry-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; align-items: center; margin: 0.5rem 0; color: var(--muted); }
.legend-swatch { display: inline-block; width: 26px; height: 0; border-top: 4px solid var(--ink); vertical-align: middle; }
.legend-swatch.geo-estimated { border-top-style: dashed; opacity: 0.55; }
.legend-swatch.geo-door { border-top-color: #b5651d; }
.legend-swatch.geo-window { border-top-color: #2a8ccf; }
.legend-swatch.geo-obstacle { border-top: none; width: 14px; height: 14px; background: #d7dde4; border: 1px solid var(--muted); }
.geometry-dimensions tr.geo-estimated td, ul.geometry-elements li.geo-estimated { color: var(--muted); font-style: italic; }
.geometry-dimensions tr.geo-estimated code, ul.geometry-elements li.geo-estimated code { font-style: normal; }
