:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --text: #1a2230;
  --muted: #667085;
  --border: #d8dee8;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --success: #117a4e;
  --warning: #d18b12;
  --danger: #c0392b;
  --shadow: 0 14px 36px rgba(18, 29, 48, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 180ms ease;
}

body[data-theme="dark"] {
  --bg: #0e131b;
  --panel: #151c26;
  --panel-2: #101720;
  --text: #ecf1f9;
  --muted: #98a4b8;
  --border: #243041;
  --accent: #78a8ff;
  --accent-soft: rgba(120, 168, 255, 0.14);
  --success: #4cc38a;
  --warning: #f1b24f;
  --danger: #ff7d6e;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  transition:
    background var(--transition),
    color var(--transition);
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  padding: 1.25rem;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  position: sticky;
  top: 0;
  height: 100vh;
  max-width: 0;
  overflow: auto;
}

.content {
  padding: 1.25rem;
}

.content--full {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-list--top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.nav-list--centered {
  justify-content: center;
}

.nav-list--top .nav-button {
  text-align: center;
  min-width: 140px;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: center;
  }
}

.sidebar,
.content-header {
  display: none;
}

.card {
  background: var(--panel);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.sidebar-summary h2 {
  font-size: 1rem;
  margin: 0 0 1.5rem;
}

.brand-row,
.content-header,
.toolbar,
.jobs-toolbar,
.field-row,
.file-row,
.metrics-stack,
.kpi-row {
  display: flex;
  gap: 1rem;
}

.brand-row,
.content-header,
.toolbar,
.jobs-toolbar,
.file-row,
.kpi-row {
  align-items: center;
  justify-content: space-between;
}

.toolbar {
  margin-bottom: 1rem;
}

.content-header {
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.73rem;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 2vw, 2.4rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 1.8vw, 2rem);
}

.nav-list {
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.nav-list--top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

.nav-button,
.segmented-button,
.primary-button,
.secondary-button,
.icon-button,
.file-remove,
.tag,
.task-close {
  border-radius: 999px;
  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition),
    border-color var(--transition);
}

.nav-button,
.segmented-button,
.secondary-button {
  text-align: left;
  padding: 0.9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
}

.nav-list--top .nav-button {
  text-align: center;
}

.primary-button {
  padding: 0.35rem;
  min-width: 5rem;
  background: var(--accent);
  color: white;
  border: 1px solid transparent;
}

.secondary-button {
  padding: 0.9rem 1rem;
}

.nav-button:hover,
.segmented-button:hover,
.secondary-button:hover,
.primary-button:hover,
.icon-button:hover,
.file-remove:hover,
.task-close:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
}

.nav-button.is-active,
.segmented-button.is-active {
  background: var(--accent-soft);
  border-color: rgba(47, 111, 237, 0.35);
  color: var(--accent);
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.sidebar-summary {
  padding: 1rem;
}

.metrics-stack {
  flex-direction: row;
}

.today-panel .metrics-stack {
  gap: 0.75rem;
}

.metric-item {
  display: flex;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  gap: 1rem;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: fadeSlide 220ms ease;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.dashboard-grid--expanded {
  align-items: start;
}

.kpi-panel,
.alert-panel,
.activity-panel,
.calendar-panel,
.dashboard-jobs-panel,
.toolbar,
.wizard-steps,
.wizard-form,
.modal-card {
  padding: 1rem;
}

.kpi-panel {
  grid-column: span 8;
}

.alert-panel {
  grid-column: span 4;
}

.activity-panel {
  grid-column: span 7;
}

.calendar-panel {
  grid-column: span 5;
}

.dashboard-jobs-panel {
  grid-column: span 12;
}

.dashboard-grid--expanded .dashboard-jobs-panel {
  grid-column: 1 / -1;
}

.dashboard-jobs-toolbar {
  margin-bottom: 1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.stat-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 0.35rem;
}

.table-wrap {
  overflow: auto;
  padding: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.95rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th button {
  padding: 0;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.tag.is-warning {
  background: rgba(209, 139, 18, 0.14);
  color: var(--warning);
}

.tag.is-danger {
  background: rgba(192, 57, 43, 0.14);
  color: var(--danger);
}

.tag.is-success {
  background: rgba(17, 122, 78, 0.14);
  color: var(--success);
}

.tag.is-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.kanban-grid,
.calendar-list,
.alert-list,
.file-list,
.task-builder,
.collection-editor-list,
.task-card-grid,
.stock-adjuster,
.cardless-grid,
.modal-grid,
.form-grid,
.detail-grid {
  display: grid;
  gap: 1rem;
}

.kanban-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.kanban-column,
.calendar-day,
.job-card,
.calendar-job,
.file-item,
.task-item,
.alert-item,
.summary-box,
.notice-box {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.kanban-column,
.kanban-list,
.kanban-list > * {
  min-width: 0;
}

.kanban-column {
  overflow: hidden;
}

.kanban-list {
  display: grid;
  gap: 0.75rem;
}

.job-card,
.calendar-job {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kanban-column .job-card {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 0.6rem;
  align-items: start;
  justify-content: stretch;
  text-align: left;
}

.kanban-column .job-card p,
.kanban-column .job-card .eyebrow,
.kanban-column .job-card strong,
.kanban-column .kpi-row {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.kanban-column .kpi-row {
  flex-wrap: wrap;
  align-items: flex-start;
}

.calendar-job {
  border-top: 1px solid var(--border);
}

.wizard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

#wizardStepList {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.2rem;
}

#wizardStepList li,
.wizard-steps li {
  color: var(--muted);
}

#wizardStepList li.is-current,
.wizard-steps li.is-current {
  color: var(--accent);
  font-weight: 700;
}

.wizard-steps ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.65rem;
}

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

.field {
  display: grid;
  gap: 0.5rem;
}

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

.field label {
  display: block;
  margin-bottom: 0.4rem;
}

.actions-row,
.collection-editor-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.actions-row {
  justify-content: space-between;
  margin-top: 1rem;
}

.file-remove {
  width: 28px;
  height: 28px;
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger);
}

.clickable-row,
.clickable-card {
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.clickable-row:hover,
.clickable-card:hover {
  background: var(--accent-soft);
}

.clickable-card {
  width: 100%;
  text-align: left;
}

.fullscreen-modal-shell {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.fullscreen-modal-shell.is-open {
  display: block;
}

.fullscreen-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
}

.fullscreen-modal-panel {
  position: absolute;
  inset: 2vh 2vw;
  width: auto;
  height: auto;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem;
}

#modalContent {
  position: relative;
  min-height: calc(100vh - 5.5rem);
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.modal-grid--single {
  grid-template-columns: 1fr;
}

.detail-grid > div {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.detail-grid strong {
  display: block;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

.stock-adjuster-row input,
.collection-editor-row input,
.collection-editor-row select {
  flex: 1;
}

.collection-editor-row {
  align-items: stretch;
}

.mono {
  white-space: pre-wrap;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.task-slot {
  width: 100%;
  margin-top: 1rem;
  padding: 1.25rem 1rem;
  border: 1px dashed rgba(120, 168, 255, 0.7);
  border-radius: var(--radius-md);
  background: transparent;
  text-align: center;
}

.task-slot:hover {
  background: var(--accent-soft);
}

.task-card-header {
  display: flex;
  min-width: 100%;
  align-items: flex-end;
  gap: 1rem;
}

.task-close {
  align-self: flex-end;
  justify-self: flex-end;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
}

.task-empty {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--muted);
}

.collection-item-card {
  width: 100%;
}

.collection-item-card .task-card-header strong {
  overflow-wrap: anywhere;
}

.collection-editor-list {
  margin-top: 1rem;
}

.jobs-view-btns,
.jobSearch {
  display: flex;
  flex: 1 auto;
  gap: 0.5rem;
}

@media (max-width: 1100px) {
  .app-shell,
  .wizard-layout,
  .modal-grid,
  .kanban-grid,
  .dashboard-grid,
  .stat-grid,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .kpi-panel,
  .alert-panel,
  .activity-panel,
  .calendar-panel,
  .dashboard-jobs-panel {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 1rem;
  }

  .brand-row,
  .content-header,
  .toolbar,
  .jobs-toolbar,
  .file-row,
  .actions-row,
  .calendar-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-list--top {
    flex-direction: column;
  }

  .stat-grid,
  .kanban-grid,
  .form-grid,
  .month-grid {
    grid-template-columns: 1fr;
  }
}

.calendar-shell,
.month-cell-list {
  display: grid;
  gap: 1rem;
}

.calendar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1rem;
}

.month-cell {
  min-height: 180px;
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.month-cell.is-muted {
  opacity: 0.6;
}

.month-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.month-cell-header .eyebrow {
  margin: 0;
}

.month-job {
  width: 100%;
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  text-align: left;
}

.month-job--empty,
.month-job--more {
  color: var(--muted);
}

.alert-item--compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 120px;
  align-items: center;
  gap: 1rem;
}

.job-card-content {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.task-preview-list {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.task-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.task-preview-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-preview-qty,
.task-preview-row--ellipsis {
  color: var(--muted);
}

.task-preview-row--ellipsis {
  grid-template-columns: 1fr;
}

.task-card-header .task-close {
  margin-left: auto;
}


.dashboard-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.dashboard-module {
  --dashboard-module-flex-grow: 1;
  --dashboard-module-flex-basis: 320px;
  --dashboard-module-min-width: 280px;
  --dashboard-module-max-width: 100%;
  --dashboard-module-min-height: auto;
  --dashboard-module-max-height: none;
  display: flex;
  flex: var(--dashboard-module-flex-grow) 1 var(--dashboard-module-flex-basis);
  flex-direction: column;
  min-width: min(100%, var(--dashboard-module-min-width));
  max-width: var(--dashboard-module-max-width);
  min-height: var(--dashboard-module-min-height);
  max-height: var(--dashboard-module-max-height);
  overflow: hidden;
}

.dashboard-module[data-span="12"] {
  --dashboard-module-flex-grow: 999;
  --dashboard-module-flex-basis: 100%;
}

.dashboard-module[data-span="8"] {
  --dashboard-module-flex-grow: 8;
  --dashboard-module-flex-basis: 760px;
}

.dashboard-module[data-span="6"] {
  --dashboard-module-flex-grow: 6;
  --dashboard-module-flex-basis: 560px;
}

.dashboard-module[data-span="4"] {
  --dashboard-module-flex-grow: 4;
  --dashboard-module-flex-basis: 360px;
}

.dashboard-module[data-span="3"] {
  --dashboard-module-flex-grow: 3;
  --dashboard-module-flex-basis: 280px;
}

.dashboard-module__body {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-module__body > * {
  min-width: 0;
}

.dashboard-module .metrics-stack,
.dashboard-module .alert-list,
.dashboard-module .toolbar,
.dashboard-module .jobs-toolbar,
.dashboard-module .kanban-grid,
.dashboard-module .calendar-list,
.dashboard-module .month-grid,
.dashboard-module table,
.dashboard-module .table-wrap,
.dashboard-module #dashboardJobViewRoot,
.dashboard-module .calendar-shell {
  min-width: 0;
  width: 100%;
}

.dashboard-module--jobs-workspace .dashboard-module__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-module--jobs-workspace #dashboardJobViewRoot,
.dashboard-module--jobs-workspace .card,
.dashboard-module--jobs-workspace .table-wrap {
  min-width: 0;
}

.dashboard-module--summary .metrics-stack {
  flex-wrap: wrap;
  align-items: stretch;
}

.dashboard-module--summary .metric-item {
  flex: 1 1 180px;
  min-width: 0;
}

.dashboard-module--alerts .alert-list {
  align-content: start;
}

.dashboard-status-chart {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.dashboard-status-chart > * {
  min-width: 0;
}

.dashboard-status-chart__graphic {
  flex: 1 1 260px;
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-status-chart__svg {
  width: 100%;
  max-width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  overflow: visible;
  margin-inline: auto;
  display: block;
  flex: 0 1 auto;
}

.dashboard-status-chart__legend {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.75rem;
  align-content: start;
  min-width: min(100%, 220px);
}

.dashboard-status-chart__legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 0.9rem;
  min-width: 0;
}

.dashboard-status-chart__swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
}

.dashboard-status-chart__legend-label {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.dashboard-status-chart__legend-label strong,
.dashboard-status-chart__legend-label .eyebrow {
  overflow-wrap: anywhere;
}

.dashboard-status-chart__empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border, rgba(255, 255, 255, 0.16));
  border-radius: 1rem;
}

.dashboard-status-chart__label {
  font-size: 15px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.dashboard-status-chart__label tspan:first-child {
  font-weight: 700;
}

.dashboard-module--status-chart {
  padding: 1.75rem;
}

@media (max-width: 1180px) {
  .dashboard-module {
    --dashboard-module-max-width: 100%;
    flex-basis: 100%;
  }

  .dashboard-status-chart__graphic,
  .dashboard-status-chart__legend {
    flex-basis: 100%;
  }
}

@media (max-width: 720px) {
  .dashboard-module {
    --dashboard-module-min-width: 100%;
    flex-basis: 100%;
  }

  .dashboard-status-chart__graphic {
    min-width: 0;
  }
}
