:root {
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #d5dde6;
  --bg: #e7edf2;
  --surface: #fff;
  --accent: #0b6e99;
  --accent-ink: #fff;
  --danger: #8f2d2d;
  --danger-bg: #fdecec;
  --ok: #1f7a4d;
  --ok-bg: #e7f6ee;
  --internal: #fff6e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", "Helvetica Neue", sans-serif;
}

a { color: var(--accent); }

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.header__copy,
.header__tools {
  min-width: 0;
}

.header__copy { flex: 1 1 240px; }

.header__tools {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.lede,
.help,
.meta,
.account {
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

h1, h2, p { overflow-wrap: anywhere; }

h1 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
}

h2 {
  margin: 20px 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.banner {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--ok-bg);
  color: var(--ok);
}

.banner--error {
  background: var(--danger-bg);
  color: var(--danger);
}

.field { margin: 0 0 16px; min-width: 0; }

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #b7c3ce;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.button--note {
  background: #fff;
  color: #8a5a12;
  border-color: #c4a46a;
}

.code {
  display: block;
  margin: 8px 0 0;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #f4f7f9;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.setup-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.setup-list li { margin: 8px 0; }

.comment {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.comment:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.comment--internal {
  margin: 8px 0;
  padding: 12px;
  border-top: 0;
  border-radius: 8px;
  background: var(--internal);
}

.comment__who {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  margin: 0 0 8px;
}

.comment__who strong { font-weight: 600; }

.kind {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.comment--internal .kind { color: #8a5a12; }

.comment__body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.files {
  margin: 8px 0 0;
  padding-left: 18px;
}

.files a { overflow-wrap: anywhere; }

.ticket-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-top: 8px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.search__row input {
  flex: 1 1 180px;
  min-width: 0;
}

.recent {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-width: 0;
}

.recent__tab {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 2px;
  max-width: 200px;
  min-width: 88px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.recent__tab.is-current {
  border-color: var(--accent);
  background: #e7f3f8;
}

.recent__id {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.recent__subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 176px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.section-head h2 { margin: 0; }

.button.is-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.results { min-width: 0; }

.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.result:first-child { border-top: 0; padding-top: 0; }

.result__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.result__subject {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result__status {
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .header__tools { align-items: stretch; }
  .header__tools form,
  .header__tools .button { width: 100%; }
  .form-actions { justify-content: stretch; }
  .form-actions .button { flex: 1 1 160px; }
  .search__row .button { flex: 1 1 100%; }
  .result { grid-template-columns: minmax(0, 1fr); }
  .result__status { white-space: normal; }
}
