:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #5b6472;
  --line: #d7dce3;
  --accent: #6d28d9;
  --accent-fg: #ffffff;
  --danger: #b91c1c;
  --warning: #92400e;
  --success: #166534;
  --info: #1e40af;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --fg: #f3f4f6;
    --muted: #a8b0bd;
    --line: #374151;
    --accent: #a78bfa;
    --accent-fg: #111827;
    --danger: #fca5a5;
    --warning: #fcd34d;
    --success: #86efac;
    --info: #93c5fd;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.notice {
  border-radius: 6px;
  border: 1px solid currentColor;
  padding: 8px 10px;
  margin: 0 0 12px;
  font-size: 13px;
}

.notice.info {
  color: var(--info);
}

.notice.success {
  color: var(--success);
}

.notice.warning {
  color: var(--warning);
}

.notice.error {
  color: var(--danger);
}

.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.ticket-row {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.ticket-row:hover,
.ticket-row:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.ticket-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reference {
  font-variant-numeric: tabular-nums;
}

.ticket-row-title {
  font-weight: 600;
}

.ticket-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.stage,
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.badge.state-closed {
  color: var(--danger);
  border-color: currentColor;
}

.badge.state-unassigned {
  color: var(--info);
  border-color: currentColor;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-title {
  margin: 8px 0 4px;
  font-size: 15px;
}

.detail-assignee,
.detail-message {
  margin: 4px 0;
}

.detail-message {
  color: var(--muted);
}

.detail-message.state-mine {
  color: var(--success);
}

.detail-message.state-closed {
  color: var(--danger);
}

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

.button {
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 7px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.button:hover,
.button:focus-visible {
  filter: brightness(1.08);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

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

.empty p {
  margin: 4px 0 0;
}

.is-busy {
  cursor: progress;
}

/* Landing page (index.html). */
.landing {
  max-width: 760px;
  margin: 24px auto;
}

.landing h1 {
  margin-bottom: 4px;
}

.landing h2 {
  margin: 20px 0 8px;
}

.landing code {
  background: rgba(127, 127, 127, 0.18);
  border-radius: 4px;
  padding: 1px 4px;
}

.landing li {
  margin: 6px 0;
}

/* Mobile: nút lớn hơn, bố cục một cột. */
body.is-mobile {
  padding: 10px;
}

body.is-mobile .button {
  padding: 10px 14px;
}

body.is-mobile .ticket-row {
  padding: 10px;
}

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
  }

  .button {
    padding: 10px 14px;
  }
}
