/* property-app dashboard — self-contained stylesheet (no build step).
 *
 * Hand-authored utility + component CSS so the dashboard renders with no
 * Tailwind/Node toolchain (hermetic build; aligns with the deploy-simplicity
 * priority). `make tailwind` remains available for teams that prefer the full
 * Tailwind pipeline. Vanilla JS only — no Alpine. */

:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 8px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  flex-shrink: 0;
}
.sidebar h1 { font-size: 1.1rem; margin: 0 0 1.5rem; }
.sidebar h1 span { color: var(--accent); }
.sidebar nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  margin-bottom: 0.25rem;
}
.sidebar nav a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-2); color: #06263a; font-weight: 600; }
.sidebar .foot { margin-top: 2rem; color: var(--muted); font-size: 0.8rem; }

.main { flex: 1; padding: 1.5rem 2rem; max-width: 1100px; }
.main h2 { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.card h3 { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat { font-size: 1.8rem; font-weight: 700; }
.stat .unit { font-size: 0.9rem; color: var(--muted); font-weight: 400; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

label { display: block; margin: 0.75rem 0 0.25rem; color: var(--muted); font-size: 0.85rem; }
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  font: inherit;
}
input[type="checkbox"] { width: auto; }

.btn {
  display: inline-block;
  background: var(--accent-2);
  color: #06263a;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }
.btn.danger:hover { background: var(--err); color: #2a0a0a; }

/* A row of single-button forms (Старт/Стоп on the scraper page).
 *
 * Each action gets its own <form> so it posts exactly one thing, but sibling
 * forms are block-level and would stack. The CSP has no `unsafe-inline`, so a
 * `style="display:flex"` would be dropped silently — the grouping has to live
 * here. `form { margin: 0 }` guards against a UA stylesheet adding a gap under
 * the buttons. */
.btn-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.btn-row form { margin: 0; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.info { background: #1e3a5f; color: var(--accent); }
.badge.warn { background: #4a3b12; color: var(--warn); }
.badge.error { background: #4a1717; color: var(--err); }
.badge.ok { background: #12402f; color: var(--ok); }

.notice { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; background: var(--panel-2); color: var(--muted); }
.notice.ok { background: #12402f; color: var(--ok); }
.notice.warn { background: #4a3b12; color: var(--warn); }
.notice.error { background: #4a1717; color: var(--err); }
textarea { min-height: 6rem; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Spacing/text utilities.
 *
 * These exist so that no template needs a `style="…"` attribute. The dashboard's
 * Content-Security-Policy omits `unsafe-inline` from `style-src`, so an inline
 * style attribute would be silently dropped by the browser and the element would
 * lose its spacing with nothing in the logs to explain why. Values mirror the
 * ones these classes replaced, so the layout is unchanged. */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }
.accent { color: var(--accent); }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; }

/* Live logs */
#logs {
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  height: 60vh;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}
#logs .line { padding: 0.05rem 0; }
#logs .INFO { color: var(--text); }
#logs .WARN { color: var(--warn); }
#logs .ERROR { color: var(--err); }
#logs .DEBUG, #logs .TRACE { color: var(--muted); }
#logs .ts { color: var(--muted); }
