/**
 * Min tid – personal (mobile-first, compact field app)
 */
:root {
  --mt-bg: #f4f6f5;
  --mt-card: #fff;
  --mt-ink: #16231e;
  --mt-muted: #5c6b64;
  --mt-green: #2f5d50;
  --mt-green-deep: #1b4332;
  --mt-green-soft: #e7f0ec;
  --mt-warn: #9a3412;
  --mt-warn-bg: #fff7ed;
  --mt-line: #e2e8f0;
  --mt-radius: 10px;
  --mt-band-under: #b42318;
  --mt-band-under-bg: #fceceb;
  --mt-band-exact: #1b4332;
  --mt-band-exact-bg: #e7f0ec;
  --mt-band-over: #1d4ed8;
  --mt-band-over-bg: #e8eef8;
  --mt-bottom-nav-height: 4.25rem;
  --mt-bottom-nav-clearance: 1.5rem;
  --mt-mobile-action-height: 3.5rem;
}

.mt-page {
  background: var(--mt-bg);
  min-height: 100vh;
  padding-bottom: calc(
    var(--mt-bottom-nav-height) + var(--mt-bottom-nav-clearance) + env(safe-area-inset-bottom, 0px)
  );
  scroll-padding-bottom: calc(
    var(--mt-bottom-nav-height) + var(--mt-bottom-nav-clearance) + env(safe-area-inset-bottom, 0px)
  );
  color: var(--mt-ink);
}
body.has-emp-bottom-nav.mt-page {
  padding-bottom: calc(
    var(--mt-bottom-nav-height) + var(--mt-bottom-nav-clearance) + env(safe-area-inset-bottom, 0px)
  );
}

/* Install-CTA: kompakt på Min tid så den inte stjäl fold */
.mt-page #mtInstallHost:empty,
.mt-page #mtInstallHost[hidden] {
  display: none;
}
.mt-page .mt-install-card {
  margin: 0 0 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
}
.mt-page .mt-install-card h3 {
  margin: 0 0 0.1rem;
  font-size: 0.86rem;
}
.mt-page .mt-install-card p {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 767px) {
  .mt-page .mt-install-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    margin: 0 0 0.25rem;
    padding: 0.4rem 0.55rem;
  }
  .mt-page .mt-install-card p {
    display: none;
  }
  .mt-page .mt-install-card h3 {
    margin: 0;
    font-size: 0.8rem;
  }
  .mt-page .mt-install-actions {
    flex-shrink: 0;
    margin: 0;
  }
}
.mt-page .mt-install-actions {
  gap: 0.35rem;
}
.mt-page .mt-install-actions .mt-btn-primary,
.mt-page .mt-install-actions .mt-btn-ghost {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  min-height: 36px;
}

.mt-hero {
  background: linear-gradient(165deg, #1b4332 0%, #2f5d50 55%, #3d6b5c 100%);
  color: #fff;
  padding: 0.5rem 0.85rem 0.55rem;
}
.mt-hero-inner {
  max-width: 1600px;
  margin: 0 auto;
}
.mt-hero h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.mt-hero p {
  margin: 0.08rem 0 0;
  opacity: 0.88;
  font-size: 0.78rem;
}

.mt-main {
  max-width: 1600px;
  margin: 0.35rem auto 0;
  padding: 0 0.7rem 1.25rem;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/*
 * index.css sätter på mobil: section { padding: 3rem 1rem !important }
 * Det skapade ~100px tomrum mellan kalender (#mtDays) och dagskort (#mtDetail).
 * Nolla padding på Min tids layout-sektioner så flödet blir tätt.
 */
.mt-page > .mt-main > section.mt-topband,
.mt-page > .mt-main > section.mt-workspace {
  padding: 0 !important;
  margin: 0;
}

.mt-topband {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mt-workspace {
  min-width: 0;
}

.mt-nav-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}
.mt-nav-row .mt-view-toggle {
  flex: 0 0 auto;
}
.mt-nav-row .mt-period-nav,
.mt-nav-row .mt-toolbar {
  flex: 1 1 auto;
  min-width: 0;
}

.mt-summary {
  margin-bottom: 0;
}
.mt-summary-compact {
  background: var(--mt-card);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 1px 2px rgba(22, 35, 30, 0.04);
}

.mt-period-total {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.mt-period-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.mt-period-total-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mt-muted);
  letter-spacing: 0.01em;
}
.mt-period-total-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--mt-green-deep);
  line-height: 1.1;
  text-align: right;
}
.mt-period-total-value strong {
  font-weight: 800;
  color: var(--mt-ink);
}
.mt-period-total.has-overtime .mt-period-total-value strong {
  color: var(--mt-band-over);
}
.mt-period-total-sep {
  margin: 0 0.15rem;
  color: var(--mt-muted);
  font-weight: 600;
}
.mt-period-planned {
  font-weight: 700;
  color: var(--mt-muted);
  font-size: 1.05rem;
}
.mt-period-overtime {
  margin: 0;
  align-self: flex-end;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mt-band-over);
  letter-spacing: 0.01em;
}

.mt-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.mt-metric {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  background: #f7f9f8;
  border: 1px solid var(--mt-line);
  color: var(--mt-ink);
}
.mt-metric i,
.mt-metric svg {
  width: 13px;
  height: 13px;
  color: var(--mt-green);
  flex-shrink: 0;
}
.mt-metric-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--mt-muted);
  line-height: 1.1;
}
.mt-metric-value {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.mt-metric-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mt-metric.is-overtime {
  background: var(--mt-band-over-bg);
  border-color: #c7d7f5;
}
.mt-metric.is-overtime i,
.mt-metric.is-overtime svg,
.mt-metric.is-overtime .mt-metric-label,
.mt-metric.is-overtime .mt-metric-value {
  color: var(--mt-band-over);
}

.mt-toolbar {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 0.25rem;
  align-items: center;
  margin-bottom: 0;
}
.mt-toolbar button,
.mt-btn {
  border: 1px solid var(--mt-line);
  background: var(--mt-card);
  color: var(--mt-ink);
  border-radius: 9px;
  min-height: 40px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}
.mt-toolbar button {
  min-width: 2.25rem;
  padding: 0.35rem 0.55rem;
  font-size: 1.1rem;
  line-height: 1;
}
.mt-btn-primary {
  background: var(--mt-green);
  border-color: var(--mt-green);
  color: #fff;
}
.mt-btn-primary:disabled { opacity: 0.55; }
.mt-btn-secondary {
  background: var(--mt-card);
  border-color: var(--mt-line);
  color: var(--mt-ink);
  font-weight: 600;
}
.mt-week-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mt-days-hint {
  display: none;
}

/* Kompakt veckorad — 7 dagar utan sidscroll */
.mt-days {
  margin-bottom: 0;
}
.mt-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.18rem;
  background: var(--mt-card);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  padding: 0.28rem;
}
.mt-week-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.06rem;
  min-width: 0;
  min-height: 58px;
  padding: 0.28rem 0.05rem 0.3rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--mt-ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mt-week-dow {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--mt-muted);
  line-height: 1.1;
}
.mt-week-num {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.mt-week-hrs {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--mt-muted);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.05rem;
}
.mt-week-day.has-time .mt-week-hrs {
  color: var(--mt-ink);
}
.mt-week-day.mt-band-under:not(.is-selected) {
  background: var(--mt-band-under-bg);
}
.mt-week-day.mt-band-under:not(.is-selected) .mt-week-num,
.mt-week-day.mt-band-under:not(.is-selected) .mt-week-hrs {
  color: var(--mt-band-under);
}
.mt-week-day.mt-band-exact:not(.is-selected) {
  background: var(--mt-band-exact-bg);
}
.mt-week-day.mt-band-exact:not(.is-selected) .mt-week-num {
  color: var(--mt-band-exact);
}
.mt-week-day.mt-band-over:not(.is-selected) {
  background: var(--mt-band-over-bg);
}
.mt-week-day.mt-band-over:not(.is-selected) .mt-week-num,
.mt-week-day.mt-band-over:not(.is-selected) .mt-week-hrs {
  color: var(--mt-band-over);
}
.mt-week-day.is-today:not(.is-selected).mt-band-empty {
  background: var(--mt-green-soft);
}
.mt-week-day.is-today:not(.is-selected).mt-band-empty .mt-week-num {
  color: var(--mt-green);
}
.mt-week-day.is-selected {
  background: var(--mt-green);
  border-color: var(--mt-green);
  color: #fff;
  box-shadow: 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-week-day.is-selected .mt-week-dow,
.mt-week-day.is-selected .mt-week-hrs {
  color: rgba(255, 255, 255, 0.88);
}
.mt-week-day.is-selected .mt-week-num {
  color: #fff;
}
.mt-week-day.is-selected.mt-band-under {
  box-shadow: inset 0 0 0 2px rgba(180, 35, 24, 0.55), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-week-day.is-selected.mt-band-exact {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-week-day.is-selected.mt-band-over {
  box-shadow: inset 0 0 0 2px rgba(29, 78, 216, 0.55), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-week-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 0.02rem;
}
.mt-week-dot.is-under { background: var(--mt-band-under); }
.mt-week-dot.is-exact { background: var(--mt-band-exact); }
.mt-week-dot.is-over { background: var(--mt-band-over); }
.mt-week-day.is-selected .mt-week-dot.is-under,
.mt-week-day.is-selected .mt-week-dot.is-exact,
.mt-week-day.is-selected .mt-week-dot.is-over {
  background: rgba(255, 255, 255, 0.95);
}

/* Vecka | Månad toggle */
.mt-view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  min-width: 8.5rem;
  max-width: none;
  margin: 0;
  padding: 0.15rem;
  gap: 0.1rem;
  background: #eef2f0;
  border-radius: 9px;
  border: 1px solid var(--mt-line);
}
.mt-view-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--mt-muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  min-height: 34px;
  padding: 0 0.55rem;
  border-radius: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mt-view-btn.is-active {
  background: var(--mt-card);
  color: var(--mt-green);
  box-shadow: 0 1px 2px rgba(22, 35, 30, 0.08);
}

/* Månadskalender */
.mt-month-cal {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--mt-card);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  padding: 0.35rem;
}
.mt-month-dow-row,
.mt-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.12rem;
}
.mt-month-dow {
  text-align: center;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--mt-muted);
  padding: 0.05rem 0;
}
.mt-month-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.04rem;
  min-width: 0;
  min-height: 42px;
  padding: 0.2rem 0.05rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--mt-ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mt-month-num {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.mt-month-hrs {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--mt-muted);
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-month-day.has-time .mt-month-hrs {
  color: var(--mt-ink);
}
.mt-month-day.mt-band-under:not(.is-selected):not(.out-month) {
  background: var(--mt-band-under-bg);
}
.mt-month-day.mt-band-under:not(.is-selected) .mt-month-num,
.mt-month-day.mt-band-under:not(.is-selected) .mt-month-hrs {
  color: var(--mt-band-under);
}
.mt-month-day.mt-band-exact:not(.is-selected):not(.out-month) {
  background: var(--mt-band-exact-bg);
}
.mt-month-day.mt-band-exact:not(.is-selected) .mt-month-num {
  color: var(--mt-band-exact);
}
.mt-month-day.mt-band-over:not(.is-selected):not(.out-month) {
  background: var(--mt-band-over-bg);
}
.mt-month-day.mt-band-over:not(.is-selected) .mt-month-num,
.mt-month-day.mt-band-over:not(.is-selected) .mt-month-hrs {
  color: var(--mt-band-over);
}
.mt-month-day.out-month {
  background: transparent;
  opacity: 0.42;
}
.mt-month-day.is-today:not(.is-selected).mt-band-empty {
  background: var(--mt-green-soft);
}
.mt-month-day.is-today:not(.is-selected).mt-band-empty .mt-month-num {
  color: var(--mt-green);
}
.mt-month-day.is-selected {
  background: var(--mt-green);
  border-color: var(--mt-green);
  color: #fff;
  box-shadow: 0 1px 6px rgba(27, 67, 50, 0.2);
  opacity: 1;
}
.mt-month-day.is-selected .mt-month-hrs {
  color: rgba(255, 255, 255, 0.88);
}
.mt-month-day.is-selected.mt-band-under {
  box-shadow: inset 0 0 0 2px rgba(180, 35, 24, 0.55), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-month-day.is-selected.mt-band-exact {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-month-day.is-selected.mt-band-over {
  box-shadow: inset 0 0 0 2px rgba(29, 78, 216, 0.55), 0 1px 6px rgba(27, 67, 50, 0.2);
}
.mt-month-day.is-selected .mt-week-dot.is-under,
.mt-month-day.is-selected .mt-week-dot.is-exact,
.mt-month-day.is-selected .mt-week-dot.is-over {
  background: rgba(255, 255, 255, 0.9);
}

.mt-detail {
  margin-top: 0;
  background: var(--mt-card);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  padding: 0.65rem 0.7rem;
  box-shadow: 0 1px 2px rgba(22, 35, 30, 0.04);
}
.mt-detail-layout {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mt-detail-aside {
  display: none;
}
.mt-detail-main,
.mt-detail-aside {
  min-width: 0;
}
.mt-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
}
.mt-detail-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.mt-detail-day-total {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mt-green-deep);
  white-space: nowrap;
}
.mt-detail-status {
  margin: -0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--mt-muted);
}
.mt-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.mt-empty-day {
  margin: 0.15rem 0 0.1rem;
  font-size: 0.88rem;
  color: var(--mt-muted);
}
.mt-day-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.15rem;
}
.mt-day-panel-actions .mt-btn {
  width: 100%;
  justify-content: center;
}
.mt-day-panel-actions .mt-btn-secondary {
  min-height: 38px;
  font-size: 0.8rem;
}
.mt-aside-card {
  background: #f7f9f8;
  border: 1px solid var(--mt-line);
  border-radius: 10px;
  padding: 0.7rem;
}
.mt-aside-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mt-muted);
}
.mt-aside-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.mt-aside-actions .mt-btn {
  width: 100%;
}
.mt-aside-note {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--mt-muted);
  line-height: 1.35;
}
.mt-entry {
  border-top: 1px solid var(--mt-line);
  padding: 0.55rem 0 0.15rem;
}
.mt-entry:first-of-type { border-top: 0; padding-top: 0; }
.mt-entry-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.mt-entry-kind-icon {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mt-green-soft);
  color: var(--mt-green);
}
.mt-entry-kind-icon i,
.mt-entry-kind-icon svg {
  width: 15px;
  height: 15px;
}
.mt-entry--customer .mt-entry-kind-icon {
  background: #e8f0ec;
  color: var(--mt-green);
}
.mt-entry--internal .mt-entry-kind-icon {
  background: #eef2f0;
  color: #3d5a50;
}
.mt-entry--absence .mt-entry-kind-icon {
  background: #f4f1ec;
  color: #6b5b4a;
}
.mt-entry-body {
  flex: 1;
  min-width: 0;
}
.mt-entry strong { display: block; }
.mt-entry-kind {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mt-muted);
  letter-spacing: 0.01em;
}
.mt-muted { color: var(--mt-muted); font-size: 0.85rem; }
.mt-entry-locked {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mt-muted);
}

/* Employee bottom nav */
.emp-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--mt-line);
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(22, 35, 30, 0.06);
}
.emp-bottom-nav a {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.2rem;
  text-decoration: none;
  color: var(--mt-muted);
  font-size: 0.7rem;
  font-weight: 600;
  min-height: 52px;
  justify-content: center;
  overflow: hidden;
}
.emp-bottom-nav a span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-bottom-nav a.is-active { color: var(--mt-green); }
.emp-bottom-nav a i, .emp-bottom-nav a svg { width: 22px; height: 22px; }

/* Sheet — sticky head + scroll body (mobil-säker) */
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 {
  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: var(--mt-bg);
  border-radius: 18px 18px 0 0;
  padding: 0;
}
.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: var(--mt-bg);
  border-bottom: 1px solid var(--mt-line);
  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-day-block { margin-bottom: 0.45rem; }
.mt-day-submeta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--mt-muted);
}
.mt-day-panel {
  margin-top: 0.35rem;
  padding: 0.75rem 0.85rem;
  background: var(--mt-card);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
}
.mt-day-panel-title { margin: 0 0 0.55rem; }
.mt-day-panel-actions {
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.mt-day-panel .mt-entry:first-child { border-top: 0; padding-top: 0; }
.mt-tabs {
  display: flex;
  gap: 0.25rem;
  background: #eef2f0;
  padding: 0.2rem;
  border-radius: 10px;
  margin-bottom: 0.65rem;
  overflow-x: auto;
}
.mt-tab {
  flex: 1;
  min-width: max-content;
  border: 0;
  background: transparent;
  min-height: 40px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--mt-muted);
  cursor: pointer;
  padding: 0.4rem 0.65rem;
}
.mt-tab.is-active {
  background: #fff;
  color: var(--mt-green);
  box-shadow: 0 1px 2px rgba(22, 35, 30, 0.08);
}
.mt-search {
  width: 100%;
  border: 1px solid var(--mt-line);
  border-radius: 10px;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  margin-bottom: 0.65rem;
  background: #fff;
}
.mt-ao-list { display: flex; flex-direction: column; gap: 0.45rem; }
.mt-ao-row {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}
.mt-ao-row .mt-ao-card { flex: 1; }
.mt-fav {
  flex-shrink: 0;
  width: 2.6rem;
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  background: #fff;
  color: var(--mt-muted);
  font-size: 1.15rem;
  cursor: pointer;
}
.mt-fav.is-on { color: #b45309; background: #fff7ed; border-color: #fdba74; }
.mt-ao-card {
  background: #fff;
  border: 1px solid var(--mt-line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  text-align: left;
  width: 100%;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.mt-ao-card strong {
  display: block;
  color: var(--mt-green);
  font-size: 0.95rem;
}
.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);
}
.mt-form-grid input,
.mt-form-grid select,
.mt-form-grid textarea {
  border: 1px solid var(--mt-line);
  border-radius: 10px;
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  color: var(--mt-ink);
  background: #fff;
}
.mt-form-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.mt-form-actions .mt-btn { flex: 1; }
.mt-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mt-muted);
  margin: 0.55rem 0 0.35rem;
}

@media (max-width: 430px) {
  .mt-hero { padding: 0.45rem 0.75rem 0.5rem; }
  .mt-main { padding-left: 0.7rem; padding-right: 0.7rem; gap: 0.65rem; }
  .mt-week-strip { gap: 0.14rem; padding: 0.22rem; }
  .mt-week-day { min-height: 52px; padding: 0.28rem 0.04rem 0.32rem; }
  .mt-period-total-value { font-size: 1.2rem; }
}

@media (max-width: 360px) {
  .mt-week-dow { font-size: 0.55rem; }
  .mt-week-num { font-size: 0.9rem; }
  .mt-week-hrs { font-size: 0.58rem; }
  .mt-week-strip { gap: 0.1rem; }
  .mt-period-total-value { font-size: 1.1rem; }
  .mt-month-day { min-height: 40px; padding: 0.18rem 0.04rem; }
  .mt-month-num { font-size: 0.78rem; }
  .mt-month-hrs { font-size: 0.5rem; }
  .mt-month-dow { font-size: 0.52rem; }
  .mt-nav-row { flex-wrap: wrap; }
  .mt-period-nav { width: 100%; justify-content: space-between; }
}

/* Tablet: bredare gutters, fortfarande en kolumn */
@media (min-width: 768px) {
  .mt-hero { padding: 0.85rem 1.5rem 0.95rem; }
  .mt-hero-inner,
  .mt-main { padding-left: 1.25rem; padding-right: 1.25rem; }
  .mt-main { margin-top: 0.65rem; gap: 0.55rem; }
  .mt-week-day { min-height: 62px; padding: 0.4rem 0.12rem 0.42rem; }
  .mt-week-dow { font-size: 0.66rem; }
  .mt-week-num { font-size: 1.05rem; }
  .mt-week-hrs { font-size: 0.68rem; }
  .mt-period-summary { padding: 0.65rem 0.85rem; }
  .mt-period-total-value { font-size: 1.45rem; }
  .mt-detail { padding: 0.85rem 1rem; }
  .mt-detail-title { font-size: 1.1rem; }
  .mt-month-day { min-height: 52px; }
  .mt-month-num { font-size: 0.95rem; }
  .mt-month-hrs { font-size: 0.62rem; }
  .mt-view-toggle { max-width: 16rem; }
}

/* Desktop: riktig arbetsyta, inte stretcht mobilkort */
@media (min-width: 1024px) {
  .mt-hero h1 { font-size: 1.45rem; }
  .mt-hero-inner,
  .mt-main {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
  .mt-topband {
    background: var(--mt-card);
    border: 1px solid var(--mt-line);
    border-radius: 12px;
    padding: 0.75rem 0.9rem 0.8rem;
    box-shadow: 0 1px 2px rgba(22, 35, 30, 0.04);
    gap: 0.5rem;
  }
  .mt-summary-compact {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .mt-period-total-value { font-size: 1.55rem; }
  .mt-summary-metrics { gap: 0.4rem; }
  .mt-metric {
    min-width: 6.5rem;
    padding: 0.35rem 0.55rem;
    background: #f7f9f8;
  }
  .mt-metric-value { font-size: 0.92rem; }
  .mt-toolbar {
    max-width: 20rem;
    margin-left: auto;
  }
  .mt-week-strip {
    gap: 0.3rem;
    padding: 0.4rem;
    background: #f7f9f8;
  }
  .mt-week-day { min-height: 68px; }
  .mt-month-cal {
    background: #f7f9f8;
    border-radius: 10px;
    padding: 0.4rem;
  }
  .mt-month-day {
    min-height: 58px;
    background: #fff;
  }
  .mt-month-day.out-month {
    background: transparent;
  }
  .mt-detail {
    padding: 1rem 1.1rem;
    min-height: 16rem;
  }
  .mt-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 1rem;
    align-items: start;
  }
  .mt-detail-aside {
    display: block;
    position: sticky;
    top: 1rem;
  }
  .mt-detail-meta {
    display: none;
  }
  .mt-day-panel-actions--mobile {
    display: none;
  }
}

@media (min-width: 1280px) {
  .mt-hero-inner,
  .mt-main {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .mt-detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 1.5rem;
  }
}

@media (min-width: 1600px) {
  .mt-hero-inner,
  .mt-main {
    padding-left: 2.25rem;
    padding-right: 2.25rem;
  }
}

.mt-register-choices {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mt-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--mt-line);
  background: var(--mt-card);
  border-radius: var(--mt-radius);
  padding: 0.85rem 0.95rem;
  min-height: 64px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.mt-choice strong { font-size: 1rem; }
.mt-form-grid select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--mt-line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  background: var(--mt-card);
  color: inherit;
}
/* Personalens egna dags- och periodlås */
.mt-period-lock-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.mt-lock-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #1b4332;
  border-radius: 10px;
  background: #1b4332;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.mt-lock-btn-secondary {
  background: #fff;
  color: #1b4332;
  border-color: #c5d4cb;
}

.mt-lock-btn svg,
.mt-company-lock svg {
  width: 16px;
  height: 16px;
}

.mt-week-day,
.mt-month-day {
  position: relative;
}

.mt-day-lock-icon {
  position: absolute;
  top: 0.28rem;
  right: 0.28rem;
  width: 12px;
  height: 12px;
  color: #1b4332;
}

.mt-week-day.is-locked,
.mt-month-day.is-locked {
  box-shadow: inset 0 0 0 1px rgba(27, 67, 50, 0.35);
}

.mt-company-lock {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d7e0db;
  border-radius: 10px;
  background: #eef2ef;
  color: #1b4332;
}

.mt-company-lock span,
.mt-company-lock small { display: block; }
.mt-company-lock strong { font-size: 0.82rem; }
.mt-company-lock small { margin-top: 0.12rem; color: #64748b; font-size: 0.72rem; line-height: 1.35; }

@media (max-width: 520px) {
  .mt-period-lock-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-period-lock-actions > :only-child { grid-column: 1 / -1; }
  .mt-lock-btn { width: 100%; }
}

/* ---- Employee mobile UX polish (presentation only) ---- */
.mt-hero p {
  font-size: 0.72rem;
  opacity: 0.78;
  line-height: 1.25;
}
.mt-summary-compact {
  padding: 0.45rem 0.65rem 0.5rem;
  gap: 0.28rem;
}
.mt-period-total-row {
  align-items: flex-end;
}
.mt-period-total-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mt-period-total-value {
  font-size: 1.22rem;
}
.mt-period-planned {
  font-size: 0.92rem;
}
.mt-summary-metrics {
  gap: 0.22rem;
}
.mt-metric {
  min-height: 1.55rem;
  padding: 0.12rem 0.38rem;
  background: transparent;
  border-color: transparent;
}
.mt-period-lock-actions {
  margin-top: 0.35rem;
}
.mt-lock-btn {
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  background: #fff;
  color: #1b4332;
  border-color: #c5d4cb;
  font-size: 0.75rem;
  font-weight: 700;
}
.mt-lock-btn-secondary {
  background: #fff;
  color: #5C6560;
  border-color: #d7e0db;
}

.mt-view-btn {
  min-height: 36px;
}
.mt-view-btn.is-active {
  color: var(--mt-green-deep);
  font-weight: 800;
}

/* Aktiv dag vs idag */
.mt-week-day.is-today:not(.is-selected) {
  border-color: var(--mt-green);
}
.mt-week-day.is-today.is-selected {
  box-shadow: 0 1px 6px rgba(27, 67, 50, 0.2), inset 0 -3px 0 rgba(255, 255, 255, 0.55);
}
.mt-month-day.is-today:not(.is-selected) {
  border-color: var(--mt-green);
}

.mt-detail-head {
  align-items: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}
.mt-detail-title {
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.2;
}
.mt-detail-day-total {
  font-size: 1.05rem;
}
.mt-detail-status {
  font-size: 0.72rem;
  margin: 0.05rem 0 0.15rem;
}

.mt-entry {
  padding: 0.65rem 0 0.35rem;
}
.mt-entry-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
}
.mt-entry-job {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--mt-ink);
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mt-entry-hours {
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mt-green-deep);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.mt-entry-kind {
  margin-top: 0.08rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mt-entry-clock,
.mt-entry-note,
.mt-entry-extras,
.mt-entry-status {
  margin-top: 0.12rem;
  font-size: 0.8rem;
  color: var(--mt-muted);
  line-height: 1.3;
}
.mt-entry-note {
  color: #3d4a45;
}
.mt-entry-extras {
  color: #3d4a45;
}
.mt-entry-status {
  font-size: 0.72rem;
  font-weight: 600;
}
.mt-entry-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.mt-entry-actions .mt-btn {
  min-height: 40px;
  min-width: 72px;
  font-size: 0.8rem;
}
.mt-btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--mt-muted);
  font-weight: 600;
}
.mt-btn-quiet:hover,
.mt-btn-quiet:focus-visible {
  border-color: var(--mt-line);
  color: var(--mt-ink);
}

@media (max-width: 767px) {
  .mt-main {
    flex: 0 0 auto;
    padding-bottom: calc(
      var(--mt-bottom-nav-height) + var(--mt-bottom-nav-clearance) + env(safe-area-inset-bottom, 0px)
    );
    scroll-padding-bottom: calc(
      var(--mt-bottom-nav-height) + var(--mt-bottom-nav-clearance) + env(safe-area-inset-bottom, 0px)
    );
  }
  .mt-workspace,
  .mt-detail,
  .mt-detail-layout,
  .mt-detail-main {
    flex: 0 0 auto;
    min-height: 0;
  }
  .mt-day-panel-actions--mobile {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    margin: 0.55rem 0 0;
    padding: 0;
    background: none;
  }
}

.mt-delete-confirm > strong {
  display: block;
  font-size: 1rem;
}
.mt-delete-confirm > p {
  margin: 0.4rem 0 0;
  color: var(--mt-muted);
}
.mt-delete-confirm .mt-btn-danger {
  color: #9a3412;
  border-color: #fdba74;
  background: #fff7ed;
}

@media (min-width: 768px) {
  .mt-page,
  body.has-emp-bottom-nav.mt-page {
    padding-bottom: 0;
    scroll-padding-bottom: 0;
  }
  .emp-bottom-nav {
    display: none;
  }
}

.mt-sheet::before,
.mt-sheet.mt-sheet-shell::before {
  content: '';
  position: absolute;
  top: 0.4rem;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 99px;
  background: #c5d4cb;
  z-index: 3;
}
.mt-sheet-head {
  padding-top: calc(1.05rem + env(safe-area-inset-top, 0px));
}
.mt-sheet-head #mtSheetClose {
  min-height: 40px;
  min-width: 64px;
}
.mt-sheet-date {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--mt-muted);
}
.mt-copy-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.15rem 0.15rem;
  min-height: 44px;
  border: 0;
  border-top: 1px solid var(--mt-line);
  background: transparent;
  color: var(--mt-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mt-copy-shortcut:active {
  color: var(--mt-ink);
}
.mt-copy-shortcut svg,
.mt-copy-shortcut i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.mt-detail-lock {
  margin: 0.15rem 0 0.4rem;
}
.mt-day-lock-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  width: auto;
  max-width: 100%;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1b4332;
  background: #fff;
  border: 1px solid #c5d4cb;
}
.mt-day-lock-action svg,
.mt-day-lock-action i {
  width: 15px;
  height: 15px;
}
.mt-detail-lock .mt-company-lock {
  margin: 0;
}
.mt-choice {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  min-height: 72px;
  padding: 0.85rem 0.9rem;
  -webkit-tap-highlight-color: transparent;
}
.mt-choice:active {
  background: #eef2f0;
  transform: scale(0.99);
}
.mt-choice-icon {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mt-green-soft);
  color: var(--mt-green);
}
.mt-choice-icon i,
.mt-choice-icon svg {
  width: 18px;
  height: 18px;
}
.mt-choice-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
}
.mt-choice-copy strong {
  font-size: 1.02rem;
}

.mt-section-label--priority {
  color: var(--mt-green-deep);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}
.mt-ao-list--priority .mt-ao-card {
  border-color: #c5d4cb;
  background: #f7faf8;
}
.mt-ao-id {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mt-green);
  margin-bottom: 0.08rem;
}
.mt-ao-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--mt-ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.mt-ao-card strong.mt-ao-title {
  color: var(--mt-ink);
}
.mt-ao-customer {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--mt-muted);
  line-height: 1.3;
}
.mt-fav {
  width: 2.75rem;
  min-width: 44px;
  min-height: 44px;
}

.emp-bottom-nav a.is-active {
  color: var(--mt-green-deep);
}
.emp-bottom-nav a.is-active span {
  font-weight: 800;
}

@media (max-width: 360px) {
  .mt-hero h1 { font-size: 1.05rem; }
  .mt-period-total-value { font-size: 1.08rem; }
  .mt-week-day { min-height: 54px; }
  .mt-entry-hours { font-size: 0.88rem; }
}

/* Billed days remain readable but cannot be edited by the employee. */
.mt-week-day.is-invoiced, .mt-month-day.is-invoiced { background:#e5e7eb!important; color:#4b5563!important; border-color:#9ca3af!important; }
.mt-week-day.is-invoiced.is-selected, .mt-month-day.is-invoiced.is-selected { outline:2px solid #66736b; outline-offset:2px; }
.mt-week-day.is-invoiced::after, .mt-month-day.is-invoiced::after { content:"Fakturerad"; display:block; font-size:9px; font-weight:600; }

.mt-office-view .emp-bottom-nav, .mt-office-view .mt-period-lock-actions { display:none!important; }
.mt-office-view .mt-hero a { color:inherit; text-decoration:underline; text-underline-offset:3px; }

.mt-page [hidden] { display:none!important; }

.mt-week-day.is-invoiced .mt-week-hrs, .mt-week-day.is-invoiced .mt-week-num, .mt-month-day.is-invoiced .mt-month-hrs, .mt-month-day.is-invoiced .mt-month-num { color:#374151!important; }
.mt-week-day.is-invoiced.is-selected, .mt-month-day.is-invoiced.is-selected { box-shadow:none!important; }

/* Keep the picker and its search field still while results change. */
.mt-sheet.mt-picker-sheet { height: 80vh; height: 80dvh; }
.mt-picker-sheet .mt-sheet-body { display:flex; flex-direction:column; overflow:hidden; }
.mt-picker-sheet .mt-tabs,.mt-picker-sheet .mt-form-actions { flex:0 0 auto; }
.mt-picker-sheet #mtPickerBody { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.mt-picker-sheet #mtPickerBody:has(#mtSearch) { display:flex; flex-direction:column; overflow:hidden; }
.mt-picker-sheet .mt-search { flex:0 0 auto; }
.mt-picker-sheet #mtSearchList { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; overflow-anchor:none; }
