:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-muted: #eef2ea;
  --ink: #18201b;
  --muted: #667064;
  --line: #d8dfd3;
  --accent: #0f766e;
  --accent-strong: #0b5e57;
  --warning: #b45309;
  --warning-bg: #fff7ed;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --shadow: 0 18px 50px rgba(22, 35, 27, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workbench {
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
}

.topbar-actions,
.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(420px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.toast {
  margin: -8px 0 16px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  padding: 11px 13px;
  background: #f0fdfa;
  color: #134e4a;
  font-weight: 700;
  line-height: 1.45;
}

.input-pane,
.result-pane {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-pane {
  position: sticky;
  top: 20px;
  padding: 18px;
}

.result-pane {
  padding: 18px;
}

.pane-head,
.card-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

textarea {
  display: block;
  width: 100%;
  min-height: 560px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #fbfcfa;
  line-height: 1.55;
  tab-size: 2;
}

textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.input-actions {
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover,
.ghost-button:hover {
  background: var(--surface-muted);
}

.ghost-button.is-active {
  border-color: var(--accent);
  background: #ccfbf1;
  color: #134e4a;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.danger-button {
  color: var(--danger);
}

.error-message {
  margin-top: 12px;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-bg);
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.summary-tile.warn {
  background: var(--warning-bg);
  border-color: #fed7aa;
}

.summary-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.summary-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.issue-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.issue-item {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--warning-bg);
  color: #7c2d12;
  line-height: 1.45;
  font-size: 13px;
}

.issue-item strong {
  color: #431407;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.saved-view {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.saved-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.saved-toolbar h2 {
  font-size: 28px;
}

.saved-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-pill strong {
  color: var(--ink);
  margin-right: 4px;
}

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

.empty-state {
  grid-column: 1 / -1;
  min-height: 280px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.event-card {
  min-width: 0;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.event-card.has-warning {
  border-color: #fdba74;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.badge {
  max-width: 100%;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-muted);
  color: #263228;
  font-size: 12px;
  font-weight: 700;
}

.badge.primary {
  background: #ccfbf1;
  color: #134e4a;
}

.badge.warn {
  background: #ffedd5;
  color: #9a3412;
}

.event-title {
  font-size: 23px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.event-meta {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.event-meta span {
  color: var(--ink);
  font-weight: 700;
}

.event-description {
  flex: 1;
  color: #2e3a31;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.card-links a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.card-links a:hover {
  text-decoration: underline;
}

.notes {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .topbar-actions {
    margin-top: 14px;
  }

  .saved-toolbar {
    display: block;
  }

  .input-pane {
    position: static;
    margin-bottom: 16px;
  }

  textarea {
    min-height: 360px;
  }
}

@media (max-width: 680px) {
  .summary-grid,
  .card-list,
  .saved-card-list {
    grid-template-columns: 1fr;
  }

  .pane-head,
  .card-list-head {
    display: block;
  }

  .hint {
    display: block;
    margin-top: 5px;
    text-align: left;
  }

  .event-card {
    min-height: 0;
  }
}
