/* iOS-like shell: bottom tab bar, single-panel mobile navigation, in-app route map.
   Desktop (>=768px) layout is intentionally left untouched. */

/* --- Hide the "操作ヒント" block: the UI should explain itself --- */
#root aside > div:has(ul.list-disc) {
  display: none !important;
}

/* --- Bottom tab bar (hidden on desktop) --- */
.ios-tabbar {
  display: none;
}

.ios-map-sheet,
.ios-expense-sheet {
  display: none;
}

@media (max-width: 767px) {
  /* Bottom tab bar */
  .ios-tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(247, 249, 251, .82);
    backdrop-filter: blur(22px) saturate(1.4);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    border-top: 1px solid rgba(20, 33, 43, .1);
  }

  .ios-tabbar__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--muted, #6b7480);
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .ios-tabbar__btn svg {
    width: 23px;
    height: 23px;
    stroke-width: 1.9;
  }

  .ios-tabbar__btn.is-active {
    color: var(--lake-dark, #143f4f);
  }

  .ios-tabbar__badge {
    position: absolute;
    transform: translate(14px, -6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--rose, #be3b52);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }

  /* Give content room above the bar */
  body {
    padding-bottom: 74px;
  }

  /* Single-panel switching: show only the active section */
  body.iosb-browse #root aside { display: none !important; }
  body.iosb-plan  #root section { display: none !important; }

  body.iosb-map #root section,
  body.iosb-map #root aside,
  body.iosb-expense #root section,
  body.iosb-expense #root aside { display: none !important; }

  body.iosb-map .ios-map-sheet,
  body.iosb-expense .ios-expense-sheet {
    display: block;
    max-width: 440px;
    margin: 0 auto;
    padding: 0 .75rem;
  }

  /* Header: keep every action on a single tidy row */
  header > div > div:last-child {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    overflow-x: auto;
    scrollbar-width: none;
  }

  header > div > div:last-child::-webkit-scrollbar { display: none; }

  header button {
    min-width: 0 !important;
    flex: 0 0 auto;
    padding-inline: .5rem !important;
    font-size: 11px !important;
  }
}

/* --- In-app route map sheet --- */
.ios-map-sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 2px 6px;
}

.ios-map-sheet__title {
  font-size: 1.05rem;
  font-weight: 760;
  color: var(--ink, #14212b);
}

.ios-map-sheet__day {
  font-size: 12px;
  color: var(--muted, #6b7480);
  font-weight: 600;
}

.ios-map-status {
  margin: 2px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 650;
}

.ios-map-status.is-ok {
  background: rgba(47, 107, 79, .12);
  color: var(--forest, #2f6b4f);
}

.ios-map-status.is-warn {
  background: rgba(190, 59, 82, .12);
  color: var(--rose, #be3b52);
}

.ios-map-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-bottom: 16px;
  border: 0;
  border-radius: 14px;
  background: var(--lake-dark, #143f4f);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.ios-map-nav svg { width: 20px; height: 20px; }

.ios-route {
  position: relative;
  margin: 0;
  padding: 0 0 24px;
  list-style: none;
}

.ios-route__stop {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 2px 0;
}

.ios-route__marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 28px;
}

.ios-route__dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--lake, #0b6e8f);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ios-route__dot.is-anchor {
  background: var(--forest, #2f6b4f);
}

.ios-route__line {
  width: 2px;
  flex: 1 0 26px;
  background: linear-gradient(var(--line, #dfe7ea), var(--line, #dfe7ea));
  margin: 2px 0;
}

.ios-route__body {
  flex: 1;
  min-width: 0;
  padding-bottom: 6px;
}

.ios-route__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #14212b);
}

.ios-route__time {
  font-size: 12px;
  color: var(--muted, #6b7480);
  font-weight: 600;
}

.ios-route__move {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--lake, #0b6e8f);
}

.ios-route__move svg { width: 15px; height: 15px; }

.ios-map-sheet__empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted, #6b7480);
  font-size: 13px;
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 80;
  max-width: 88vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(20, 33, 43, .92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(20, 33, 43, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.share-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.share-toast.is-error {
  background: rgba(190, 59, 82, .94);
}

/* --- "コードで開く" button (cloud save is now folded into the native 保存 button) --- */
#root header button.cloud-save-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 .6rem;
  border: 1px solid rgba(47, 107, 79, .35) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, .78) !important;
  color: var(--forest, #2f6b4f) !important;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(20, 33, 43, .06);
}

@media (max-width: 767px) {
  #root header button.cloud-save-button {
    min-width: 0;
    flex: 0 0 auto;
    font-size: 11px !important;
    padding-inline: .5rem !important;
  }
}

/* --- Expense split --- */
.exp-people {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--surface-solid, #fff);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 650;
  color: var(--ink, #14212b);
}

.exp-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exp-stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line, #dfe7ea);
  border-radius: 10px;
  background: var(--app-bg, #f7f9fb);
  color: var(--lake-dark, #143f4f);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.exp-people-value {
  min-width: 24px;
  text-align: center;
  font-size: 17px;
}

.exp-people-unit {
  font-size: 12px;
  color: var(--muted, #6b7480);
}

.exp-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-solid, #fff);
  box-shadow: 0 1px 2px rgba(20, 33, 43, .06);
}

.exp-label {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink, #14212b);
}

.exp-label:focus { outline: none; }

.exp-amount-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 104px;
  padding: 6px 8px;
  border-radius: 9px;
  background: var(--app-bg, #f7f9fb);
  color: var(--muted, #6b7480);
  font-size: 13px;
}

.exp-amount {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink, #14212b);
}

.exp-amount:focus { outline: none; }

.exp-del {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #9aa4ad);
  font-size: 18px;
  line-height: 1;
}

.exp-add {
  width: 100%;
  min-height: 44px;
  margin-bottom: 16px;
  border: 1.5px dashed var(--line, #cfdae0);
  border-radius: 12px;
  background: transparent;
  color: var(--lake, #0b6e8f);
  font-size: 13.5px;
  font-weight: 650;
}

.exp-summary {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--lake-dark, #143f4f);
  color: #fff;
}

.exp-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  opacity: .78;
}

.exp-summary-row.is-strong {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  font-size: 15px;
  font-weight: 700;
  opacity: 1;
}

.exp-summary-row.is-strong span:last-child {
  font-size: 22px;
}

.exp-note {
  margin: 12px 2px 0;
  font-size: 11px;
  color: var(--muted, #6b7480);
}
