/*
  Production Tracker
  Author: Emiliano Sifri
  Portfolio: https://www.instagram.com/emilianosifri?igsh=MXM3OGJlcXcwN2h6OA==
*/

:root {
  --bg: #06101d;
  --panel: #0b1828;
  --card: #0e1f31;
  --card-soft: #10263b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8f0f8;
  --muted: #8096ae;
  --muted-strong: #a9bdd1;
  --accent: #38bdf8;
  --accent-deep: #0369a1;
  --danger: #ef4444;
  --danger-deep: #991b1b;
  --green: #22c55e;
  --amber: #f59e0b;
  --orange: #f97316;
  --slate: #475569;
  --violet: #8b5cf6;
  --cyan: #06b6d4;
  --yellow: #eab308;
  --radius: 20px;
  --radius-small: 14px;
  --font-head: "Outfit", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.06) 0, rgba(6, 16, 29, 0) 280px),
    var(--bg);
}

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

button,
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  color: var(--text);
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

button:active,
.file-label:active {
  transform: scale(0.98);
  opacity: 0.88;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 12px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.62);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

input[type="file"] {
  display: none;
}

.app-root {
  width: 100%;
}

.shell,
.hub {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px calc(116px + env(safe-area-inset-bottom));
}

.hub {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero {
  padding: 18px 0 14px;
}

.eyebrow,
.label,
.status-line,
.mono {
  font-family: var(--font-mono);
}

.hero h1,
.hub-title {
  margin: 0;
  color: var(--text);
  font-size: 2.35rem;
  line-height: 1.05;
  font-weight: 900;
}

.hero h1 {
  background: linear-gradient(110deg, #e8f0f8 15%, #38bdf8 88%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-title {
  margin-bottom: 8px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.panel,
.stat,
.project-card,
.wizard,
.sequence,
.chart-panel,
.progress-panel,
.settings-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel,
.wizard,
.settings-panel {
  padding: 18px;
}

.hub-copy {
  margin: 0 0 20px;
  color: var(--muted);
}

.hub-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  align-items: start;
}

.hub-grid-single {
  grid-template-columns: 1fr;
  max-width: 680px;
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field label,
.sequence-count-row label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.projects-list {
  display: grid;
  gap: 10px;
}

.project-card {
  padding: 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.project-card button {
  margin-top: 12px;
}

.project-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--project-image);
  background-position: center;
  background-size: cover;
  opacity: var(--project-image-opacity, 0.25);
  transform: scale(1.02);
}

.project-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(14, 31, 49, 0.95), rgba(14, 31, 49, 0.72));
}

.project-card-content {
  position: relative;
  z-index: 1;
}

.project-name {
  font-weight: 800;
  font-size: 1.08rem;
}

.project-meta {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

.btn-green {
  border-color: transparent;
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-danger {
  border-color: transparent;
  background: linear-gradient(135deg, #dc2626, #991b1b);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
}

.btn-add {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.32);
}

.add-row-btn {
  margin-top: 14px;
}

.btn-mini {
  min-height: 34px;
  width: auto;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-family: var(--font-mono);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 6px 0 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(6, 16, 29, 0.92);
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 40px;
  padding: 9px 7px;
  border-radius: 12px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 0.82rem;
}

.tab.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 12px;
}

.stat {
  padding: 15px;
  min-width: 0;
}

.stat .label,
.chart-panel h2,
.progress-row .label,
.section-title {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.stat .number {
  margin-top: 6px;
  font-weight: 900;
  font-size: 1.85rem;
  line-height: 1;
}

.stat .number.finished {
  color: var(--green);
}

.stat .number.wip,
.stat .number.stage {
  color: var(--amber);
}

.stat .number.cbb {
  color: var(--orange);
}

.stat .number.total {
  color: var(--accent);
}

.progress-panel,
.chart-panel {
  padding: 18px;
  margin: 12px 0;
}

.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-row .value {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 800;
}

.track,
.seq-mini-track {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.track {
  height: 12px;
}

.fill,
.seq-mini-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.3s ease;
}

.chart-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: center;
}

.chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-heading h2 {
  margin: 0;
}

.chart-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.donut {
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--slate) 0deg 360deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 40px rgba(0, 0, 0, 0.18);
}

.donut::before {
  content: "";
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--panel), #071423);
  position: absolute;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.donut-center {
  position: relative;
  text-align: center;
}

.donut-value {
  display: block;
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 1.48rem;
}

.donut-label {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

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

.insight-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.insight-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.insight-value {
  margin-top: 5px;
  color: var(--text);
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.insight-note {
  min-height: 34px;
  margin-top: 5px;
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.insight-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.insight-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.calendar-panel {
  padding: 18px;
}

.calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.calendar-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.calendar-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.calendar-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(66px, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.calendar-toggle button {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.calendar-toggle button.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.16);
}

.calendar-list {
  display: grid;
  gap: 10px;
}

.calendar-day {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.calendar-date {
  margin-bottom: 9px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-tasks {
  display: grid;
  gap: 8px;
}

.calendar-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.calendar-task-title {
  font-family: var(--font-mono);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.calendar-task-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.quick-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-nav::-webkit-scrollbar {
  display: none;
}

.quick-nav button {
  flex: 0 0 auto;
  min-height: 36px;
  width: auto;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.sequence {
  overflow: hidden;
  margin-bottom: 14px;
}

.seq-header {
  width: 100%;
  min-height: unset;
  display: block;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
}

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

.seq-name {
  font-size: 1.08rem;
  font-weight: 800;
}

.seq-sub {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.seq-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.seq-pct {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 800;
}

.arrow {
  color: var(--muted);
  transition: transform 0.18s ease;
}

.sequence.open .arrow {
  transform: rotate(180deg);
}

.seq-mini-track {
  height: 6px;
  margin-top: 14px;
}

.seq-body {
  display: none;
  padding: 12px 14px 16px;
}

.sequence.open .seq-body {
  display: block;
}

.insert-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 5px 0;
  opacity: 0.58;
}

.insert-divider .line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.insert-divider button {
  min-height: 30px;
  width: auto;
  padding: 5px 12px;
  border-style: dashed;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.07);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.item-card {
  margin: 8px 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
}

.item-card.s-finished {
  border-color: rgba(34, 197, 94, 0.44);
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.08), var(--card));
}

.item-card.s-wip,
.item-card.s-blockout,
.item-card.s-polish,
.item-card.s-surfacing,
.item-card.s-lighting {
  border-color: rgba(245, 158, 11, 0.42);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.07), var(--card));
}

.item-card.s-cbb {
  border-color: rgba(249, 115, 22, 0.45);
  background: linear-gradient(145deg, rgba(249, 115, 22, 0.07), var(--card));
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.card-meta {
  min-width: 0;
  flex: 1;
}

.item-code {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.92rem;
  word-break: break-word;
}

.item-name-input {
  margin-top: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-unstarted { color: #94a3b8; background: rgba(71, 85, 105, 0.24); }
.badge-wip { color: var(--amber); background: rgba(245, 158, 11, 0.18); }
.badge-cbb { color: var(--orange); background: rgba(249, 115, 22, 0.18); }
.badge-finished { color: var(--green); background: rgba(34, 197, 94, 0.18); }
.badge-blockout { color: var(--accent); background: rgba(56, 189, 248, 0.16); }
.badge-polish { color: #b79cff; background: rgba(139, 92, 246, 0.17); }
.badge-surfacing { color: var(--cyan); background: rgba(6, 182, 212, 0.16); }
.badge-lighting { color: var(--yellow); background: rgba(234, 179, 8, 0.17); }

.thumb-wrap {
  flex: 0 0 min(36%, 180px);
}

.thumb-area {
  width: 100%;
  min-width: 132px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  border: 1px dashed rgba(56, 189, 248, 0.32);
  border-radius: 16px;
  color: var(--muted);
  background:
    linear-gradient(145deg, rgba(56, 189, 248, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  box-shadow: inset 0 0 28px rgba(56, 189, 248, 0.04);
}

.thumb-area.has-image {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
}

.thumb-area span {
  display: grid;
  place-items: center;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
}

.thumb-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fields {
  display: grid;
  gap: 10px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.65fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.028);
}

.comment-thread {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(6, 16, 29, 0.28);
}

.comment-thread.empty-comments {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.comment {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.comment-meta strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.comment-text {
  margin-top: 5px;
  color: var(--muted-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.comment-compose textarea {
  min-height: 52px;
  max-height: 150px;
}

.comment-compose button {
  height: 46px;
}

.card-footer,
.background-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.updated {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-panel {
  margin-bottom: 12px;
}

.settings-panel h2,
.wizard h2,
.panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

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

.sequence-counts {
  display: grid;
  gap: 10px;
  max-height: min(52dvh, 470px);
  overflow: auto;
  padding-right: 2px;
}

.sequence-count-row {
  display: grid;
  grid-template-columns: minmax(80px, 0.75fr) 1fr;
  gap: 10px;
  align-items: end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 100;
  display: none;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 14px;
  color: var(--text);
  background: rgba(11, 24, 40, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  text-align: center;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .hub {
    justify-content: flex-start;
    padding-top: 28px;
  }

  .hub-grid,
  .settings-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .donut {
    width: min(230px, 78vw);
    margin: 0 auto;
  }

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

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .assignment-grid,
  .comment-compose {
    grid-template-columns: 1fr;
  }

  .calendar-head {
    display: grid;
  }

  .calendar-toggle {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .shell,
  .hub {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-row {
    display: block;
  }

  .hero-actions {
    margin-top: 12px;
  }

  .hero h1,
  .hub-title {
    font-size: 2rem;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
    position: static;
  }

  .tab {
    font-size: 0.8rem;
  }

  .card-top {
    display: grid;
    align-items: stretch;
  }

  .thumb-wrap {
    width: 100%;
    flex-basis: auto;
  }

  .thumb-area {
    width: 100%;
    min-width: 0;
  }

  .calendar-task {
    grid-template-columns: 1fr;
  }

  .card-footer,
  .background-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions button {
    flex: 1;
  }

  .wizard-actions,
  .sequence-count-row {
    grid-template-columns: 1fr;
  }
}
