:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --surface: #ffffff;
  --page: #f6f8fb;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary,
.actions button {
  background: white;
  color: var(--accent-strong);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 72%);
  outline-offset: 2px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

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

p {
  color: var(--muted);
  margin-top: 6px;
}

.ticket-form {
  display: flex;
  align-items: end;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 16px;
}

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

.reply-panel {
  grid-row: span 3;
  min-height: 660px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.reply {
  min-height: 320px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  padding: 16px;
  line-height: 1.55;
}

.regenerate-form {
  display: grid;
  gap: 10px;
}

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 12px;
  margin: 14px 0 0;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

ul {
  margin: 14px 0 0;
  padding-left: 20px;
}

li {
  margin: 8px 0;
}

#status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  box-shadow: 0 16px 40px rgb(16 24 40 / 14%);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

#status.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .toolbar,
  .ticket-form,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .review-layout {
    grid-template-columns: 1fr;
  }

  .reply-panel {
    grid-row: auto;
    min-height: auto;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
