:root {
  color: #13213a;
  background: #f7fbfc;
  font-family: Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  background: #f7fbfc;
}

.cahier-toolbar {
  position: relative;
  z-index: 2;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 24px;
  min-height: 92px;
  padding: 18px 6vw;
  background: #fff;
  border-bottom: 1px solid #d8e8ed;
  box-shadow: 0 5px 18px rgba(5, 71, 91, .08);
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 9px 18px;
  border: 1px solid #b6d2d8;
  border-radius: 22px;
  background: #fff;
  color: #075a70;
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 5px 12px rgba(5, 71, 91, .1);
}

.mode-switch {
  display: grid;
  grid-column: 2 / 4;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.mode-button {
  min-width: 0;
  min-height: 56px;
  padding: 8px 14px;
  border: 1px solid #b6d2d8;
  border-radius: 22px;
  background: #fff;
  color: #075a70;
  font: inherit;
  font-size: clamp(14px, 1.8vw, 21px);
  font-weight: 900;
  cursor: pointer;
  transition: .18s ease;
}

.mode-button:hover,
.mode-button:focus-visible {
  border-color: #0b8296;
  outline: none;
}

.mode-button.is-active {
  border-color: #087d91;
  background: linear-gradient(135deg, #087d91, #12a8aa);
  color: #fff;
  box-shadow: 0 4px 0 #056b7c, 0 6px 12px rgba(5, 107, 124, .18);
}

.cahier-frame-shell {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  background: #f7fbfc;
}

.cahier-initial-screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  padding: clamp(14px, 3vw, 34px);
  background: linear-gradient(145deg, #f7fbfc 0%, #edf8f8 52%, #fff7fb 100%);
  opacity: 1;
  transition: opacity .18s ease;
}

.cahier-frame-shell.is-ready .cahier-initial-screen {
  opacity: 0;
  pointer-events: none;
}

.initial-header,
.initial-version-switch,
.initial-actions {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.initial-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4vw, 48px);
  min-height: clamp(76px, 12vw, 132px);
  color: #12335d;
  text-align: center;
}

.initial-header h1 {
  margin: 0;
  font-size: clamp(26px, 5vw, 50px);
  line-height: 1;
}

.initial-header p {
  margin: 10px 0 0;
  color: #70839a;
  font-size: clamp(12px, 2vw, 20px);
}

.initial-back {
  display: grid;
  place-items: center;
  width: clamp(46px, 8vw, 72px);
  height: clamp(46px, 8vw, 72px);
  border-radius: 18px;
  background: #0c8297;
  color: #fff;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
}

.initial-version-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.5vw, 16px);
  margin-block: clamp(10px, 2vw, 24px);
}

.initial-version,
.initial-actions span {
  display: grid;
  place-items: center;
  min-height: clamp(42px, 7vw, 68px);
  padding: 8px 12px;
  border: 1px solid #b8dbe2;
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  color: #145672;
  font-size: clamp(11px, 1.8vw, 18px);
  font-weight: 800;
  text-align: center;
}

.initial-version.is-active {
  border-color: #0c94a2;
  background: linear-gradient(135deg, #0c8297, #16adb0);
  color: #fff;
}

.initial-schedule-card {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid #d2e7eb;
  border-radius: 22px;
  background: rgba(255, 255, 255, .82);
}

.initial-card-title {
  width: fit-content;
  margin: 0 auto clamp(10px, 2vw, 20px);
  padding: 8px clamp(20px, 4vw, 50px);
  border: 1px solid #c6e3e7;
  border-radius: 14px;
  color: #0b6076;
  font-size: clamp(15px, 2.6vw, 26px);
  font-weight: 900;
}

.initial-schedule-table {
  overflow: hidden;
  border: 1px solid #cfe0e7;
  border-radius: 16px;
}

.initial-table-head,
.initial-table-row {
  display: grid;
  grid-template-columns: minmax(58px, 12%) repeat(6, minmax(0, 1fr));
}

.initial-table-head > *,
.initial-table-row > * {
  min-width: 0;
  min-height: clamp(27px, 5vw, 58px);
  border-inline-end: 1px solid #d5e1e7;
  border-bottom: 1px solid #d5e1e7;
}

.initial-table-head > * {
  display: grid;
  place-items: center;
  padding: 4px;
  background: #e6f4f5;
  color: #12335d;
  font-size: clamp(8px, 1.5vw, 15px);
  font-weight: 800;
  text-align: center;
}

.initial-table-row b {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 3px;
  background: #f2f8fa;
  color: #12335d;
  font-size: clamp(8px, 1.4vw, 14px);
  text-align: center;
  white-space: nowrap;
}

.initial-table-row i {
  background: linear-gradient(135deg, rgba(235, 245, 255, .65), rgba(255, 255, 255, .9));
}

.initial-table-head > *:last-child,
.initial-table-row > *:last-child {
  border-inline-end: 0;
}

.initial-table-row:last-child > * {
  border-bottom: 0;
}

.initial-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.5vw, 16px);
  margin-top: clamp(12px, 2vw, 22px);
}

.initial-actions span:last-child {
  border-color: #b8d9f0;
  background: #edf7ff;
}

#cahier-frame {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  background: #f7fbfc;
  visibility: hidden;
  opacity: 0;
  transition: none;
}

#cahier-frame.is-ready {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 700px) {
  .cahier-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-height: 68px;
    padding: 9px 10px;
  }

  .back-link {
    min-height: 42px;
    padding: 6px 7px;
    border-radius: 11px;
    font-size: 12px;
  }

  .mode-switch {
    grid-column: 2 / 4;
    gap: 6px;
  }

  .mode-button {
    min-height: 40px;
    padding: 5px 6px;
    border-radius: 10px;
    font-size: clamp(10px, 3vw, 14px);
    white-space: nowrap;
  }

  .cahier-frame-shell {
    min-height: 100vh;
  }

  .cahier-initial-screen {
    padding: 10px 8px;
  }

  .initial-header {
    gap: 10px;
  }

  .initial-header p {
    margin-top: 6px;
  }

  .initial-schedule-card {
    padding: 8px;
    border-radius: 16px;
  }

  #cahier-frame {
    height: 100vh;
    min-height: 100vh;
  }
}
