:root {
  --teal: #0f766e;
  --teal-bright: #14b8a6;
  --amber: #f59e0b;
  --ink: #0f172a;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --danger: #b91c1c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--amber), var(--teal-bright));
  color: var(--ink);
  font-size: 15px;
}
.nav { display: flex; gap: 16px; flex: 1; }
.nav a { color: #cbd5e1; font-weight: 600; font-size: 14px; }
.nav a:hover { color: #fff; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.role-pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #e2e8f0;
}
.inline { display: inline; margin: 0; }
.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 11px;
  border-radius: 8px;
}
.ghost:hover { background: rgba(255, 255, 255, 0.08); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.muted { color: var(--muted); }

.primary {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 9px 15px;
  border-radius: 9px;
  font-weight: 700;
}
.primary:hover { background: #0b5f59; text-decoration: none; }
.button { display: inline-block; }
.ghost-dark {
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 9px;
}
.ghost-link { color: var(--muted); align-self: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.card-head h2 { margin: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat strong { display: block; font-size: 26px; margin-top: 2px; }
.stat.warn strong { color: var(--amber); }
.stat.danger strong { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table tbody tr:hover { background: #f8fafc; }
.table.compact td, .table.compact th { padding: 7px 6px; }
.task-link { font-weight: 700; color: var(--ink); }
.task-link:hover { color: var(--teal); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-new { background: #dbeafe; color: #1e40af; }
.status-triaged { background: #ede9fe; color: #5b21b6; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-waiting { background: #e5e7eb; color: #374151; }
.status-review { background: #cffafe; color: #155e75; }
.status-resolved { background: #dcfce7; color: #166534; }
.status-closed { background: #0f172a; color: #fff; }
.status-cancelled, .status-rejected { background: #fee2e2; color: #991b1b; }
.priority-low { background: #f1f5f9; color: #475569; }
.priority-normal { background: #e0f2fe; color: #075985; }
.priority-high { background: #ffedd5; color: #9a3412; }
.priority-critical { background: #fee2e2; color: #991b1b; }
.badge.urgent { background: #f59e0b; color: #111827; }
.badge.source { background: #ecfdf5; color: #047857; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filters input[type="search"] { flex: 1 1 240px; }
.filters select { flex: 0 1 180px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.checkbox input { width: auto; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(20, 184, 166, 0.35);
  border-color: var(--teal-bright);
}
textarea { resize: vertical; }

.stack { display: flex; flex-direction: column; gap: 13px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.form-card { max-width: 760px; }

.auth-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}
.auth-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--amber), var(--teal-bright));
  font-size: 20px;
  margin-bottom: 14px;
}

.breadcrumbs { margin-bottom: 12px; }
.task-head { margin-bottom: 18px; }
.task-head-main { display: flex; flex-direction: column; gap: 6px; }
.task-head h1 { font-size: 26px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
}
.description { white-space: pre-wrap; }
.section-title { margin-top: 20px; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.status-btn {
  border: none;
  padding: 8px 12px;
  border-radius: 9px;
  font-weight: 700;
}
.status-btn:hover { filter: brightness(0.96); }

.comments { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comments li { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.comments p { margin: 6px 0 0; white-space: pre-wrap; }
.comment-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }

.meta-list { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed #eef2f7; padding-bottom: 8px; }
.meta-list dt { color: var(--muted); font-size: 12px; }
.meta-list dd { margin: 0; text-align: right; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 10px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-bright); margin-top: 6px; flex: 0 0 auto; }
.timeline-body { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.timeline-body pre {
  margin: 4px 0 0;
  padding: 8px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 11px;
  white-space: pre-wrap;
}

.empty { color: var(--muted); padding: 26px; text-align: center; }
.alert { padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; }
.alert.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.error-card { text-align: center; padding: 40px; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav { display: none; }
}
