/* =========================================================
   AGNTLABS Flywheel Tool Kit — shared design system.
   Loaded by every app under /<app>/ via /shared/style.css.
   App-specific overrides live in the app's own style.css.
   ========================================================= */

:root {
  --display: 'Manrope', sans-serif;
  --mono: 'DM Mono', monospace;

  --paper: #f2ede4;
  --paper-dark: #e8e1d5;
  --paper-mid: #ded6c8;
  --ink: #1a1612;
  --ink-mid: #3d3630;
  --ink-light: #6b6258;
  --ink-faint: #9b9188;
  --ink-ghost: #c5bfb6;

  --green: #4a7c3f;
  --green-light: #ddefd8;
  --green-mid: #8bbf82;
  --blue: #2c5f8a;
  --blue-light: #d5e5f0;
  --amber: #b8730a;
  --amber-light: #f5e9d5;
  --red: #c0392b;
  --red-light: #f5dbd9;

  --rule: #b8b0a4;
  --rule-light: #d5cfc7;

  --max-width: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; padding: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* labels */
.label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
  font-weight: 500;
}
.label--sub { color: var(--ink-mid); }

/* nav */
.nav { border-bottom: 1px solid var(--rule-light); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav__brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.nav__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav__crumb {
  color: var(--ink-faint);
  border-bottom: 1px dotted var(--ink-ghost);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav__crumb:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.75rem 5rem;
}

/* hero */
.hero { text-align: center; max-width: 760px; margin: 0 auto; padding-top: 2rem; }
.hero .label { margin-bottom: 1.5rem; }
.hero__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 1.1rem;
}
.hero__subtitle {
  font-size: 1.02rem;
  color: var(--ink-light);
  line-height: 1.7;
  margin: 0 auto 2.25rem;
  max-width: 600px;
}

/* generic form */
.form { text-align: left; margin-top: 0.5rem; display: flex; flex-direction: column; gap: 1rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form__field { display: flex; flex-direction: column; gap: 0.45rem; }
.form__field input,
.form__field select,
.form__field textarea {
  width: 100%;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
}
.form__field textarea { min-height: 180px; font-size: 0.88rem; line-height: 1.6; resize: vertical; }
.form__field input:focus, .form__field select:focus, .form__field textarea:focus { border-color: var(--ink); }
.form__field em { font-style: italic; color: var(--ink-faint); }

.api-key-inline-status {
  margin-left: 0.55rem;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.api-key-inline-status.is-ok  { color: var(--green); }
.api-key-inline-status.is-bad { color: var(--red); }

.form__actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.btn .material-icons-outlined { font-size: 18px; }
.btn--primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn--primary:hover { background: #000; }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--ghost { background: transparent; border: 1px solid var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--small { padding: 0.55rem 0.9rem; font-size: 11px; }

/* error */
.error-card { margin: 1.75rem auto 0; max-width: 760px; animation: fadeIn 0.3s ease; }
.error-card__inner {
  background: var(--red-light);
  border: 1px solid var(--red);
  border-radius: 4px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.error-card__icon { color: var(--red); font-size: 22px; }
.error-card__message { margin: 0.25rem 0 0; color: var(--ink); font-size: 0.95rem; line-height: 1.55; }

/* generic result block */
.block {
  border: 1px solid var(--rule-light);
  border-left: 3px solid var(--ink-ghost);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}
.block--green { border-left-color: var(--green); }
.block--blue  { border-left-color: var(--blue); }
.block--amber { border-left-color: var(--amber); }
.block--red   { border-left-color: var(--red); }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.block__sub { font-family: var(--display); font-size: 0.9rem; color: var(--ink-light); margin: 0.2rem 0 0; line-height: 1.55; }

/* code blocks (output) */
.code {
  margin: 0;
  padding: 1.1rem 1.25rem;
  background: var(--paper-dark);
  border: 1px solid var(--rule-light);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* stats grid for live counters etc */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; }
.stat {
  border: 1px solid var(--rule-light);
  border-radius: 4px;
  background: var(--paper);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat__label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat__value {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.stat__sub { font-family: var(--display); font-size: 0.78rem; color: var(--ink-light); line-height: 1.45; }

/* footer */
.footer { border-top: 1px solid var(--rule-light); padding: 1.75rem; text-align: center; }
.footer__text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}

/* loading shimmer */
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-light);
}
.dot-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-ghost);
  animation: pulse 1.3s infinite ease-in-out;
  display: inline-block;
}

/* tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--display);
}
.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--rule-light);
  font-size: 0.88rem;
}
.table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}
.table td.num { font-family: var(--mono); text-align: right; }

/* animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse  { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }

/* responsive */
@media (max-width: 820px) {
  .main { padding: 2.5rem 1.25rem 4rem; }
  .nav__inner { padding: 0.9rem 1.25rem; }
  .form__row { grid-template-columns: 1fr; }
}
