:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #d8e0eb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --orange: #f97316;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 48px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(52px, 1fr));
  gap: 8px;
  min-width: 260px;
}

.status-strip span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.input-panel {
  position: sticky;
  top: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  margin-bottom: 7px;
  font-size: 20px;
  line-height: 1.2;
}

.panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: #1f2937;
  line-height: 1.65;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.sample-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sample-list button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
  padding: 10px 12px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.sample-list button:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0 16px;
  font-weight: 700;
}

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

.primary:hover {
  background: var(--blue-dark);
}

.ghost {
  border-color: var(--line);
  background: #fff;
  color: #334155;
}

.ghost:hover {
  border-color: #b8c4d6;
  background: #f8fafc;
}

.compact {
  min-height: 34px;
  padding: 0 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
}

.entity-output {
  min-height: 170px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
  color: #1f2937;
  line-height: 2.1;
  white-space: pre-wrap;
}

.entity-output pre {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 7px;
  padding: 2px 8px;
  color: inherit;
  font-weight: 700;
}

mark span {
  font-size: 10px;
  letter-spacing: 0;
}

mark.person,
.legend-item.person {
  background: #dbeafe;
  color: #075985;
}

mark.org,
.legend-item.org {
  background: #dcfce7;
  color: #166534;
}

mark.loc,
.legend-item.loc {
  background: #ffedd5;
  color: #9a3412;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #eef3f9;
  color: #334155;
  font-weight: 800;
}

td code {
  color: #1e40af;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.graph-panel {
  grid-column: 2;
}

.graph {
  width: 100%;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.empty,
.empty-cell {
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-header,
  .workspace {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
  }

  .workspace {
    display: grid;
  }

  .input-panel {
    position: static;
  }

  .graph-panel {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1220px);
    padding: 24px 0 32px;
  }

  .panel {
    padding: 16px;
  }

  .status-strip {
    min-width: 0;
  }

  .actions {
    align-items: stretch;
  }

  .primary,
  .ghost {
    flex: 1 1 110px;
  }

  .toggle {
    width: 100%;
  }
}
