/*
 * ElegantW3 — Tools Base Stylesheet
 * ============================================================
 * Shared by all standalone tools pages in /tools/
 * Links: <link rel="stylesheet" href="./ew3-base.css">
 *
 * Contains:
 *  1. Design tokens (:root) — from ew3-design-tokens.css
 *  2. Global reset + body
 *  3. Page layout (header, wrap, footer)
 *  4. Shared components: stat cards, section headers,
 *     tables, badges, legend
 *
 * Do NOT add page-specific CSS here.
 * ============================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');


/* ── 1. Design Tokens ───────────────────────────────────────── */

:root {
  --ew3-rust:          #A84832;
  --ew3-rust-alt:      #b24d33;
  --ew3-rust-grad-s:   #b95138;
  --ew3-rust-grad-e:   #9e3f2b;
  --ew3-rust-bg-tint:  rgba(168, 72, 50, 0.08);
  --ew3-rust-border:   rgba(168, 72, 50, 0.28);

  --ew3-dark-deepest:  #1A1815;
  --ew3-dark-near-blk: #1E1D1B;
  --ew3-dark-hero:     #2C2B28;
  --ew3-dark-card-1:   #252220;
  --ew3-dark-card-2:   #2E2820;
  --ew3-dark-hover:    #3A3835;
  --ew3-dark-divider:  #3C3835;
  --ew3-dark-warm:     #665A50;

  --ew3-light-section: #F5F4F0;
  --ew3-light-cream:   #F0EDE8;
  --ew3-light-neutral: #E0DCD4;
  --ew3-light-input:   #FDFCFB;

  --ew3-text-primary:    #1E1D1B;
  --ew3-text-body-dark:  #8C8178;
  --ew3-text-body-light: #787068;
  --ew3-text-desc:       #5A5450;
  --ew3-text-muted:      #A09890;

  --ew3-border-main:   #D8D4CC;
  --ew3-border-badge:  #C4C0B8;

  --ew3-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ew3-r-card: 18px;
  --ew3-r-btn:  50px;
  --ew3-r-pill: 999px;
  --ew3-r-tag:  4px;

  --ew3-max-width: 1200px;
  --ew3-transition: 0.2s ease;

  /* Semantic shortcuts used throughout tools */
  --c-pos:  #0d7c5f;
  --c-neg:  #b83232;
  --c-warn: #a06b00;
}


/* ── 2. Reset + Body ────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--ew3-font);
  background: var(--ew3-light-section);
  color: var(--ew3-text-primary);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


/* ── 3. Page Header ─────────────────────────────────────────── */

/* Dark header bar — used by report and diagram pages */
.page-hdr {
  background: var(--ew3-dark-near-blk);
  padding: 24px 40px 22px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.page-hdr--light {
  background: linear-gradient(135deg, var(--ew3-dark-near-blk) 0%, var(--ew3-dark-card-1) 100%);
}

.hdr-logo {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ew3-rust);
  margin-bottom: 8px;
}

.hdr-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ew3-light-cream);
  letter-spacing: -.03em;
  margin-bottom: 5px;
}

.hdr-sub {
  font-size: 12px;
  color: var(--ew3-text-muted);
  line-height: 1.6;
}

.hdr-sub strong { color: #D8D4CC; }

.hdr-right {
  text-align: right;
}

.hdr-site {
  font-size: 12px;
  color: var(--ew3-rust);
  font-weight: 600;
}

.hdr-gen {
  font-size: 11px;
  color: var(--ew3-text-muted);
  margin-top: 4px;
}

/* Header inner row (space-between layout) */
.hdr-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

/* Sample badge */
.hdr-sample {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--ew3-r-tag);
  background: var(--ew3-rust-bg-tint);
  color: var(--ew3-rust);
  margin-top: 8px;
}

@media (max-width: 768px) {
  .page-hdr { padding: 20px; }
}


/* ── 4. Content Wrapper ─────────────────────────────────────── */

.wrap {
  flex: 1;
  max-width: var(--ew3-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 28px 40px;
}

@media (max-width: 768px) {
  .wrap { padding: 16px 20px; }
}


/* ── 5. Stat Cards ──────────────────────────────────────────── */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--ew3-border-main);
  border-radius: var(--ew3-r-card);
  padding: 18px 20px;
}

.stat-card.alert-red   { border-color: #f5c2c2; }
.stat-card.alert-amber { border-color: #f0d88c; }
.stat-card.alert-green { border-color: #b2d9c6; }

.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ew3-text-muted);
  margin-bottom: 8px;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--ew3-text-primary);
  letter-spacing: -.04em;
  line-height: 1;
}

.stat-val.c-pos  { color: var(--c-pos); }
.stat-val.c-neg  { color: var(--c-neg); }
.stat-val.c-warn { color: var(--c-warn); }

.stat-note {
  font-size: 11px;
  color: var(--ew3-text-muted);
  margin-top: 5px;
}

.stat-delta {
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
}

.stat-delta.up { color: var(--c-pos); }
.stat-delta.dn { color: var(--c-neg); }
.stat-delta.nt { color: var(--ew3-text-muted); }


/* ── 6. Section Header ──────────────────────────────────────── */

.section { margin-bottom: 28px; }

.section-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-hdr h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ew3-text-primary);
}

.s-badge {
  background: var(--ew3-light-section);
  border: 1px solid var(--ew3-border-main);
  color: var(--ew3-text-body-light);
  padding: 2px 10px;
  border-radius: var(--ew3-r-card);
  font-size: 11px;
}

.s-note {
  font-size: 11px;
  color: var(--ew3-text-muted);
}


/* ── 7. Tables ──────────────────────────────────────────────── */

.tbl-wrap {
  background: #fff;
  border: 1px solid var(--ew3-border-main);
  border-radius: var(--ew3-r-card);
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 520px;
}

th {
  background: var(--ew3-light-section);
  color: var(--ew3-text-body-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--ew3-border-main);
  white-space: nowrap;
}

td {
  padding: 9px 14px;
  border-top: 1px solid var(--ew3-border-main);
  vertical-align: middle;
}

tr:first-child td { border-top: none; }
tr:hover td       { background: var(--ew3-light-section); }

.td-main { font-weight: 600; color: var(--ew3-text-primary); }
.td-muted { font-size: 11px; color: var(--ew3-text-muted); }
.td-muted a { color: var(--ew3-rust); text-decoration: none; }
.td-muted a:hover { text-decoration: underline; }
.td-empty { color: var(--ew3-text-muted); font-style: italic; text-align: center; padding: 24px; }

.c-pos { color: var(--c-pos); font-weight: 600; }
.c-neg { color: var(--c-neg); font-weight: 600; }
.c-neu { color: var(--ew3-text-muted); }


/* ── 8. Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--ew3-r-tag);
  white-space: nowrap;
}

.badge-red    { background: #ffe0e0; color: var(--c-neg); }
.badge-amber  { background: #fff3cd; color: var(--c-warn); }
.badge-green  { background: #d4edda; color: #155724; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-rust   { background: var(--ew3-rust-bg-tint); color: var(--ew3-rust); }


/* ── 9. Footer ──────────────────────────────────────────────── */

.page-foot {
  padding: 16px 40px;
  border-top: 1px solid var(--ew3-border-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--ew3-light-section);
}

.foot-logo {
  font-size: 13px;
  font-weight: 800;
  color: var(--ew3-text-primary);
  letter-spacing: -.02em;
}

.foot-logo em { color: var(--ew3-rust); font-style: normal; }
.foot-note    { font-size: 11px; color: var(--ew3-text-muted); text-align: right; line-height: 1.6; }

@media (max-width: 768px) {
  .page-foot { padding: 16px 20px; }
  .foot-note { text-align: left; }
}


/* ── 10. Architecture page canvas + legend ──────────────────── */

.arch-canvas {
  flex: 1;
  padding: 28px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow: auto;
}

.arch-canvas svg { width: 100%; max-width: 1020px; height: auto; }

.arch-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--ew3-text-muted);
}

.leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .arch-canvas { padding: 20px; }
}
