:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --border: #d9e2ec;
  --danger: #b42318;
  --warning: #d97706;
  --ok: #15803d;
  --shadow: 0 14px 35px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f2fe 0%, var(--bg) 36%, #ecfdf5 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 28px 20px;
  background: rgba(15, 23, 42, 0.96);
  color: #e2e8f0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #94a3b8;
}

.tool-nav {
  display: grid;
  gap: 10px;
}

.tool-nav a,
.tool-nav span {
  display: block;
  border-radius: 14px;
  padding: 12px 14px;
  color: #cbd5e1;
  text-decoration: none;
}

.tool-nav a.active {
  background: rgba(20, 184, 166, 0.18);
  color: #fff;
  border: 1px solid rgba(45, 212, 191, 0.38);
}

.tool-nav a:hover,
.tool-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.tool-nav .disabled {
  color: #64748b;
  border: 1px dashed rgba(148, 163, 184, 0.35);
}

.sidebar-note {
  margin-top: auto;
  color: #94a3b8;
  font-size: .9rem;
}

.page-content {
  min-width: 0;
}

.app-header,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 36px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .78rem;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

h2 {
  font-size: 1.18rem;
  margin-bottom: 18px;
}

.lead {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.status-card,
.notice,
.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.status-card {
  min-width: 230px;
  padding: 18px;
}

.status-card strong,
.status-card small {
  display: block;
}

.status-card small {
  color: var(--muted);
  margin-top: 4px;
}

.status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--danger);
}

.status-dot.partial {
  background: var(--warning);
}

.status-dot.complete {
  background: var(--ok);
}

.notice {
  padding: 16px 18px;
  margin-bottom: 20px;
  color: #344054;
}

.card {
  padding: 24px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: block;
  color: #344054;
  font-weight: 700;
  font-size: .94rem;
}

label span {
  color: var(--danger);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--primary);
}

.invalid {
  border-color: var(--danger) !important;
  background: #fff7f6;
}

.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0 22px;
  background: linear-gradient(180deg, rgba(244,247,251,0), rgba(244,247,251,.96) 35%);
  z-index: 1;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .18);
}

button:hover,
button:focus-visible {
  background: var(--primary-dark);
}

button.secondary {
  background: #e5e7eb;
  color: #111827;
  box-shadow: none;
}

.output-card pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  min-height: 160px;
}

footer {
  padding: 12px 0 32px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px 16px;
  }

  .tool-nav {
    grid-template-columns: 1fr;
  }

  .sidebar-note {
    margin-top: 0;
  }
}

@media (max-width: 780px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .actions {
    position: static;
  }

  button {
    width: 100%;
  }
}
