:root {
  --bg: #f5efe2;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffaf1;
  --ink: #1d2433;
  --muted: #5c6470;
  --line: rgba(29, 36, 51, 0.12);
  --accent: #007c78;
  --accent-soft: rgba(0, 124, 120, 0.12);
  --warm: #d6653f;
  --warm-soft: rgba(214, 101, 63, 0.12);
  --success: #1a7f47;
  --danger: #a3392f;
  --shadow: 0 24px 60px rgba(40, 46, 64, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(0, 124, 120, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(214, 101, 63, 0.14), transparent 32%),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

p {
  margin: 0;
}

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

.auth-shell {
  padding-top: 72px;
}

.auth-shell h1 {
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.auth-stack {
  display: grid;
  gap: 18px;
}

.auth-copy {
  max-width: 36rem;
}

.auth-divider {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-error {
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--danger);
  background: rgba(163, 57, 47, 0.1);
}

.section-head,
.ticket-keyline,
.metric-row,
.ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-hero-header,
.ticket-hero-keyline,
.ticket-hero-controls,
.ticket-list-meta {
  gap: 12px;
}

.ticket-hero-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 16px;
}

.ticket-hero-keyline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.ticket-hero-controls {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ticket-list-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ticket-panel-actions {
  display: flex;
  align-self: flex-start;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--warm);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
  line-height: 1.6;
}

.panel,
.flash,
.user-card,
.ticket-row {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.flash {
  margin-bottom: 20px;
  padding: 16px 18px;
}

.flash.success {
  background: rgba(26, 127, 71, 0.09);
  border-color: rgba(26, 127, 71, 0.22);
}

.flash.error {
  background: rgba(163, 57, 47, 0.09);
  border-color: rgba(163, 57, 47, 0.22);
}

.layout,
.card-grid,
.left-column,
.right-column {
  display: grid;
  gap: 20px;
}

.ticket-page-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layout {
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  align-items: start;
}

.ticket-scope-panel {
  max-height: 75vh;
  overflow-y: auto;
}

.panel,
.auth-panel {
  padding: 22px;
}

.viewer-meta {
  display: grid;
  gap: 6px;
}

.viewer-switch,
.ticket-action-button,
.admin-command button,
.google-auth-button,
.jql-actions button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: white;
  background: var(--ink);
}

.google-auth-button {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  min-width: min(100%, 260px);
  padding: 14px 22px;
  font-weight: 700;
  text-decoration: none;
}

.viewer-switch {
  width: fit-content;
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.ticket-action-button {
  min-width: 82px;
}

.ticket-nav-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.ticket-nav-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.pill,
.status-badge,
.ticket-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ticket-label {
  background: rgba(29, 36, 51, 0.06);
  color: var(--muted);
}

.pill.admin {
  background: var(--warm-soft);
  color: var(--warm);
}

.pill.participant {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-open {
  background: rgba(0, 124, 120, 0.12);
  color: var(--accent);
}

.status-voted,
.status-revealed {
  background: rgba(143, 107, 46, 0.14);
  color: #8f6b2e;
}

.status-stored,
.status-closed {
  background: rgba(26, 127, 71, 0.12);
  color: var(--success);
}

.ticket-hero {
  display: grid;
  gap: 18px;
  padding: 4px 0 22px;
}

.ticket-hero h3 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.ticket-jira-link {
  text-decoration: none;
}

.ticket-jira-link:hover {
  text-decoration: underline;
}

.ticket-title {
  margin: 0;
  grid-column: 1 / -1;
  width: 100%;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.6vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.ticket-description {
  margin-top: 18px;
  max-width: 65ch;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

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

.vote-chip,
.estimate-option,
.user-card,
.ticket-row {
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.vote-chip,
.estimate-option {
  border-radius: 18px;
  padding: 18px 0;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}

.vote-chip.selected,
.estimate-option.selected {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--accent), #00a39d);
}

.estimate-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 36, 51, 0.36);
}

.estimate-dialog {
  width: min(560px, 100%);
}

.estimate-option-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.dialog-close-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
}

.user-card,
.ticket-row {
  width: 100%;
  text-align: left;
}

.user-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 28px;
}

.ticket-list,
.results-stack,
.result-list {
  display: grid;
  gap: 14px;
}

.ticket-row {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.ticket-row.current {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(0, 124, 120, 0.08), rgba(255, 250, 241, 0.96));
}

.ticket-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ticket-meta {
  min-width: 110px;
  flex-direction: column;
  align-items: end;
  color: var(--muted);
  font-size: 0.92rem;
}

.jql-form {
  display: grid;
  gap: 12px;
}

.jql-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-command-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.admin-command {
  display: grid;
  gap: 6px;
}

.command-help {
  color: var(--muted);
  line-height: 1.5;
}

.jql-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.admin-command button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.metric-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-breakdown {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.pie-chart {
  width: min(180px, 44vw);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.44), var(--shadow);
}

.result-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.result-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.result-voters {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.busy-indicator {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 12px 16px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
}

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

@media (max-width: 680px) {
  .shell,
  .auth-shell {
    width: min(100vw - 20px, 1200px);
    padding-top: 18px;
  }

  .panel,
  .flash {
    border-radius: 18px;
    padding: 18px;
  }

  .ticket-row,
  .ticket-meta,
  .ticket-panel-actions {
    align-items: start;
    flex-direction: column;
  }

  .ticket-hero-header {
    grid-template-columns: 1fr;
  }

  .ticket-hero-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .ticket-panel-actions {
    justify-content: flex-start;
  }

  .result-breakdown,
  .result-row {
    grid-template-columns: 1fr;
  }

  .result-voters {
    text-align: left;
  }
}
