:root {
  --bg-0: #f4f8f7;
  --bg-1: #ffffff;
  --ink: #132f2b;
  --ink-soft: #3c5f58;
  --brand: #0f766e;
  --brand-2: #ea580c;
  --line: #d7e3e0;
  --ok: #166534;
  --warn: #9a3412;
  --error: #b91c1c;
  --shadow: 0 12px 40px rgba(18, 54, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 15% 10%, #dcfce7 0%, transparent 40%),
    radial-gradient(circle at 85% 15%, #ffedd5 0%, transparent 38%),
    var(--bg-0);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Noto Sans SC", "Be Vietnam Pro", sans-serif;
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(50px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #14b8a6;
  top: -80px;
  right: -60px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: #fb923c;
  bottom: -90px;
  left: -40px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.hero {
  background: linear-gradient(120deg, #0f766e 0%, #155e75 60%, #0b4f46 100%);
  border-radius: 22px;
  padding: 22px 24px;
  color: #effffb;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.hero p {
  margin: 8px 0 0;
  color: #d7fff3;
}

.toolbar {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 10px;
  align-items: center;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #effffb;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-label {
  font-size: 12px;
  color: #cffcf0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card.wide {
  grid-column: 1 / -1;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

h3 {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--ink-soft);
}

textarea,
input,
select,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

button {
  cursor: pointer;
  background: linear-gradient(120deg, var(--brand) 0%, #0f9d8f 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22);
}

.inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline label input {
  width: auto;
}

.meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 10px;
}

.upload-status {
  display: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.upload-status.show {
  display: block;
}

.upload-status.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--ok);
}

.upload-status.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: var(--error);
}

.doc-row {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.doc-row input {
  margin-bottom: 8px;
}

.uploaded-doc {
  background: #fcfffe;
  border-style: solid;
}

.uploaded-doc textarea[readonly],
.uploaded-doc input[readonly] {
  background: #f8fafc;
  color: var(--ink);
}

.danger-button {
  width: auto;
  background: linear-gradient(120deg, #b91c1c 0%, #dc2626 100%);
}

.secondary-button {
  width: auto;
  background: #e5e7eb;
  color: var(--ink);
}

.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.doc-select {
  width: auto;
  margin-right: 8px;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.confirm-modal.hidden {
  display: none;
}

.confirm-card {
  width: min(100%, 460px);
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.confirm-card p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 140px;
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
  background: #fcfffe;
}

.chat-item {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
}

.chat-item.user {
  background: #ecfdf5;
}

.chat-item.assistant {
  background: #fff7ed;
}

.list {
  margin-top: 12px;
  font-size: 14px;
}

.case-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fcfffe;
}

.case-item button {
  margin-top: 8px;
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.issue {
  border-left: 4px solid var(--line);
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.issue.error {
  border-left-color: var(--error);
}

.issue.warning {
  border-left-color: var(--warn);
}

.issue.info {
  border-left-color: var(--ok);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

th {
  background: #f0fdfa;
  font-weight: 600;
}

.muted {
  color: #6b7280;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--ink);
  font-size: 13px;
  border: 1px solid #cceee4;
}

.detail-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fcfffe;
  min-height: 220px;
}

.code-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .ops-grid,
  .split {
    grid-template-columns: 1fr;
  }
}
