:root {
  --asphalt: #120f0d;
  --cabin: #1a1612;
  --panel: #221c17;
  --panel-2: #2a231c;
  --foam: #f3eadc;
  --foam-dim: #cbbba5;
  --mute: #9a8b7a;
  --line: rgba(243, 234, 220, 0.1);
  --line-2: rgba(243, 234, 220, 0.16);
  --copper: #d4894a;
  --copper-2: #e09a5c;
  --headlight: #f0c35a;
  --espresso: #6b4228;
  --sage: #7faf8e;
  --sage-bg: rgba(127, 175, 142, 0.16);
  --new-bg: rgba(212, 137, 74, 0.16);
  --work-bg: rgba(240, 195, 90, 0.14);
  --danger: #e07060;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "Bricolage Grotesque", "Arial Narrow", "Segoe UI", sans-serif;
  --sidebar: 96px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--foam);
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(212, 137, 74, 0.18), transparent 55%),
    radial-gradient(700px 420px at 100% 10%, rgba(240, 195, 90, 0.08), transparent 45%),
    linear-gradient(180deg, #19140f 0%, var(--asphalt) 48%, #0c0a08 100%);
  background-attachment: fixed;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--copper-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--headlight);
  outline-offset: 2px;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth::before {
  content: "";
  position: absolute;
  inset: auto -10% -20% 40%;
  height: 55%;
  background:
    linear-gradient(110deg, transparent 0 18%, rgba(240, 195, 90, 0.08) 18% 22%, transparent 22% 40%, rgba(212, 137, 74, 0.1) 40% 44%, transparent 44%),
    radial-gradient(circle at 30% 40%, rgba(212, 137, 74, 0.2), transparent 50%);
  transform: rotate(-8deg);
  pointer-events: none;
}
.auth-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(42, 35, 28, 0.96), rgba(26, 22, 18, 0.98));
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: linear-gradient(180deg, var(--headlight), var(--copper), var(--espresso));
}
.brand-kicker {
  margin: 0 0 10px;
  color: var(--copper);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-card h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 2.6rem);
  letter-spacing: -0.05em;
  line-height: 0.95;
  font-weight: 800;
}
.lede { margin: 0 0 18px; color: var(--foam-dim); max-width: 32ch; }
.stack { display: grid; gap: 12px; }
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--mute);
}
.field, input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: rgba(12, 10, 8, 0.55);
  padding: 12px 12px;
  color: var(--foam);
}
input::placeholder, textarea::placeholder { color: rgba(203, 187, 165, 0.45); }
textarea { min-height: 96px; resize: vertical; }
select option { background: #221c17; color: var(--foam); }
.error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(224, 112, 96, 0.14);
  border: 1px solid rgba(224, 112, 96, 0.35);
  color: #f0b0a6;
  font-weight: 650;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--copper-2), var(--copper));
  color: #1a120c;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(212, 137, 74, 0.22);
}
.btn:hover { filter: brightness(1.05); }
.btn-soft {
  background: rgba(212, 137, 74, 0.14);
  color: var(--headlight);
  border: 1px solid rgba(212, 137, 74, 0.35);
  box-shadow: none;
}
.btn-soft:hover { background: rgba(212, 137, 74, 0.22); }
.btn-ghost {
  background: transparent;
  color: var(--foam-dim);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--foam); border-color: var(--mute); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-ok {
  background: linear-gradient(180deg, #93c4a4, var(--sage));
  color: #0f1c14;
  box-shadow: none;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(42, 35, 28, 0.92), rgba(18, 15, 13, 0.96));
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.sidebar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  background: repeating-linear-gradient(
    180deg,
    var(--headlight) 0 14px,
    transparent 14px 22px
  );
  opacity: 0.85;
}
.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 25%, rgba(240, 195, 90, 0.45), transparent 40%),
    linear-gradient(145deg, #3a2618, #1a120c);
  border: 1px solid rgba(240, 195, 90, 0.28);
  color: var(--headlight);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.06em;
  font-size: 15px;
  position: relative;
  z-index: 1;
}
.logo-mark small {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 3px var(--cabin);
}
.nav-item {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 14px;
  color: var(--mute);
  font-size: 12px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.nav-item.active {
  background: rgba(212, 137, 74, 0.14);
  color: var(--headlight);
  box-shadow: inset 0 0 0 1px rgba(212, 137, 74, 0.28);
}
.nav-item svg { width: 22px; height: 22px; }

.main {
  min-width: 0;
  padding: 10px 22px 28px;
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding-bottom: 8px;
}
.topbar-copy { min-width: 0; }
.topbar .brand-kicker { margin-bottom: 4px; }
.topbar h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.05em;
  font-weight: 800;
  line-height: 0.95;
}
.topbar h1 em {
  font-style: normal;
  color: var(--copper);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(212, 137, 74, 0.12);
  color: var(--headlight);
  font-weight: 800;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--foam-dim);
  font-size: 13px;
  font-weight: 650;
}

.panel {
  background:
    linear-gradient(180deg, rgba(42, 35, 28, 0.92), rgba(26, 22, 18, 0.96));
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.panel-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(212, 137, 74, 0.08), transparent 36%);
}
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--foam-dim);
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.18);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toolbar .grow { flex: 1 1 260px; min-width: 200px; }
.search { position: relative; }
.search .ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mute);
  pointer-events: none;
}
.search input {
  height: 42px;
  padding-left: 34px;
}
.select-sm { height: 42px; max-width: 210px; }

.table-wrap { overflow-x: auto; }
table.tasks {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
table.tasks th {
  text-align: left;
  font-size: 11px;
  font-weight: 750;
  color: var(--mute);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.16);
  letter-spacing: 0.02em;
}
table.tasks td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}
table.tasks tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}
table.tasks tbody tr:hover td {
  background: rgba(212, 137, 74, 0.06);
}
table.tasks tbody tr.is-open td {
  background: rgba(212, 137, 74, 0.1);
}
table.tasks tbody tr.p-high td:first-child {
  box-shadow: inset 3px 0 0 var(--headlight);
}
.mono {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--foam);
}
.created { display: grid; gap: 2px; }
.created .age {
  font-size: 12px;
  color: var(--mute);
  font-weight: 650;
}
.created .age.hot { color: var(--danger); }
.info-title {
  margin: 0;
  font-weight: 750;
  max-width: 42ch;
  letter-spacing: -0.01em;
}
.info-sub {
  margin: 4px 0 0;
  color: var(--mute);
  font-size: 12px;
  max-width: 48ch;
}
.type-cell {
  font-weight: 700;
  white-space: nowrap;
  color: var(--foam-dim);
}
.assignee { color: var(--foam-dim); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.open {
  background: var(--new-bg);
  color: var(--copper-2);
  border-color: rgba(212, 137, 74, 0.28);
}
.badge.in_progress {
  background: var(--work-bg);
  color: var(--headlight);
  border-color: rgba(240, 195, 90, 0.28);
}
.badge.done {
  background: var(--sage-bg);
  color: #b6dfc4;
  border-color: rgba(127, 175, 142, 0.28);
}
.badge.cancelled {
  background: rgba(255, 255, 255, 0.04);
  color: var(--mute);
}

.row-link {
  color: rgba(203, 187, 165, 0.45);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}
.row-link:hover { color: var(--headlight); }

.panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 650;
  background: rgba(0, 0, 0, 0.18);
}
.foot-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--foam-dim);
}

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--mute);
}
.empty strong {
  display: block;
  color: var(--foam);
  font-size: 20px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 5, 0.62);
  display: none;
  justify-content: flex-end;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(460px, 100%);
  height: 100%;
  background:
    linear-gradient(180deg, #2a231c, #1a1612);
  border-left: 1px solid var(--line-2);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  animation: slide-in 0.18s ease;
}
@keyframes slide-in {
  from { transform: translateX(18px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.modal-body {
  padding: 18px;
  overflow: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-block { display: grid; gap: 14px; margin-bottom: 18px; }
.detail-block .label {
  color: var(--mute);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 4px;
}
.detail-block .value { font-weight: 750; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar::after { display: none; }
  .nav-item { width: auto; padding: 8px 10px; }
  .main { padding: 0 12px 18px; }
  .topbar { align-items: flex-start; min-height: auto; padding-top: 14px; }
  .user-chip span { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
