:root {
  --bg: #151413;
  --panel: rgba(255, 255, 255, 0.1);
  --panel-strong: rgba(255, 255, 255, 0.15);
  --line: rgba(255, 255, 255, 0.16);
  --text: #fff8ef;
  --muted: rgba(255, 248, 239, 0.78);
  --tomato: #e34d36;
  --olive: #9bb86f;
  --steel: #8ca7b7;
  --fire: #f0a34a;
  --wine: #7f2d2d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --soft-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html,
body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(140, 167, 183, 0.2), transparent 34%),
    linear-gradient(245deg, rgba(227, 77, 54, 0.14), transparent 38%),
    linear-gradient(180deg, #191513, #0f0d0c);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
}

button,
input,
select,
textarea { font: inherit; }
button { cursor: pointer; }
h1,
h2,
p { margin: 0; }
a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.login-view {
  min-height: calc(100vh - 28px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(470px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(22, 19, 17, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-logo {
  display: block;
  width: min(214px, 50vw);
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.brand-context {
  color: rgba(255, 248, 239, 0.74);
  font-size: 13px;
  font-weight: 900;
}

.login-copy,
.section-head,
.hero-copy {
  display: grid;
  gap: 8px;
}

.login-copy h1 {
  font-size: clamp(38px, 8vw, 62px);
  line-height: 1.04;
}

.login-copy p,
.auth-message,
.hero-copy p:last-child,
.ticket-card p,
.column-title span,
.metric-strip span {
  color: var(--muted);
}

.auth-message.error { color: #ffd0c2; }

.app-view {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.topbar {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(24, 20, 17, 0.78);
  backdrop-filter: blur(24px);
}

.station-pill,
.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.station-pill {
  justify-self: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--olive);
  box-shadow: 0 0 0 5px rgba(155, 184, 111, 0.18);
}

.top-actions {
  justify-self: end;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--steel);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(140, 167, 183, 0.72);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(140, 167, 183, 0.14);
}

select option {
  color: #151413;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 900;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, rgba(227, 77, 54, 0.94), rgba(240, 163, 74, 0.92));
  box-shadow: 0 16px 36px rgba(227, 77, 54, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.developer-hero {
  min-height: 168px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: end;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.065)),
    rgba(24, 20, 17, 0.92);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px);
}

.developer-hero h1 {
  font-size: clamp(54px, 7vw, 96px);
  line-height: 1.02;
}

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

.metric-strip article {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.13);
}

.metric-strip strong {
  font-size: 36px;
  line-height: 1.1;
}

.developer-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 12px;
}

.ticket-composer,
.ticket-board-panel {
  min-height: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(24, 20, 17, 0.92);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px);
}

.ticket-composer {
  align-content: start;
}

#ticketForm {
  display: grid;
  gap: 14px;
}

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

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.board-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.board-head h2,
.section-head h2 {
  font-size: 26px;
  line-height: 1.12;
}

.ticket-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.ticket-filter-bar label {
  gap: 6px;
}

.ticket-filter-bar select {
  min-height: 42px;
  border-radius: 999px;
}

.ceo-summary-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(280px, 1fr) minmax(320px, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.ceo-summary-panel h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.ceo-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ceo-summary-stats article {
  min-height: 76px;
  display: grid;
  align-content: space-between;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.ceo-summary-stats span,
.ceo-recent-row span,
.ceo-recent-row em,
.activity-row span,
.activity-row em,
.ticket-comment span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.ceo-summary-stats strong {
  font-size: 28px;
  line-height: 1;
}

.ceo-summary-recent {
  display: grid;
  gap: 8px;
}

.ceo-recent-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
}

.ceo-recent-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-view.ceo-mode .developer-shell {
  grid-template-columns: 1fr;
}

.app-view.ceo-mode .ticket-composer {
  display: none;
}

.ticket-board {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-bottom: 4px;
}

.ticket-board.dragging-board {
  cursor: grabbing;
}

.ticket-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 3px;
  border-radius: 16px;
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.ticket-column.drag-over {
  background: rgba(155, 184, 111, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(155, 184, 111, 0.38),
    0 18px 36px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

.column-title {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  transition:
    border-color 180ms ease,
    background 180ms ease;
}

.ticket-column.drag-over .column-title {
  border-color: rgba(155, 184, 111, 0.48);
  background: rgba(155, 184, 111, 0.13);
}

.column-title strong,
.column-title span {
  font-size: 13px;
  font-weight: 900;
}

.ticket-stack {
  min-height: 120px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
  border-radius: 14px;
}

.ticket-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.13);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.ticket-card.draggable {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.ticket-card.draggable :where(button, input, select, textarea) {
  touch-action: auto;
  user-select: auto;
  -webkit-user-select: auto;
}

.ticket-card.draggable * {
  -webkit-user-drag: none;
}

.ticket-drag-handle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  grid-template-columns: repeat(3, 3px);
  align-content: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: rgba(255, 248, 239, 0.72);
  background: rgba(255, 255, 255, 0.07);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.ticket-drag-handle span {
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
}

.ticket-drag-handle:hover,
.ticket-drag-handle:focus-visible {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(155, 184, 111, 0.48);
  color: #fff8ef;
  background: rgba(155, 184, 111, 0.16);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
  outline: none;
}

.ticket-drag-handle:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.ticket-drag-handle.locked {
  cursor: not-allowed;
  opacity: 0.54;
  color: rgba(255, 248, 239, 0.44);
  background: rgba(255, 255, 255, 0.04);
}

.ticket-drag-handle.locked:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 248, 239, 0.44);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.ticket-card .ticket-meta {
  padding-right: 38px;
}

.ticket-card:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.22);
}

.ticket-card.dragging {
  opacity: 0.48;
  transform: rotate(1deg) scale(0.98);
  border-color: rgba(155, 184, 111, 0.62);
  background: rgba(155, 184, 111, 0.12);
  box-shadow: none;
}

body.ticket-drag-active,
body.ticket-drag-active * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.ticket-drag-ghost {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.94;
  border-color: rgba(155, 184, 111, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07)),
    rgba(34, 31, 28, 0.96);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(155, 184, 111, 0.18);
  will-change: transform;
}

.ticket-drag-ghost .ticket-status-select {
  pointer-events: none;
}

.ticket-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
}

.ticket-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.38;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.ticket-detail-button {
  justify-self: start;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: rgba(255, 248, 239, 0.88);
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  font-weight: 900;
}

.priority-urgent,
.priority-high {
  color: #fff2eb;
  background: rgba(227, 77, 54, 0.24);
}

.priority-medium {
  background: rgba(240, 163, 74, 0.18);
}

.status-done {
  background: rgba(155, 184, 111, 0.18);
}

.ticket-status-select {
  min-height: 42px;
  border-radius: 12px;
}

.empty-column {
  min-height: 104px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.developer-notification {
  position: fixed;
  z-index: 50;
  top: 14px;
  left: 50%;
  width: min(560px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  color: var(--text);
  background: rgba(27, 25, 23, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(28px);
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: transform 240ms ease, opacity 240ms ease;
}

.developer-notification.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.developer-notification div {
  display: grid;
  gap: 3px;
}

.developer-notification span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.developer-notification button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #151413;
  background: rgba(255, 248, 239, 0.92);
  font-weight: 900;
}

.ticket-detail-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 7, 6, 0.7);
  backdrop-filter: blur(18px);
}

.ticket-detail-card {
  width: min(1180px, 100%);
  max-height: min(900px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(22, 19, 17, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ticket-detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.ticket-detail-head h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
}

.ticket-detail-body,
.ticket-detail-copy,
.ticket-comment-form {
  display: grid;
  gap: 10px;
}

.ticket-detail-body p {
  color: var(--muted);
  line-height: 1.45;
}

.ticket-detail-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 14px;
  overflow: hidden;
}

.ticket-detail-grid > article {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ticket-comments,
.ticket-activity {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.ticket-comment,
.activity-row {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.ticket-comment div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-comment p {
  color: rgba(255, 248, 239, 0.84);
  font-size: 13px;
  line-height: 1.42;
}

.attachment-link {
  justify-self: start;
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #151413;
  background: rgba(255, 248, 239, 0.9);
  font-size: 12px;
  font-weight: 900;
}

.activity-row {
  grid-template-columns: 92px minmax(0, 1fr) minmax(90px, auto);
  align-items: center;
}

.activity-row strong {
  font-size: 13px;
  line-height: 1.32;
}

body.modal-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(24, 20, 17, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

@media (min-width: 1280px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .app-view {
    height: calc(100vh - 28px);
    min-height: 0;
  }

  .developer-hero {
    min-height: 146px;
    padding: 18px;
  }

  .developer-hero h1 {
    font-size: clamp(52px, 5vw, 76px);
    line-height: 1.02;
  }

  .metric-strip article {
    min-height: 88px;
  }

  .metric-strip strong {
    font-size: 30px;
    line-height: 1.1;
  }
}

@media (max-width: 1180px) {
  .developer-hero,
  .developer-shell {
    grid-template-columns: 1fr;
  }

  .ticket-board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    max-height: none;
  }

  .ceo-summary-panel,
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell { padding: 10px; }
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .station-pill,
  .top-actions {
    justify-self: stretch;
    justify-content: space-between;
  }
  .developer-hero {
    align-items: start;
  }
  .developer-hero h1 {
    font-size: 48px;
  }
  .metric-strip,
  .form-row,
  .ticket-filter-bar,
  .ceo-summary-stats,
  .ticket-board {
    grid-template-columns: 1fr;
  }

  .ceo-recent-row,
  .activity-row {
    grid-template-columns: 1fr;
  }
}
