/**
 * Gemensam tidskomposer – sticky header sheet + formulär.
 * Innehåller egen shell så den fungerar utan company-min-tid.css (t.ex. AO-fält).
 */
:root {
  --mt-card: #fff;
  --mt-ink: #16231e;
  --mt-muted: #5c6b64;
  --mt-green: #2f5d50;
  --mt-green-soft: #e7f0ec;
  --mt-line: #e2e8f0;
}

html.mt-sheet-open,
body.mt-sheet-open {
  overflow: hidden;
  overscroll-behavior: none;
}
body.mt-sheet-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.mt-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 35, 30, 0.45);
  z-index: 60;
}
.mt-sheet,
.mt-sheet.mt-sheet-shell,
.etc-sheet.mt-sheet-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  overflow: hidden;
  background: #f4f6f5;
  border-radius: 18px 18px 0 0;
  padding: 0;
}
@media (max-width: 767px) {
  body.has-emp-bottom-nav .mt-sheet,
  body.has-emp-bottom-nav .mt-sheet.mt-sheet-shell,
  body.has-emp-bottom-nav .etc-sheet.mt-sheet-shell {
    top: var(--employee-sheet-top, var(--header-height-scrolled, 56px));
    bottom: var(--employee-sheet-bottom, calc(4.25rem + env(safe-area-inset-bottom, 0px)));
    max-height: none;
  }
  body.has-emp-bottom-nav .mt-sheet-body {
    padding-bottom: 1.1rem;
  }
}
.mt-sheet-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  background: #f4f6f5;
  border-bottom: 1px solid var(--mt-line, #e2e8f0);
  position: sticky;
  top: 0;
  z-index: 2;
}
.mt-sheet-head h2 { margin: 0; font-size: 1.1rem; }
.mt-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem 0.85rem calc(1.1rem + env(safe-area-inset-bottom));
}

.mt-muted { color: var(--mt-muted, #5c6b64); font-size: 0.85rem; }
.mt-btn {
  border: 1px solid var(--mt-line, #e2e8f0);
  background: #fff;
  color: var(--mt-ink, #16231e);
  border-radius: 10px;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.mt-btn-primary {
  background: var(--mt-green, #2f5d50);
  border-color: var(--mt-green, #2f5d50);
  color: #fff;
}
.mt-btn-primary:disabled { opacity: 0.55; }
.mt-form-grid {
  display: grid;
  gap: 0.55rem;
}
.mt-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--mt-muted, #5c6b64);
}
.mt-form-grid input,
.mt-form-grid select,
.mt-form-grid textarea {
  border: 1px solid var(--mt-line, #e2e8f0);
  border-radius: 10px;
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  color: var(--mt-ink, #16231e);
  background: #fff;
}
.mt-form-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.mt-form-actions .mt-btn { flex: 1; }

.etc-sheet .etc-job-context {
  margin: 0 0 0.75rem;
}
.etc-sheet .etc-job-label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--mt-muted, #5c6b64);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.etc-sheet .etc-job-context strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.35;
}
.etc-sheet .etc-job-context .mt-muted {
  margin: 0.2rem 0 0;
}
.etc-change-work-order {
  margin-top: 0.55rem;
  min-height: 40px;
  color: var(--mt-green, #2f5d50);
  border-color: #c5d4cb;
}
.etc-lock-message {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #eef2f0;
  color: var(--mt-muted, #5c6b64);
  font-size: 0.8rem;
  line-height: 1.35;
}

.etc-presets-wrap {
  grid-column: 1 / -1;
}
.etc-presets-label {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mt-muted, #5c6b64);
}
.etc-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}
.etc-preset {
  min-height: 44px;
  border: 1px solid var(--mt-line, #e2e8f0);
  background: var(--mt-card, #fff);
  color: var(--mt-ink, #16231e);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.etc-preset.is-active {
  background: var(--mt-green-soft, #e7f0ec);
  border-color: rgba(47, 93, 80, 0.45);
  color: var(--mt-green, #2f5d50);
}

.etc-more-toggle {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--mt-muted, #5c6b64);
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 0.35rem 0;
  cursor: pointer;
}
.etc-more-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.55rem;
  margin-top: 0.15rem;
}
.etc-more-panel[hidden] {
  display: none !important;
}
.etc-clock-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.etc-status {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.etc-status.is-error { color: #b42318; }
.etc-status.is-ok { color: var(--mt-green, #2f5d50); }
.etc-status.is-info { color: var(--mt-muted, #5c6b64); }

.etc-extras {
  display: grid;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--mt-line, #e2e8f0);
  border-radius: 12px;
  background: #fff;
}
.etc-extras-heading {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--mt-muted, #5c6b64);
}
.etc-extra-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}
.etc-extra-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.etc-extra-chip {
  min-height: 44px;
  min-width: 52px;
  padding: 0 0.7rem;
  border: 1px solid var(--mt-line, #e2e8f0);
  border-radius: 10px;
  background: #f8faf9;
  color: var(--mt-ink, #16231e);
  font-size: 0.92rem;
  font-weight: 650;
}
.etc-extra-chip.is-active {
  background: #2f5d50;
  border-color: #2f5d50;
  color: #fff;
}
.etc-extra-stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.etc-extra-stepper[hidden] {
  display: none !important;
}
.etc-extra-num {
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
}
.etc-extra-state {
  margin: 0;
  font-size: 0.78rem;
  color: var(--mt-muted, #5c6b64);
}
.etc-extra-state.is-unanswered {
  color: #9a3412;
}
.etc-field-error {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: #b42318;
}
.etc-stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
}
.etc-stepper-copy {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}
.etc-stepper-copy strong {
  font-size: 0.95rem;
}
.etc-stepper-copy span {
  font-size: 0.78rem;
  color: var(--mt-muted, #5c6b64);
  line-height: 1.3;
}
.etc-stepper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.25rem;
}
.etc-stepper-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--mt-line, #e2e8f0);
  border-radius: 10px;
  background: #f8faf9;
  color: var(--mt-ink, #16231e);
  font-size: 1.2rem;
  line-height: 1;
}
.etc-stepper input[type='number'] {
  width: 3.1rem;
  min-height: 40px;
  text-align: center;
  border: 1px solid var(--mt-line, #e2e8f0);
  border-radius: 10px;
  font-size: 1rem;
}
.etc-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-bottom: 0.25rem;
}
.etc-actions .mt-btn-primary {
  flex: 1 1 8rem;
  min-height: 48px;
}
.etc-btn-danger {
  color: #9a3412 !important;
  border-color: #fdba74 !important;
  background: #fff7ed !important;
}
.etc-delete-confirm {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: var(--mt-ink, #16231e);
}
.etc-delete-confirm p {
  margin: 0.3rem 0 0;
  color: var(--mt-muted, #5c6b64);
  font-size: 0.85rem;
}

.mt-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.mt-entry-locked {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mt-muted, #5c6b64);
  background: #eef2f0;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

@media (max-width: 430px) {
  .etc-presets {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.3rem;
  }
  .etc-preset {
    font-size: 0.82rem;
    padding: 0.35rem 0.15rem;
  }
}
