:root {
  color-scheme: light;
  --bg: #f3efe7;
  --ink: #181713;
  --muted: #655d4f;
  --line: rgba(31, 27, 21, 0.08);
  --panel: rgba(255, 250, 242, 0.82);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --accent: #0e5d5c;
  --accent-bright: #f06b3f;
  --accent-soft: #d6efec;
  --sun: #ffd4a4;
  --danger: #8b2f2f;
  --success: #26614a;
  --warning: #8f5c10;
  --shadow: 0 22px 70px rgba(52, 35, 18, 0.11);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 218, 168, 0.9), transparent 24%),
    radial-gradient(circle at 90% 0%, rgba(169, 225, 215, 0.82), transparent 22%),
    linear-gradient(180deg, #fcfaf6 0%, var(--bg) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='.03'%3E%3Ccircle cx='14' cy='14' r='1'/%3E%3Ccircle cx='70' cy='52' r='1'/%3E%3Ccircle cx='112' cy='12' r='1'/%3E%3Ccircle cx='38' cy='102' r='1'/%3E%3Ccircle cx='118' cy='90' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  line-height: 0.95;
  max-width: 10ch;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1.05rem;
}

.lede,
.panel-copy,
.panel-note,
.identity-meta {
  color: var(--muted);
  line-height: 1.6;
}

.identity-card,
.panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.identity-card {
  min-width: min(360px, 100%);
  padding: 18px 20px;
}

.identity-name {
  margin-top: 12px;
  font-weight: 800;
  font-size: 1.05rem;
}

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

.stat-card {
  padding: 20px;
}

.stat-card p,
.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.accent {
  background:
    linear-gradient(140deg, rgba(14, 93, 92, 0.96), rgba(18, 44, 60, 0.94)),
    var(--panel-strong);
  color: #f7f6f1;
}

.accent p,
.accent span {
  color: rgba(247, 246, 241, 0.8);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1.45fr) 420px;
  gap: 18px;
}

.left-rail,
.main-column,
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-head,
.toolbar,
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.mini-badge,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
}

.mini-badge {
  min-height: 28px;
  padding: 4px 10px;
  background: rgba(14, 93, 92, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
}

.subtle {
  background: rgba(23, 23, 23, 0.06);
  color: var(--muted);
}

.badge {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.84rem;
}

.muted {
  background: rgba(24, 23, 19, 0.08);
  color: var(--muted);
}

.success {
  background: rgba(38, 97, 74, 0.12);
  color: var(--success);
}

.warning {
  background: rgba(143, 92, 16, 0.12);
  color: var(--warning);
}

.danger {
  background: rgba(139, 47, 47, 0.12);
  color: var(--danger);
}

.stack-form,
.detail-stack,
.comment-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(31, 27, 21, 0.12);
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

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

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

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.primary {
  background: var(--accent-bright);
  color: #fff9f4;
}

.secondary {
  background: var(--accent);
  color: #f8fbfa;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(31, 27, 21, 0.1);
}

.wide {
  width: 100%;
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.search {
  min-width: 250px;
}

.ticket-list,
.comment-list,
.user-roster {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-card,
.comment-card,
.user-card {
  border: 1px solid rgba(31, 27, 21, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.ticket-card {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.ticket-card:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 93, 92, 0.22);
}

.ticket-card.active {
  background: rgba(214, 239, 236, 0.8);
  border-color: rgba(14, 93, 92, 0.36);
}

.ticket-top,
.ticket-bottom,
.user-top,
.comment-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.ticket-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ticket-snippet,
.detail-description,
.comment-body {
  color: var(--muted);
  line-height: 1.55;
}

.ticket-meta,
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-kicker {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.meta-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.meta-list div {
  display: grid;
  gap: 3px;
}

.meta-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-list dd {
  margin: 0;
  font-weight: 700;
}

.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.empty-state {
  color: var(--muted);
  line-height: 1.7;
  padding: 20px 0 8px;
}

.hidden {
  display: none;
}

.user-role {
  font-size: 0.86rem;
  color: var(--muted);
}

.user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.footer-note {
  min-height: 30px;
  padding: 12px 4px 0;
}

#feedback {
  color: var(--muted);
}

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

  .right-rail {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: flex-start;
  }

  .detail-panel,
  #admin-panel {
    flex: 1;
  }
}

@media (max-width: 920px) {
  .topbar,
  .toolbar,
  .panel-head,
  .ticket-top,
  .ticket-bottom,
  .comment-top,
  .user-top {
    flex-direction: column;
  }

  .stats-grid,
  .workspace,
  .split,
  .compact,
  .user-actions,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .search,
  .identity-card {
    min-width: 0;
  }
}
