:root {
  --bg: #eef3f4;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #182325;
  --muted: #687577;
  --line: #d9e2e1;
  --teal: #0f766e;
  --teal-dark: #0b4f4c;
  --amber: #d98716;
  --cobalt: #2856d6;
  --danger: #b42318;
  --good: #15904f;
  --shadow: 0 18px 48px rgba(28, 45, 48, 0.11);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), transparent 38%),
    var(--bg);
}

.login-card {
  width: min(960px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row,
.brand,
.topbar,
.panel-header,
.summary-strip,
.shift-row,
.worker-topbar,
.money-line,
.notice,
.dialog-header {
  display: flex;
}

.brand-row,
.brand {
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 780;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #f4b13e;
  color: #142224;
  font-size: 13px;
  font-weight: 850;
}

.login-card h1 {
  max-width: 680px;
  margin: 24px 0 8px;
}

.login-card p {
  max-width: 720px;
  margin-bottom: 24px;
  color: var(--muted);
  line-height: 1.55;
}

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

.login-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.login-panel h2,
.dialog h2 {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #142224;
  color: #f6fbfb;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #b9c8c8;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.icon {
  display: grid;
  width: 22px;
  place-items: center;
  color: #f4b13e;
  font-size: 12px;
  font-weight: 850;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  color: #ccdddd;
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.good {
  background: #3ddc84;
}

.workspace {
  padding: 24px;
}

.topbar,
.worker-topbar {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-label {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

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

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

select,
input,
textarea {
  height: 40px;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
}

textarea {
  height: auto;
  min-height: 84px;
  resize: vertical;
  line-height: 1.45;
  padding: 10px 12px;
}

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 720;
}

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

.button.ghost {
  background: #ffffff;
  color: var(--ink);
}

.button.dark {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.event-overview-panel {
  margin-bottom: 16px;
}

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

.event-status-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.event-status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.event-status-heading h3,
.phase-heading h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
}

.event-status-heading span {
  display: grid;
  min-width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.event-card {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: inherit;
  padding: 12px;
  text-align: left;
}

.event-card.active {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px rgba(40, 86, 214, 0.12);
}

.event-card strong {
  font-size: 14px;
}

.event-card > span:not(.event-card-status) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.event-card-status {
  width: fit-content;
  min-height: 23px;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.event-card-status.planned {
  background: #edf5f3;
  color: var(--teal-dark);
}

.event-card-status.running {
  background: #eaf7ef;
  color: var(--good);
}

.event-card-status.completed {
  background: #eef1f2;
  color: var(--muted);
}

.event-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event-card-metrics span {
  min-height: 23px;
  border-radius: 6px;
  background: #f0f5f5;
  color: var(--ink);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 760;
}

.summary-strip article,
.money-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(28, 45, 48, 0.05);
}

.summary-strip span,
.money-card span,
.money-line span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.summary-strip strong,
.money-card strong {
  font-size: 24px;
  letter-spacing: 0;
}

.content-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.admin-grid {
  grid-template-columns: minmax(0, 1fr) 390px;
}

.worker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto 32px;
}

.worker-shell {
  min-height: 100vh;
  padding: 22px 0;
}

.worker-topbar {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto 18px;
}

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

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

.panel-header.compact {
  padding: 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 720;
}

.segment.active {
  background: #ffffff;
  color: var(--cobalt);
  box-shadow: 0 4px 12px rgba(25, 48, 79, 0.1);
}

.shift-list,
.worker-shifts,
.finance-list,
.notice-list,
.worker-money {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.phase-section {
  display: grid;
  gap: 9px;
}

.phase-section + .phase-section {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.phase-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
}

.phase-heading span,
.empty-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.shift-row {
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: inherit;
  text-align: left;
}

.shift-row:hover {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px rgba(40, 86, 214, 0.1);
}

.shift-row.selected {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px rgba(40, 86, 214, 0.12);
}

.shift-meta {
  width: 180px;
  flex: 0 0 180px;
}

.shift-meta strong,
.finance-person strong,
.worker-shift strong {
  display: block;
  font-size: 14px;
}

.shift-meta span,
.finance-person span,
.worker-shift span,
.notice span,
.status-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.assignment-stack {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
}

.crew-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 6px;
  padding: 0 8px;
  background: #edf5f3;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 760;
}

.crew-pill.pending,
.chip.pending,
.chip.warn {
  background: #fff3df;
  color: #8a4a00;
}

.crew-pill.cancelled,
.chip.cancelled,
.chip.danger {
  background: #fff0ef;
  color: var(--danger);
}

.crew-pill.confirmed,
.chip.confirmed,
.chip.good {
  background: #eaf7ef;
  color: var(--good);
}

.shift-money {
  width: 120px;
  flex: 0 0 120px;
  text-align: right;
  font-size: 13px;
  font-weight: 780;
}

.right-rail {
  display: grid;
  gap: 16px;
}

.finance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.notice {
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.notice strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.notice-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--amber);
}

.notice-dot.danger {
  background: var(--danger);
}

.notice-dot.good {
  background: var(--good);
}

.payroll-panel {
  margin-top: 16px;
}

.finance-panel,
.people-panel {
  margin-top: 16px;
}

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

.skill-manager {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.skill-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.skill-item input {
  min-width: 0;
  flex: 1;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.worker-shift {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 170px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.date-badge {
  display: grid;
  min-height: 70px;
  place-items: center;
  border-radius: var(--radius);
  background: #e8f2f1;
  color: var(--teal-dark);
  font-weight: 850;
  text-align: center;
}

.date-badge span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.worker-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.money-cards {
  display: grid;
  gap: 10px;
}

.money-line {
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.money-line:last-child {
  border-bottom: 0;
}

.money-line strong {
  font-size: 15px;
}

.money-line.deduction strong,
.money-negative {
  color: var(--danger);
}

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

.dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(9, 21, 23, 0.42);
}

.dialog form {
  display: grid;
  gap: 14px;
}

.dialog-stack {
  display: grid;
  gap: 14px;
}

.detail-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.dialog-header {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog input,
.dialog select,
.dialog textarea {
  width: 100%;
}

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

.detail-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-section h3 {
  margin: 0;
  font-size: 14px;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-section-header .button {
  flex: 0 0 auto;
}

.assignment-detail-list,
.history-list {
  display: grid;
  gap: 8px;
}

.assignment-detail-item,
.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.assignment-detail-item strong,
.history-item strong {
  display: block;
  font-size: 13px;
}

.assignment-detail-item span,
.history-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.person-finance-strip article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.person-finance-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.person-finance-strip strong {
  font-size: 18px;
}

.dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 22px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .sidebar-note,
  .sidebar .button {
    display: none;
  }

  .admin-grid,
  .worker-grid,
  .event-status-grid,
  .finance-list-wide,
  .skill-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .login-grid,
  .summary-strip,
  .dialog-grid,
  .person-finance-strip {
    grid-template-columns: 1fr;
  }

  .workspace,
  .login-card {
    padding: 14px;
  }

  .topbar,
  .worker-topbar,
  .panel-header,
  .shift-row,
  .assignment-detail-item,
  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .assignment-detail-item,
  .history-item {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .top-actions select,
  .top-actions .button,
  .segmented,
  .inline-form,
  .inline-form input,
  .inline-form .button {
    width: 100%;
  }

  .segmented {
    overflow-x: auto;
  }

  .shift-meta,
  .shift-money {
    width: auto;
    flex: auto;
    text-align: left;
  }

  .worker-shift {
    grid-template-columns: 1fr;
  }

  .worker-actions {
    justify-items: stretch;
  }
}

@media print {
  .sidebar,
  .top-actions,
  .worker-actions,
  .login-screen {
    display: none;
  }

  .app-shell,
  .content-grid,
  .worker-grid {
    display: block;
  }

  body {
    background: #ffffff;
  }

  .panel,
  .summary-strip article {
    box-shadow: none;
  }
}
