:root {
  --bg: #f4f7fb;
  --ink: #0e1c2f;
  --muted: #607089;
  --line: #d7e1ef;
  --panel: #ffffff;
  --blue: #195b93;
  --green: #16835d;
  --amber: #c27a1a;
  --red: #bc3b3b;
  --shadow: 0 18px 50px rgba(14, 28, 47, .10);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
html {
  background: var(--bg);
  overflow-y: scroll;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% -10%, #e3f0ff 0, transparent 34%), var(--bg);
  color: var(--ink);
  overscroll-behavior-y: contain;
  touch-action: pan-x pan-y;
}

body.has-modal {
  overflow: hidden;
}

body.has-modal .phone-shell {
  max-height: 100dvh;
  overflow: hidden;
}

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

button, a, input, select, textarea, label {
  touch-action: manipulation;
}

.pull-refresh {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 60;
  transform: translate(-50%, -58px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(215, 225, 239, .95);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(14, 28, 47, .18);
  backdrop-filter: blur(16px);
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .18s ease, opacity .18s ease, background .18s ease, color .18s ease;
}

body.pull-refresh-ready .pull-refresh,
body.is-pull-refreshing .pull-refresh {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.phone-shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar {
  background: #11243c;
  color: white;
  border-radius: 26px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 4px 18px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong { display: block; }
.brand span { color: #b8c7d9; font-size: 13px; }

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  border: 0;
  color: #dce8f5;
  background: transparent;
  border-radius: 14px;
  padding: 12px 12px;
  text-align: left;
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav button b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.nav svg,
.bottom-tabs svg {
  width: 19px;
  height: 19px;
  display: block;
}

.nav button.active {
  background: #ffffff;
  color: #11243c;
}

.content {
  min-width: 0;
  padding-bottom: 88px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-settings {
  display: none;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 14px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(14, 28, 47, .06);
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.btn.ghost {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
  color: white;
  box-shadow: none;
}

.btn.danger {
  color: var(--red);
}

.btn.wide {
  width: 100%;
  justify-content: center;
  margin-top: 18px;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.field.compact {
  width: 170px;
}

.grid {
  display: grid;
  gap: 14px;
}

.kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel.pad { padding: 18px; }

.kpi small, .muted {
  color: var(--muted);
}

.kpi strong {
  display: block;
  font-size: 24px;
  margin: 6px 0;
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.row.as-button {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.row strong { display: block; }
.row small { color: var(--muted); }
.money { font-weight: 800; color: var(--blue); }
.spacer { height: 16px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2,
.panel h2 {
  margin: 0 0 12px;
}

.section-title h2 {
  margin-bottom: 0;
}

.section-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-field {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

.mini-field span {
  color: var(--muted);
  font-size: 12px;
}

.mini-field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
}

.entry-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 10px;
  margin: 12px 0 14px;
}

.sync-control { position: relative; }
.sync-feedback {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  color: #34715e;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 14px;
}
.sync-feedback[hidden] { display: none; }

.service-report-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .8fr) minmax(160px, .8fr);
  gap: 10px;
  margin: 12px 0 14px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-name {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.day {
  min-height: 84px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 8px;
  text-align: left;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  color: var(--ink);
}

.day.worked {
  background: #e9f7f1;
  border-color: #a9dec8;
}

.day.weekend {
  background: #f1f3f6;
  border-color: #d8dee7;
}

.day.weekend.worked {
  background: #eef5f1;
  border-color: #cbd8d1;
}

.day.today {
  outline: 3px solid rgba(25, 91, 147, .22);
}

.day.holiday {
  background: #fff5cf;
  border-color: #e9cb63;
}

.day.holiday.worked {
  background: #fff1bb;
  border-color: #ddb847;
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  font-weight: 800;
}

.day.worked .day-number {
  background: rgba(22, 131, 93, .12);
  color: #0d6b4a;
}

.day-items {
  display: grid;
  gap: 5px;
  align-content: start;
}

.day-badge {
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(22, 131, 93, .11);
  border: 1px solid rgba(22, 131, 93, .22);
  line-height: 1.15;
  min-width: 0;
}

.day-badge b {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-badge small {
  color: var(--muted);
  font-size: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 8px;
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: white;
}

.datetime-pair {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(96px, .56fr);
  gap: 8px;
}

.datetime-pair input {
  min-width: 0;
}

.datetime-pair input[type="time"] {
  text-align: center;
}

.work-period {
  gap: 9px;
  padding: 2px 0 4px;
}

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

.mini-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.mini-field span {
  color: var(--muted);
  font-size: 13px;
}

.field.full { grid-column: 1 / -1; }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.calc-box {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  background: #eef5fc;
  border: 1px solid #d6e5f5;
}

.calc-box span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.calc-box strong {
  color: var(--ink);
  font-size: 16px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(14, 28, 47, .38);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100dvh - 44px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(215, 225, 239, .95);
  border-radius: 26px;
  box-shadow: 0 26px 80px rgba(14, 28, 47, .28);
  padding: 20px;
}

.confirm-card {
  width: min(460px, 100%);
}

.pdf-modal-shell {
  padding: 18px;
}

.pdf-modal-card {
  width: min(1120px, 100%);
  height: min(92dvh, 920px);
  max-height: min(92dvh, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.pdf-modal-header {
  margin-bottom: 12px;
}

.pdf-frame-scroll {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  -webkit-overflow-scrolling: touch;
}

.pdf-frame {
  display: block;
  width: calc(100% / var(--pdf-scale, 1));
  height: calc(100% / var(--pdf-scale, 1));
  min-width: calc(100% / var(--pdf-scale, 1));
  min-height: calc(100% / var(--pdf-scale, 1));
  border: 0;
  background: white;
  transform: scale(var(--pdf-scale, 1));
  transform-origin: top left;
}

.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-top: 12px;
}

.pdf-toolbar-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f7fbff;
}

.pdf-toolbar-group strong {
  min-width: 92px;
  text-align: center;
  font-size: 14px;
}

.pdf-tool-btn {
  width: 38px;
  height: 38px;
  font-size: 21px;
  line-height: 1;
}

.pdf-tool-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.modal-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f4f7fb;
  color: var(--ink);
  font-weight: 800;
}

.form-error {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #f0b8b8;
  border-radius: 14px;
  background: #fff0f0;
  color: #9c2c2c;
  font-weight: 700;
}

.app-toast {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid #cfe0f3;
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 50px rgba(14, 28, 47, .22);
  color: var(--ink);
  backdrop-filter: blur(14px);
}

.app-toast.success {
  border-color: #b8dfcf;
  background: rgba(241, 252, 247, .96);
}

.app-toast.danger {
  border-color: #efb4b4;
  background: rgba(255, 247, 247, .96);
}

.day-modal-card {
  width: min(680px, 100%);
}

.day-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.day-detail-list {
  margin-top: 14px;
}

.day-detail-row {
  background: #fbfdff;
}

.day-detail-row > div:first-child { min-width: 0; }
.day-detail-row > div:first-child > small { display: block; overflow-wrap: anywhere; }

.entry-amount-details {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  font-size: 13px;
}

.entry-amount-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  cursor: pointer;
  list-style: none;
}

.entry-amount-details summary::-webkit-details-marker { display: none; }
.entry-amount-details summary::before { content: "\203A"; font-size: 22px; line-height: 1; }
.entry-amount-details[open] summary::before { transform: rotate(90deg); }
.entry-amount-details summary strong { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-amount-details summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.amount-lines { margin: 0; }
.amount-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.amount-line dt { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.amount-formula { display: block; margin-top: 3px; font-weight: 400; }
.amount-line small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; line-height: 1.45; }
.amount-line dd { margin: 0; text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-note { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.amount-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; }
.amount-total small { font-weight: 400; color: var(--muted); }
.amount-total strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
[data-entry-price] { margin-top: 14px; }

@media (max-width: 700px) {
  .calc-box.day-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.report-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.report-head,
.report-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.3fr) repeat(6, minmax(78px, .7fr)) minmax(120px, 1fr);
  gap: 0;
  min-width: 820px;
}

.report-head {
  background: #dfeaf6;
  color: #16324f;
  font-weight: 800;
}

.report-head span,
.report-row span {
  padding: 10px 12px;
  border-right: 1px solid rgba(215, 225, 239, .8);
}

.report-row {
  background: white;
  border-top: 1px solid var(--line);
}

.report-row.total {
  background: #eef5fc;
  font-weight: 800;
}

.settings-title {
  align-items: flex-start;
}

.settings-title p {
  margin: 5px 0 0;
}

.desktop-hint {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #cfe0f3;
  border-radius: 16px;
  background: #f2f7fc;
  color: var(--muted);
}

.desktop-hint strong {
  color: var(--ink);
}

.notification-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, .8fr);
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #cfe0f3;
  border-radius: 16px;
  background: #f7fbff;
}

.notification-panel-copy,
.notification-controls {
  display: grid;
  gap: 10px;
}

.notification-panel-copy > span {
  color: var(--muted);
  line-height: 1.45;
}

.notification-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.notification-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #cfe0f3;
  border-radius: 999px;
  background: #eef5fc;
  color: #24547e;
  font-size: 12px;
  font-weight: 800;
}

.notification-status.success {
  border-color: #b8dfcf;
  background: #eefaf5;
  color: #176544;
}

.notification-status.danger {
  border-color: #efb4b4;
  background: #fff2f2;
  color: #9c2c2c;
}

.notification-time {
  max-width: 220px;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}

.toggle-field input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
}

.notification-actions {
  margin-top: 2px;
}

.backup-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d7e1ef;
  border-radius: 16px;
  background: #fbfdff;
}

.backup-panel strong,
.backup-panel span {
  display: block;
}

.backup-panel span {
  color: var(--muted);
  margin-top: 4px;
}

.logout-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #efb4b4;
  border-radius: 16px;
  background: #fff7f7;
}

.logout-panel strong,
.logout-panel span {
  display: block;
}

.logout-panel span {
  color: var(--muted);
  margin-top: 4px;
}

.icon-action {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.icon-action svg {
  width: 19px;
  height: 19px;
}

.icon-action.danger {
  border-color: #efb4b4;
  color: var(--red);
}

.restore-btn {
  cursor: pointer;
}

.restore-btn input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.save-message {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #a9dec8;
  border-radius: 14px;
  background: #e9f7f1;
  color: #0d6b4a;
  font-weight: 700;
}

.bottom-tabs {
  display: none;
}

@media (max-width: 820px) {
  .phone-shell {
    display: block;
    padding: 14px 14px calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .pull-refresh {
    display: block;
  }

  .sidebar { display: none; }
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 10px;
  }

  .mobile-settings {
    display: grid;
    place-items: center;
    width: 52px;
    height: 45px;
    border-radius: 16px;
  }

  .mobile-settings svg {
    width: 21px;
    height: 21px;
  }

  .kpis, .form, .service-report-controls {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .field.compact {
    width: calc(50% - 6px);
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .calc-box {
    grid-template-columns: 1fr 1fr;
  }

  .modal-shell {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: 88vh;
    border-radius: 24px 24px 18px 18px;
    padding: 16px;
  }

  .pdf-modal-shell {
    align-items: stretch;
    padding: 0;
  }

  .pdf-modal-card {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px));
  }

  .pdf-frame-scroll {
    border-radius: 12px;
  }

  .pdf-toolbar {
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 10px;
    padding-bottom: max(2px, env(safe-area-inset-bottom, 0px));
  }

  .pdf-toolbar-group {
    flex: 1 1 240px;
  }

  .modal-header {
    grid-template-columns: 1fr auto;
  }

  .modal-header .money {
    grid-column: 1 / 2;
    grid-row: 2;
  }

  .modal-header .icon-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .day-summary {
    grid-template-columns: 1fr 1fr;
  }

  .calendar {
    gap: 5px;
  }

  .day {
    min-height: 62px;
    border-radius: 12px;
  }

  .section-title {
    align-items: flex-start;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions .btn,
  .mini-field {
    flex: 1 1 150px;
  }

  .backup-panel {
    grid-template-columns: 1fr;
  }

  .notification-panel {
    grid-template-columns: 1fr;
  }

  .notification-time {
    max-width: none;
  }

  .logout-panel {
    grid-template-columns: 1fr;
  }

  .icon-action {
    width: 100%;
  }

  .app-toast {
    left: 12px;
    right: 12px;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .entry-controls {
    grid-template-columns: 1fr 1fr;
  }

  .bottom-tabs {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(215, 225, 239, .9);
    border-radius: 28px;
    padding: 8px;
    z-index: 10;
    gap: 5px;
    overflow: hidden;
    scrollbar-width: none;
    box-shadow: 0 18px 50px rgba(14, 28, 47, .22);
    backdrop-filter: blur(18px);
  }

  .bottom-tabs::-webkit-scrollbar {
    display: none;
  }

  .bottom-tabs button {
    border: 0;
    background: transparent;
    color: #607089;
    font-size: 10px;
    padding: 7px 8px;
    border-radius: 20px;
    min-width: 0;
    min-height: 56px;
    display: grid;
    place-items: center;
    gap: 3px;
    flex: 1 1 0;
    transition: background .18s ease, color .18s ease, transform .18s ease;
  }

  .bottom-tabs button b {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef5fc;
    color: #195b93;
    font-size: 12px;
  }

  .bottom-tabs svg {
    width: 17px;
    height: 17px;
  }

  .bottom-tabs button span {
    font-size: 10px;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-tabs button.active {
    background: #195b93;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(25, 91, 147, .25);
  }

  .bottom-tabs button.active b {
    background: rgba(255, 255, 255, .2);
    color: white;
  }
}

@media (max-width: 540px) {
  .kpis, .form, .service-report-controls {
    grid-template-columns: 1fr;
  }

  .work-period-grid {
    grid-template-columns: 1fr;
  }

  .datetime-pair {
    grid-template-columns: minmax(0, 1fr) minmax(88px, .45fr);
  }

  .field.compact {
    width: 100%;
  }

  .calc-box {
    grid-template-columns: 1fr;
  }

  .entry-controls {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar .btn {
    width: 100%;
    justify-content: center;
  }

  .calendar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .day-name,
  .calendar-blank {
    display: none;
  }

  .day {
    min-height: 82px;
    border-radius: 18px;
    padding: 12px;
    grid-template-columns: 44px 1fr;
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .day-number {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: #f4f7fb;
    font-size: 16px;
  }

  .day-items {
    gap: 7px;
  }

  .day-badge {
    padding: 8px 10px;
    border-radius: 13px;
  }

  .day-badge b {
    font-size: 14px;
  }

  .day-badge small {
    font-size: 12px;
  }

  .bottom-tabs {
    left: 8px;
    right: 8px;
    border-radius: 24px;
    padding: 7px;
    gap: 5px;
    overflow: hidden;
  }

  .bottom-tabs button {
    min-width: 0;
    min-height: 54px;
    padding: 7px 6px;
    flex: 1 1 0;
  }

  .bottom-tabs button span {
    display: none;
  }

  .bottom-tabs button b {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .bottom-tabs svg {
    width: 19px;
    height: 19px;
  }
}

.day.on-leave {
  background: repeating-linear-gradient(135deg, #f5f6f7 0, #f5f6f7 7px, #eceef0 7px, #eceef0 8px);
  border-color: #d4d8dd;
  color: #454c54;
}

.day.on-leave .day-number {
  background: #ffffff;
  color: #454c54;
}

.leave-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #454c54;
  padding-top: 4px;
}

.leave-badge svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.leave-modal-card {
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
}

.leave-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.leave-modal-header h2 { margin: 0; font-size: 18px; }
.leave-modal-header p { margin: 6px 0 0; color: #636b75; font-size: 14px; }
.leave-modal-header .icon-btn { flex-shrink: 0; }

.leave-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid #e3e6e9;
  border-bottom: 1px solid #e3e6e9;
  color: #454c54;
}

.leave-status svg { width: 22px; height: 22px; flex-shrink: 0; }
.leave-status strong { display: block; font-size: 14px; }
.leave-status span { display: block; margin-top: 4px; color: #636b75; font-size: 14px; }
.leave-modal-actions { justify-content: space-between; }

@media (max-width: 700px) {
  .day.on-leave:not(.worked) {
    min-height: 52px;
    padding: 8px 12px;
    grid-template-columns: 32px 1fr;
    align-items: center;
    border-radius: 12px;
  }
  .day.on-leave:not(.worked) .day-number {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 14px;
  }
  .day.on-leave .leave-badge { padding-top: 0; }
}

@media (max-width: 380px) {
  .leave-modal-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 380px) {
  .datetime-pair {
    grid-template-columns: 1fr;
  }
}
