* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Maica-inspired brand tokens */
  --brand-navy: #0b1f36;
  /* Match accents to Maica logo teal */
  --brand-blue: #0f766e;
  --brand-blue-dark: #0b5f58;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;

  --text: #0f172a;
  --muted: #64748b;

  --border: #e2e8f0;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  padding: 24px;
  min-height: 100vh;
  color: var(--text);
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-header {
  background: var(--brand-navy);
  color: #ffffff;
  padding: 24px 32px;
  text-align: left;
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-logo {
  width: 40px;
  height: 40px;
}

.app-brand-text h1 {
  margin: 0 0 4px;
}

.app-brand-text p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.app-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.app-nav a {
  color: #e0ecff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.app-nav a:hover {
  text-decoration: underline;
}

.app-nav a.active {
  font-weight: 700;
  text-decoration: underline;
}

.app-header h1 {
  font-size: 26px;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.app-header p {
  font-size: 13px;
  opacity: 0.9;
}

.app-content {
  padding: 32px;
}

.section {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-blue);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-blue);
  flex-shrink: 0;
  align-self: center;
}

.section-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Collapsible section (e.g. Applicable penalty rates) – closed by default */
.collapsible-details {
  margin-top: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafafa;
}

.collapsible-summary {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  user-select: none;
}

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

.collapsible-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-left: 6px solid var(--brand-blue);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.2s ease;
}

.collapsible-details[open] .collapsible-summary::before {
  transform: rotate(90deg);
}

.collapsible-summary .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Subsection collapsibles (Shifts, Resources, Shift details, Resource details) */
.subsection-collapsible {
  margin-top: 16px;
  margin-bottom: 0;
}

.subsection-collapsible .subsection-summary {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding: 10px 14px;
  text-align: left;
  justify-content: flex-start;
}

.subsection-collapsible .collapsible-content {
  padding: 12px 14px 14px;
}

/* Collapsible main sections (Award, Classification, Rates, Shift Cost, Allowances) */
.section-details {
  margin: 0;
  padding: 0;
}

.section-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.section-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  flex-shrink: 0;
  border-left: 6px solid var(--brand-blue);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.2s ease;
}

.section-details[open] .section-summary::before {
  transform: rotate(90deg);
}

.section-summary .section-header {
  flex: 1;
  margin-bottom: 0;
}

.section-summary:hover .section-header .section-title {
  color: #1a202c;
}

.section-body {
  padding-top: 16px;
}

.collapsible-content {
  padding: 0 16px 16px;
  border-top: 1px solid #e2e8f0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 6px;
  font-size: 14px;
}

.options-count {
  font-size: 11px;
  color: var(--muted);
}

.required {
  color: #e53e3e;
  margin-left: 4px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-blue);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-blue-dark);
}

.btn-secondary {
  background: #eef2f7;
  color: #334155;
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.form-control,
.form-select,
.form-input {
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  background-color: var(--surface);
}

.form-control:focus,
.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.form-control[readonly] {
  background-color: #edf2ff;
}

.help-text {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.muted {
  color: #a0aec0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(37, 99, 235, 0.10);
  color: var(--brand-blue-dark);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-blue);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #f1f5f9;
  color: #334155;
}

.status-loading {
  color: #2b6cb0;
}

.status-error {
  color: #c53030;
}

.status-success {
  color: #2f855a;
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4a5568;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-top-color: #667eea;
  animation: spin 0.7s linear infinite;
}

.spinner-complete {
  animation: none;
  border-color: #48bb78;
  border-top-color: #48bb78;
  background-color: #48bb78;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.rate-panel {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 16px 18px;
}

.rate-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.rate-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #2d3748;
}

.rate-panel-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 14px;
  font-size: 13px;
}

.rate-label {
  color: #718096;
}

.rate-value {
  font-weight: 500;
  color: #1a202c;
}

.rate-highlight {
  color: #2f855a;
}

.tooltip {
  border-bottom: 1px dashed #a0aec0;
  cursor: help;
}

.penalties-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}

.penalties-table thead {
  background: #edf2f7;
}

.penalties-table th,
.penalties-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.penalties-table th {
  font-weight: 600;
  color: #4a5568;
  font-size: 12px;
}

.penalties-table tbody tr:last-child td {
  border-bottom: none;
}

.shift-cost-segments {
  margin-bottom: 12px;
}

.shift-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shift-cost-table th,
.shift-cost-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.shift-cost-table th {
  font-weight: 600;
  color: #4a5568;
  background: #edf2f7;
}

.shift-cost-table tbody tr:last-child td {
  border-bottom: none;
}

.shift-cost-total {
  padding-top: 12px;
  border-top: 2px solid #667eea;
}

.shift-cost-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 15px;
}

.shift-cost-total-label {
  color: #2d3748;
}

.shift-cost-section {
  margin-bottom: 16px;
}

.shift-cost-section:last-child {
  margin-bottom: 0;
}

.shift-cost-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.roster-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.roster-shifts-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
}

.roster-shifts-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}

.roster-shifts-table th,
.roster-shifts-table td {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
  background: #fff;
}

.roster-shifts-table thead th {
  background: #edf2f7;
  font-weight: 600;
  color: #4a5568;
}

.roster-shifts-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.roster-shifts-table .roster-input {
  width: 100%;
  min-width: 0;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.roster-shifts-table .roster-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.roster-shifts-table .btn-remove {
  padding: 6px 10px;
  font-size: 12px;
  background: #fed7d7;
  color: #c53030;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.roster-shifts-table .btn-remove:hover {
  background: #fc8181;
  color: #fff;
}

.roster-shift-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.roster-shift-section:last-of-type {
  border-bottom: none;
}

/* Worker panel */
.worker-panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #fafafa;
}

.worker-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.worker-panel-header input[type="text"] {
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid #0066cc;
  background: transparent;
  padding: 4px 0;
  flex: 1;
}

.worker-panel .worker-dropdowns {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.worker-panel .worker-dropdowns .form-select,
.worker-panel .worker-dropdowns .worker-casual-wrap {
  min-width: 0;
}

.worker-panel .worker-dropdowns .form-select {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.btn-remove-worker {
  background: #fff0f0;
  color: #cc0000;
  border: 1px solid #cc0000;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-remove-worker:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.roster-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.roster-summary-table th {
  background: #34495e;
  color: white;
  padding: 10px 12px;
  text-align: left;
}

.roster-summary-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.roster-summary-table tr.total-row {
  font-weight: 700;
  background: #f0f4f8;
  border-top: 2px solid #34495e;
}

/* Shift-first roster */
/* Shift-first roster — aligned with .section and roster-controls */
.shift-roster-shifts-block {
  margin-bottom: 16px;
}

.shift-roster-shifts-block .form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

#shift-roster-section .form-group input[type="text"] {
  max-width: 400px;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
}

.shift-roster-shift-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fafafa;
}

.shift-roster-shift-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-bottom: 14px;
}

.shift-roster-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #4a5568;
}

.shift-roster-inline-label .roster-input {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.shift-roster-workers-on-shift {
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.shift-roster-workers-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: #34495e;
}

.shift-roster-worker-rows {
  margin-top: 8px;
}

.shift-roster-worker-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr 80px 80px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
}

.shift-roster-worker-row .shift-roster-casual-wrap input {
  width: 60px;
}

/* Result rendering — structure like attached image */
.shift-roster-result-shift {
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.shift-roster-result-shift-header {
  background: #c45c26;
  color: white;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 1rem;
}

.shift-roster-result-worker {
  border-bottom: 1px solid #eee;
}

.shift-roster-result-worker summary {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 24px;
  cursor: pointer;
  list-style: none;
  gap: 8px;
}

.shift-roster-result-worker summary::-webkit-details-marker {
  display: none;
}

.shift-roster-result-worker summary::before {
  content: '▶';
  font-size: 0.65rem;
  color: #718096;
  transition: transform 0.2s;
}

.shift-roster-result-worker[open] summary::before {
  transform: rotate(90deg);
}

.shift-roster-result-worker-connector {
  color: #2d3748;
  font-family: monospace;
  flex-shrink: 0;
}

.shift-roster-worker-name {
  flex: 1;
  font-weight: 500;
  color: #2d3748;
}

.shift-roster-worker-cost {
  font-weight: 700;
  color: #2e7d32;
}

.shift-roster-result-worker-detail {
  padding: 0 16px 12px 40px;
}

.shift-roster-result-worker-detail .status-warning {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 8px 10px;
  margin: 8px 0;
  border-radius: 4px;
}

.shift-roster-shift-total {
  background: #f0f4f8;
  padding: 10px 16px;
  font-weight: 700;
  text-align: right;
  color: #c45c26;
}

.shift-roster-shift-total .rate-value,
.shift-roster-grand-total .rate-value {
  color: #2e7d32;
}

.shift-roster-grand-total {
  background: #c45c26;
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: right;
  margin-top: 16px;
}

.shift-roster-grand-total .rate-value {
  color: #a7f3d0;
}

.empty-state {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7fafc;
  font-size: 13px;
  color: #718096;
}

.link {
  color: #3182ce;
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.pill-casual {
  background: #fefcbf;
  color: #744210;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  .app-content {
    padding: 20px;
  }
}

/* ── Section subtitle (hint) ─────────────────────────── */
.section-hint {
  display: block;
  font-size: 0.9rem;
  color: #718096;
  margin-top: 4px;
  font-weight: 400;
}

/* ── Shared: worker rows ─────────────────────────────── */
.shift-cost-worker-row,
.roster-worker-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr 80px 80px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* ── Section 2: Shift Cost Calculator ───────────────── */
.shift-cost-shift-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.shift-cost-shift-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.shift-cost-workers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

/* ── Section 3: Roster Cost Calculator ──────────────── */
.roster-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.roster-name-row input {
  flex: 1;
  font-size: 1rem;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.roster-step {
  margin-bottom: 24px;
}

.roster-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.roster-shift-panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}

.roster-shift-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.roster-shift-inputs label {
  font-size: 0.8rem;
  color: #666;
  display: block;
  margin-bottom: 4px;
}

.roster-shift-worker-assignments {
  border-top: 1px solid #eee;
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.roster-shift-worker-assignments .assignments-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-right: 4px;
}

.roster-shift-worker-assignments label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ── Shared: result rendering ───────────────────────── */
.result-roster-name {
  font-size: 1rem;
  font-weight: 700;
  color: #34495e;
  margin-bottom: 16px;
}

.result-shift-block {
  margin-bottom: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.result-shift-header {
  background: #34495e;
  color: white;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.95rem;
}

.result-worker-detail {
  border-bottom: 1px solid #eee;
}

.result-worker-detail summary {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  gap: 8px;
  user-select: none;
}

.result-worker-detail summary::-webkit-details-marker { display: none; }

.result-worker-detail summary::before {
  content: '▶';
  font-size: 0.7rem;
  color: #999;
  transition: transform 0.2s;
}

.result-worker-detail[open] summary::before {
  transform: rotate(90deg);
}

.result-worker-name { flex: 1; font-weight: 500; }
.result-worker-cost { font-weight: 700; color: #2e7d32; }

.result-worker-segments {
  padding: 8px 16px 12px 32px;
}

.result-shift-total {
  background: #f0f4f8;
  padding: 10px 16px;
  font-weight: 600;
  text-align: right;
  font-size: 0.9rem;
}

.result-worker-totals-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.result-worker-totals-table th {
  background: #34495e;
  color: white;
  padding: 10px 12px;
  text-align: left;
}

.result-worker-totals-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.result-worker-totals-table tr.grand-total {
  font-weight: 700;
  background: #f0f4f8;
  border-top: 2px solid #34495e;
}

.result-grand-total {
  background: #34495e;
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: right;
  margin-top: 16px;
}

.warning-text {
  color: #b45309;
  font-size: 0.85rem;
  margin: 4px 0;
}

.segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 8px;
}

.segment-table th {
  background: #f0f4f8;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  color: #34495e;
}

.segment-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Calculator 2: Shift Cost Calculator ───────────── */

.shift-cost-shift-details {
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-checkbox {
  justify-content: flex-end;
  padding-bottom: 4px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
}

/* Resources header */
.shift-cost-resources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

.subsection-label {
  font-size: 1rem;
  font-weight: 600;
  color: #34495e;
}

.shift-cost-actions {
  margin-top: 24px;
}

/* Resource row — matches section card style */
.resource-row {
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}

/* Collapsible resource row: triangle on summary */
.resource-row-summary {
  cursor: pointer;
  list-style: none;
}

.resource-row-summary::-webkit-details-marker {
  display: none;
}

.resource-row-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  flex-shrink: 0;
  border-left: 6px solid var(--brand-blue);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.2s ease;
}

.resource-row[open] .resource-row-summary::before {
  transform: rotate(90deg);
}

.resource-row:not([open]) .resource-row-header {
  border-bottom: none;
}

.resource-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f4f6f9;
  border-bottom: 1px solid #e0e6ed;
  text-align: left;
}

.resource-row-number {
  font-size: 0.9rem;
  font-weight: 600;
  color: #34495e;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.resource-row-summary .btn-secondary {
  flex-shrink: 0;
}

.btn-link {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: underline;
}

.btn-link:hover {
  background: #fff0f0;
}

.btn-link:disabled {
  color: #bbb;
  cursor: not-allowed;
  text-decoration: none;
}

.resource-row-body {
  display: grid;
  grid-template-columns: 1fr 2fr 1.2fr minmax(220px, 1.5fr);
  gap: 20px;
  padding: 16px;
  align-items: start;
}

/* Prevent long classification text from overflowing */
.resource-row-body .resource-field-group select.form-select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Casual loading group (inside Employee rate type group): ensure visible when not hidden */
.rc-loading-group[hidden] {
  display: none !important;
}

.rc-loading-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

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

@media (max-width: 600px) {
  .resource-row-body {
    grid-template-columns: 1fr;
  }
}

/* Field group — matches existing form style */
.resource-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-count {
  font-weight: 400;
  color: #666;
  font-size: 0.78rem;
}

.field-help {
  font-size: 0.78rem;
  color: #888;
  font-style: italic;
  margin: 0;
  line-height: 1.4;
}

/* Result panel */
.result-shift-header {
  padding: 12px 16px;
  background: #34495e;
  color: white;
  border-radius: 8px 8px 0 0;
  font-size: 0.95rem;
  margin-top: 16px;
}

.result-resource-block {
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.result-resource-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: white;
}

.result-resource-summary::-webkit-details-marker { display: none; }

.result-resource-arrow {
  font-size: 0.65rem;
  color: #999;
  transition: transform 0.15s;
  flex-shrink: 0;
}

details[open] .result-resource-arrow {
  transform: rotate(90deg);
}

.result-resource-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.result-resource-meta {
  font-size: 0.8rem;
  color: #777;
  font-weight: 400;
  margin-left: 6px;
}

.result-resource-cost {
  font-weight: 700;
  color: #2e7d32;
  font-size: 1rem;
}

.result-resource-detail {
  padding: 10px 16px 16px 36px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
}

.result-shift-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f0f4f8;
  border: 1px solid #e0e0e0;
  border-top: 2px solid #34495e;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 1rem;
}

.result-shift-hours {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-top: none;
  font-size: 0.88rem;
  color: #555;
}

/* Segment table */
.segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 8px;
}

.segment-table th {
  background: #ecf0f1;
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: #34495e;
  font-size: 0.82rem;
}

.segment-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
}

.result-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 10px;
}

.result-breakdown-table td {
  padding: 4px 10px;
  border-bottom: 1px solid #f1f5f9;
}

.result-breakdown-table tr.result-breakdown-total-row td {
  font-weight: 600;
  border-top: 1px solid #e2e8f0;
  border-bottom: none;
}

.result-breakdown-amount {
  text-align: right;
}

.warning-text {
  color: #b45309;
  font-size: 0.85rem;
  margin: 6px 0 0;
}

.error-text {
  color: #c0392b;
  font-size: 0.9rem;
  padding: 8px 0;
}

/* ── Calculator 3: Resource Cost Calculator ─────────── */

.rcc-resource-panel {
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}

.rcc-resource-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f4f6f9;
  border-bottom: 1px solid #e0e6ed;
}

.rcc-resource-body {
  display: grid;
  grid-template-columns: 1fr 2fr 1.5fr 2fr 1fr;
  gap: 20px;
  padding: 16px;
  align-items: start;
}

.rcc-shifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

.rcc-shift-row {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.rcc-shift-row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.rcc-shift-row-fields .form-group {
  min-width: 100px;
  flex: 1;
}

.rcc-result-header {
  padding: 12px 16px;
  background: #34495e;
  color: white;
  border-radius: 8px 8px 0 0;
}

.rcc-result-resource-name {
  font-size: 1rem;
  font-weight: 600;
}

.allowance-text {
  color: #1a6b3c;
  font-size: 0.85rem;
  margin: 4px 0 0;
}

/* ── Calculator 4: Roster Cost Calculator ───────────── */

.rc4-section {
  max-width: 100%;
  min-width: 0;
}

.rc4-section-body {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.rc4-name-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.rc4-name-row .form-input {
  flex: 1;
  max-width: 480px;
  min-width: 0;
}

.rc4-shifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* Shift panel — match .resource-row / .rcc-resource-header */
.rc4-shift-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.rc4-shift-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f4f6f9;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

/* Collapsible shift panel: triangle on summary */
.rc4-shift-summary {
  cursor: pointer;
  list-style: none;
  text-align: left;
}

.rc4-shift-summary::-webkit-details-marker {
  display: none;
}

.rc4-shift-summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  flex-shrink: 0;
  border-left: 6px solid var(--brand-blue);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.2s ease;
}

.rc4-shift-details[open] .rc4-shift-summary::before {
  transform: rotate(90deg);
}

.rc4-shift-details:not([open]) .rc4-shift-header {
  border-bottom: none;
}

.rc4-shift-content {
  border-top: 1px solid var(--border);
}

.rc4-shift-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-align: left;
  flex: 1;
  min-width: 0;
}

.rc4-shift-header .btn-secondary {
  flex-shrink: 0;
}

.rc4-shift-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.rc4-shift-fields .form-group {
  min-width: 110px;
  flex: 1;
}

/* Resources within shift */
.rc4-shift-resources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f4f6f9;
  border-bottom: 1px solid var(--border);
}

.rc4-shift-resources {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* RC4 resource row reuses .resource-row and .resource-row-body from Shift Cost */
.rc4-resource-row {
  margin-bottom: 16px;
}

.rc4-resource-row .resource-row-body select.form-select,
.rc4-resource-row .resource-row-body input.form-control {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.rc4-resource-row .resource-row-body .resource-field-group {
  min-width: 0;
}

/* Prevent long option text from overflowing viewport */
.rc4-resource-row .form-select option,
.resource-row .form-select option {
  white-space: normal;
  word-wrap: break-word;
}

/* Result — align with .rcc-result-header / .result-shift-header */
.rc4-result-header {
  padding: 14px 16px;
  background: var(--brand-navy);
  color: white;
  border-radius: 8px 8px 0 0;
}

#rc4Result {
  max-width: 100%;
  overflow-x: auto;
}

.rc4-result-roster-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.rc4-result-shift-block {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.rc4-result-shift-header {
  padding: 10px 16px;
  background: var(--brand-navy);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.rc4-result-resource-totals {
  border: 1px solid var(--border);
  border-top: none;
  padding: 16px;
  background: var(--surface-muted);
}

.rc4-result-section-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.rc4-totals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rc4-totals-table th {
  background: #f4f6f9;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 0.82rem;
}

.rc4-totals-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.rc4-result-roster-total {
  border: 1px solid var(--border);
  border-top: 2px solid var(--brand-blue);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.rc4-roster-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--brand-navy);
  color: white;
  font-weight: 700;
  font-size: 1rem;
}
