:root {
  color-scheme: light;
  --ink: #101817;
  --muted: #61706c;
  --line: #dbe3df;
  --paper: #f3f6f5;
  --panel: #ffffff;
  --teal: #e3322b;
  --teal-soft: #fee8e7;
  --coral: #c24132;
  --gold: #b7791f;
  --green: #2f855a;
  --blue: #2563a9;
  --violet: #6d5bd0;
  --shadow: 0 18px 42px rgba(23, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #18332f;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #f8fffd;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.login-card input {
  border-color: rgba(255, 255, 255, 0.28);
}

.login-card label,
.setup-note {
  color: #d8ebe7;
}

.brand.large {
  margin-bottom: 8px;
}

.brand.large strong {
  font-size: 22px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #fecaca;
  font-size: 13px;
  font-weight: 700;
}

.setup-note {
  margin: 0;
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  color: #f8fffd;
  background: #121212;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #e3322b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #b7d5cf;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.ghost-action,
.primary-action,
.text-button,
.icon-button {
  border: 0;
  border-radius: 8px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  color: #e9fffb;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 3px 0 0 #f4b942;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
}

.primary-action {
  color: #ffffff;
  background: var(--teal);
}

.ghost-action {
  color: var(--ink);
  background: #e7eeeb;
}

.sidebar .ghost-action {
  color: #f8fffd;
  background: rgba(255, 255, 255, 0.13);
}

.workspace {
  min-width: 0;
  padding: 30px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.filters,
.inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.user-menu {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-menu span {
  max-width: 190px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
}

textarea {
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  position: relative;
  overflow: hidden;
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 38px rgba(16, 24, 23, 0.07);
}

.kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--teal);
  content: "";
}

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

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  letter-spacing: 0;
}

.kpi small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr) minmax(260px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.trend-panel {
  grid-column: span 2;
}

.analytics-stage > .panel:nth-child(4) {
  grid-column: span 2;
}

.recap-panel {
  margin-bottom: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(16, 24, 23, 0.075);
}

.panel-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.chart-panel {
  min-height: 430px;
}

.panel-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-canvas,
.donut-canvas {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 12px;
}

.compact-chart {
  margin-bottom: 4px;
}

.completion-dial {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.dial {
  display: grid;
  width: 128px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
}

.dial > div {
  display: grid;
  width: 88px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  text-align: center;
}

.dial strong {
  display: block;
  font-size: 27px;
}

.dial span,
.dial-notes span,
.platform-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dial-notes strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.chart-legend {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

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

.legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.bar-value,
.number {
  text-align: right;
}

.leaderboard {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.leader {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.rank {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  font-weight: 700;
}

.leader strong,
.leader span {
  display: block;
}

.leader span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.slack-summary {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #20332f;
  background: #fbfdfc;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.table-wrap {
  overflow: auto;
}

.table-wrap.tall {
  max-height: calc(100vh - 220px);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f0f5f3;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.status-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-completed {
  color: #14532d;
  background: #dcfce7;
}

.status-progress {
  color: #7c2d12;
  background: #ffedd5;
}

.status-blocked {
  color: #7f1d1d;
  background: #fee2e2;
}

.status-follow {
  color: #1e3a8a;
  background: #dbeafe;
}

.status-neutral {
  color: #3f3f46;
  background: #e4e4e7;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}

.member-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.member-card h2 {
  margin-bottom: 0;
}

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

.member-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.small-download {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  background: #f7fbfa;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.member-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f1;
  margin-bottom: 12px;
}

.member-progress div {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.department-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.department-key span,
.dept-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.department-key .film, .dept-pill.film { color: #e0f2fe; background: #075985; }
.department-key .ai, .department-key .ai-and-animation, .dept-pill.ai-and-animation { color: #f3e8ff; background: #7e22ce; }
.department-key .graphics, .dept-pill.graphics { color: #fff7ed; background: #c2410c; }
.department-key .editing, .dept-pill.editing { color: #dcfce7; background: #166534; }

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

.department-card,
.project-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid #64748b;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.department-card.film { border-top-color: #0ea5e9; }
.department-card.ai-and-animation { border-top-color: #a855f7; }
.department-card.graphics { border-top-color: #f97316; }
.department-card.editing { border-top-color: #22c55e; }
.department-card > div:first-child { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.department-card span { color:var(--muted); font-size:12px; font-weight:800; text-transform:uppercase; }
.department-card strong { font-size:28px; }
.department-card p, .department-card small { color:var(--muted); }
.department-card p { margin:12px 0; font-size:13px; }
.member-progress i { display:block; height:100%; border-radius:inherit; background:var(--teal); }

.deadline-list { display:grid; padding:4px 18px 18px; }
.deadline-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.deadline-item div { display:grid; gap:4px; }
.deadline-item span { color:var(--muted); font-size:12px; }
.deadline-item b { color:var(--green); white-space:nowrap; }
.deadline-item b.late { color:#c62828; }
.legend-row i { width:9px; height:9px; border-radius:50%; }

.project-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:14px; }
.project-card-head { display:flex; justify-content:space-between; gap:16px; }
.project-card-head p { margin:0 0 6px; color:var(--teal); font-size:11px; font-weight:800; text-transform:uppercase; }
.project-card-head strong { font-size:26px; }
.project-stats { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.project-stats span { padding:5px 8px; border-radius:999px; color:var(--muted); background:#f1f5f4; font-size:12px; font-weight:700; }
.next-action { margin:0; color:var(--muted); font-size:13px; }
.cell-note { display:block; margin-top:5px; color:var(--muted); }

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

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

.member-latest {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.member-latest-row {
  display: grid;
  gap: 3px;
}

.member-latest-row strong {
  font-size: 13px;
}

.member-latest-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-box {
  padding: 10px;
  border-radius: 8px;
  background: #f1f6f4;
}

.stat-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-box strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.report-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 16px;
}

.report-toolbar h2 {
  margin-bottom: 6px;
}

.report-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.report-range {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f7fbfa;
  font-size: 13px;
  font-weight: 800;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.report-person {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.report-person summary {
  min-height: 52px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
}

.report-person summary::-webkit-details-marker {
  display: none;
}

.report-person-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.report-person-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--teal);
  background: #f1f6f4;
  font-weight: 900;
  transition: transform 0.18s ease;
}

.report-person[open] .report-person-icon {
  transform: rotate(45deg);
}

.report-detail-panel {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}

.report-card-top span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-card-top strong {
  color: var(--green);
  font-size: 24px;
}

.report-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.report-activity-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  margin-bottom: 14px;
  padding-right: 4px;
  overflow: auto;
}

.report-activity-row {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.report-activity-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.report-activity-main {
  display: grid;
  gap: 3px;
}

.report-activity-main strong {
  color: var(--ink);
  font-size: 14px;
}

.report-activity-main span,
.report-activity-row p,
.report-activity-meta {
  color: var(--muted);
  font-size: 12px;
}

.report-activity-row p {
  margin: 0;
  line-height: 1.45;
}

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

.report-activity-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f6f4;
  font-weight: 800;
}

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

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

.user-admin-panel {
  grid-column: 1 / -1;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.user-form .wide {
  grid-column: 1 / -1;
}

.created-login {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.created-login[hidden] {
  display: none;
}

.created-login span,
.created-login strong {
  display: block;
  overflow-wrap: anywhere;
}

.created-login span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.created-login strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-table {
  min-width: 720px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.chip {
  color: #0f3d38;
  background: var(--teal-soft);
}

.text-button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--teal);
  background: transparent;
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-action {
  min-height: 30px;
  border: 1px solid var(--line);
  background: #f7fbfa;
}

.danger-action {
  color: #b42318;
}

.danger-action:hover {
  background: #fff1ef;
}

.row-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

dialog {
  width: min(920px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(23, 33, 31, 0.45);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  justify-content: end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: #edf3f1;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-height: min(68vh, 620px);
  overflow: auto;
  padding: 16px;
}

.wide {
  grid-column: span 2;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .nav-list,
  .sidebar-actions {
    display: flex;
    overflow-x: auto;
  }

  .nav-item,
  .sidebar-actions button {
    flex: 0 0 auto;
  }

  .topbar,
  .dashboard-grid,
  .analytics-stage,
  .report-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .trend-panel {
    grid-column: auto;
  }

  .analytics-stage > .panel:nth-child(4) {
    grid-column: auto;
  }

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

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

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

@media (max-width: 700px) {
  .workspace {
    padding: 16px;
  }

  .filters,
  .inline-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .admin-grid,
  .compact-legend,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .created-login {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .completion-dial,
  .flow-row,
  .platform-row {
    grid-template-columns: 1fr;
  }

  .bar-value,
  .number {
    text-align: left;
  }

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

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

  .department-board { grid-template-columns:1fr; }
}
