:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #182238;
  --panel-2: #22304a;
  --line: #31415f;
  --text: #f8fafc;
  --muted: #9aa7bd;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
  --orange: #fb923c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 10%, #1d2b46 0, transparent 32%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-body {
  display: grid;
  place-items: center;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

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

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

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(24, 34, 56, 0.75);
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

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

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

.stat,
.toolbar,
.card,
.table-wrap,
.empty,
.modal-panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

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

.toolbar form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr) auto auto;
  gap: 12px;
  align-items: center;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #475569;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--blue) 70%, transparent);
  border-color: var(--blue);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--blue-2);
}

.button.secondary,
button.secondary {
  background: #334155;
}

.button.secondary:hover,
button.secondary:hover {
  background: #475569;
}

.button.danger,
button.danger {
  background: #dc2626;
}

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

.card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 390px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 18%);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.card h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.description {
  min-height: 44px;
  color: var(--muted);
  line-height: 1.45;
}

.badges,
.actions,
.active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-planning,
.cat-new {
  background: #dbeafe;
  color: #1e40af;
}

.status-in-progress,
.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.status-completed,
.priority-low,
.cat-live {
  background: #dcfce7;
  color: #166534;
}

.status-on-hold,
.priority-critical,
.cat-support {
  background: #fee2e2;
  color: #991b1b;
}

.priority-high {
  background: #ffedd5;
  color: #9a3412;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 14px;
  align-items: center;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #334155;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, var(--blue));
}

.circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--blue) calc(var(--progress) * 1%), #334155 0);
  position: relative;
  font-weight: 800;
  font-size: 12px;
}

.circle::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: var(--panel);
}

.circle span {
  position: relative;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.meta-grid small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.actions {
  margin-top: auto;
  padding-top: 18px;
}

.actions form {
  flex: 1;
  display: flex;
}

.actions .button,
.actions button {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  background: rgba(51, 65, 85, 0.5);
  font-size: 12px;
  text-transform: uppercase;
}

.empty,
.notice {
  padding: 28px;
  text-align: center;
}

.notice {
  margin-bottom: 16px;
  border-radius: 8px;
  transition: opacity 180ms ease, transform 180ms ease, margin 180ms ease, padding 180ms ease;
}

.notice.error {
  background: #7f1d1d;
  border: 1px solid #b91c1c;
}

.notice.success {
  background: #064e3b;
  border: 1px solid #059669;
}

.notice.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 62%);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
}

.modal-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.form-actions > * {
  flex: 1;
}

.login-page {
  width: min(100% - 28px, 460px);
  padding: 28px 0;
}

.login-panel {
  background: color-mix(in srgb, var(--panel) 94%, black);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 34px);
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.login-copy {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-help {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1050px) {
  .grid,
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-actions .button {
    flex: 1 1 150px;
  }

  .card {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .page {
    width: min(100% - 20px, 1440px);
    padding: 18px 0 34px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .stats,
  .toolbar form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topbar-actions .user-pill {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .stat {
    padding: 14px;
  }

  .stat strong {
    font-size: 25px;
  }

  .toolbar,
  .card {
    padding: 14px;
  }

  .card-head,
  .progress-row,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .card-head {
    display: grid;
  }

  .circle {
    justify-self: start;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions form {
    width: 100%;
  }

  .modal {
    align-items: start;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
  }

  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-body {
    padding: 14px;
  }
}

@media (max-width: 380px) {
  .page,
  .login-page {
    width: min(100% - 14px, 1440px);
  }

  h1 {
    font-size: 28px;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .button,
  button,
  input,
  select,
  textarea {
    min-height: 46px;
  }
}
