/* Chainbridge / Dicey Accounting theme — ported from the original Streamlit
   app's styles.py so the Worker version looks like the tool the team knows. */

:root {
  --orange-500: #c4531a;
  --orange-600: #b04a16;
  --orange-400: #e8763a;
  --orange-50:  #fdf3ed;
  --forest-900: #142a1c;
  --forest-800: #1c3a28;
  --forest-700: #24482f;
  --forest-text:#1a2e1f;
  --cream-50:   #f7f4ef;
  --cream-100:  #ede9e1;
  --cream-200:  #ddd9d0;
  --cream-text: #4a4a42;
  --cream-muted:#7a7a70;
  --success:    #2d6a4f;
  --warning:    #d4a017;
  --danger:     #c0392b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background-color: var(--cream-50);
  color: var(--cream-text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}

body { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background-color: var(--forest-800);
  color: #e8e5de;
  padding: 1.5rem 1.25rem;
}
.sidebar .eyebrow { color: var(--orange-400); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 1.5rem; }
.sidebar-brand .logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--orange-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Serif Display', Georgia, serif; font-size: 18px;
}
.sidebar-brand .name { font-family: 'DM Serif Display', Georgia, serif; font-size: 18px; color: #fff; }
.sidebar-brand .sub { font-size: 12px; color: #b8b5ac; }

.id-state-card {
  background-color: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 4px 0 1rem 0;
}
.id-state-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 12.5px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.id-state-row:last-child { border-bottom: 0; }
.id-state-row .mono { font-family: 'DM Mono', monospace; color: var(--orange-400); font-size: 12.5px; }

/* ---------- Main ---------- */
.content { flex: 1; max-width: 1100px; padding: 2.5rem 3rem 4rem; }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--orange-500);
  margin: 2rem 0 0.6rem 0; display: block;
}

.hero-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 48px; color: var(--forest-text); letter-spacing: -0.02em; line-height: 1.1;
}
.hero-title em { color: var(--orange-500); font-style: italic; }
.hero-sub { font-size: 16px; line-height: 1.55; max-width: 640px; margin-top: 0.5rem; }

h6 { font-family: 'DM Serif Display', Georgia, serif; color: var(--forest-text); font-size: 15px; font-weight: 400; margin: 0.25rem 0 0.6rem; }

.muted { color: var(--cream-muted); }

/* ---------- Upload ---------- */
.dropzone {
  border: 2px dashed var(--cream-200);
  border-radius: 12px;
  background: var(--cream-100);
  padding: 2rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover { border-color: var(--orange-400); background: var(--orange-50); }
.linklike {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--orange-500); text-decoration: underline; cursor: pointer;
}

.field { margin-top: 0.75rem; }
.field label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--cream-muted); }
select {
  font: inherit; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--cream-200); background: #fff; color: var(--cream-text);
}

/* ---------- Metrics ---------- */
.metrics { display: flex; flex-wrap: wrap; gap: 12px; margin: 0.5rem 0 1rem; }
.metric {
  background: #fff; border: 1px solid var(--cream-200); border-radius: 12px;
  padding: 12px 18px; min-width: 130px;
}
.metric .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--cream-muted); }
.metric .value { font-family: 'DM Serif Display', Georgia, serif; font-size: 26px; color: var(--forest-text); }

/* ---------- Buttons ---------- */
button.primary {
  background: var(--orange-500); color: #fff; border: none;
  font: inherit; font-weight: 600; padding: 12px 22px; border-radius: 10px; cursor: pointer;
}
button.primary:hover { background: var(--orange-600); }
button.primary:disabled { opacity: 0.5; cursor: default; }
button.primary.wide { width: 100%; margin-bottom: 10px; }
.dl-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dl-row button {
  flex: 1; min-width: 180px; font: inherit; padding: 10px 16px; border-radius: 10px;
  background: #fff; border: 1px solid var(--cream-200); color: var(--cream-text); cursor: pointer;
}
.dl-row button:hover { border-color: var(--orange-400); color: var(--orange-500); }

.generate-row { margin: 1rem 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Progress / messages ---------- */
.progress { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.progress-bar-track, .progress .progress-bar { height: 8px; border-radius: 4px; }
.progress .progress-bar {
  width: 0%; min-width: 0; max-width: 240px; flex: 1;
  background: var(--orange-400); transition: width 0.2s;
}
.progress span { font-size: 12px; color: var(--cream-muted); white-space: nowrap; }

.error {
  background: #fdecea; border: 1px solid var(--danger); color: var(--danger);
  border-radius: 10px; padding: 10px 14px; margin-top: 0.5rem;
  font-family: 'DM Mono', monospace; font-size: 13px; white-space: pre-wrap;
}
.warning {
  background: #fdf6e3; border: 1px solid var(--warning); color: #8a6d0b;
  border-radius: 10px; padding: 10px 14px; margin: 0.5rem 0 1rem;
  font-size: 13px;
}
.warning pre { font-family: 'DM Mono', monospace; font-size: 12px; margin: 6px 0 0; white-space: pre-wrap; }

.run-line { margin: 0.25rem 0 1rem; }
.run-id {
  font-family: 'DM Mono', monospace; background: var(--cream-100);
  border-radius: 6px; padding: 2px 8px; color: var(--forest-text);
}

/* ---------- Tables / tabs ---------- */
details { margin: 0.5rem 0 1rem; }
details summary { cursor: pointer; color: var(--cream-muted); }

.table-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--cream-200); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--cream-100); text-align: left; white-space: nowrap; }
th { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--cream-muted); background: var(--cream-50); position: sticky; top: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab {
  font: inherit; padding: 7px 14px; border-radius: 8px 8px 0 0; cursor: pointer;
  background: var(--cream-100); border: 1px solid var(--cream-200); border-bottom: none; color: var(--cream-muted);
}
.tab.active { background: #fff; color: var(--forest-text); font-weight: 600; }

@media (max-width: 800px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; }
  .content { padding: 1.5rem; }
}
