/* ITTP SiteShow – admin UI. Plain CSS, no build step. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1c2430;
  --muted: #667085;
  --brand: #42378d; /* purple from the SiteShow logo: sidebar and login background */
  --primary: #42378d;
  --primary-hover: #352c71;
  --danger: #b42318;
  --ok-bg: #e7f6ec; --ok-fg: #1e6b3a;
  --warn-bg: #fdf3e1; --warn-fg: #8a5300;
  --error-bg: #fdecea; --error-fg: #b42318;
  --info-bg: #e8f0fd; --info-fg: #1d4ed8;
  --muted-bg: #eef0f3; --muted-fg: #4b5563;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .85rem; }

/* Layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #e4e0f5; padding: 1.25rem 0; display: flex; flex-direction: column; }
.sidebar .brand { display: block; padding: 0 1.25rem 1.25rem; }
.sidebar .brand img { display: block; width: 120px; height: auto; }
.sidebar nav a { display: block; padding: .5rem 1.25rem; color: inherit; text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgb(255 255 255 / .08); color: #fff; }
.sidebar .nav-label { padding: 1rem 1.25rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #b9b0de; }
.sidebar .user { margin-top: auto; padding: 1rem 1.25rem 0; font-size: .85rem; border-top: 1px solid rgb(255 255 255 / .1); }
.sidebar .user button { background: none; border: 0; color: #d3ccef; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
.main { padding: 2rem 2.5rem; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head .sub { color: var(--muted); margin: 0; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { padding: .75rem 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar .nav-label { display: none; }
  .main { padding: 1.25rem 1rem; }
}

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
.empty { color: var(--muted); padding: 1rem 0; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* Badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-error { background: var(--error-bg); color: var(--error-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-muted { background: var(--muted-bg); color: var(--muted-fg); }

/* Buttons */
.btn { display: inline-block; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f1c4bf; }
.btn-danger:hover { background: var(--error-bg); }
.btn-sm { padding: .25rem .6rem; font-size: .85rem; font-weight: 500; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Forms */
.form { max-width: 640px; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 6rem; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: .85rem; min-height: 32rem; white-space: pre; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.checkbox { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.is-invalid { border-color: var(--danger) !important; }
.error-text { color: var(--danger); font-size: .85rem; margin-top: .25rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 180px; }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.alert ul { margin: .25rem 0 0; padding-left: 1.25rem; }
/* Alert with buttons: text on the left, buttons on the right (wrap below on narrow screens) */
.alert-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
.alert-actions > p { margin: 0; flex: 1 1 22rem; }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); }
.alert-error { background: var(--error-bg); color: var(--error-fg); }
.alert-warn { background: var(--warn-bg); color: var(--warn-fg); }

pre.log, pre.json { background: #0f1720; color: #d6e2ee; padding: 1rem; border-radius: var(--radius); overflow: auto; max-height: 36rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Pagination */
.pagination { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 1.5rem; padding: 1rem; background: var(--brand); }
.auth-logo { display: block; width: 260px; max-width: 70vw; height: auto; }
.auth-card { width: 100%; max-width: 380px; }

/* AI generation (phase 3) */
.main.wide { max-width: none; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.steps li { display: flex; gap: .6rem; align-items: center; }
.steps .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--border); flex: none; }
.steps .done .dot { background: var(--ok-fg); }
.steps .current .dot { background: var(--info-fg); box-shadow: 0 0 0 4px var(--info-bg); }
.steps .current { font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tabs a { padding: .35rem .75rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: inherit; font-size: .9rem; }
.tabs a.active { background: var(--primary); color: #fff; border-color: transparent; }
.review { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .review { grid-template-columns: 1fr 1fr; } }
.review-pane { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); height: 78vh; overflow: auto; }
.review-pane h3 { position: sticky; top: 0; margin: 0; padding: .5rem .75rem; font-size: .85rem; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1; }
.review-pane img { display: block; width: 100%; height: auto; }
.review-pane .frame-wrap { display: flex; justify-content: center; height: calc(100% - 2.2rem); background: #e9e9e9; }
.review-pane iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.review-pane iframe.mobile { width: 390px; }
.notes { white-space: pre-wrap; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: 1rem; }
.checks label { display: flex; gap: .4rem; align-items: center; font-weight: 500; }

.btn:disabled,
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Accessible but invisible text */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
