/* Native-style presentation for the installed WCR app only. */
.wcr-app-shell {
  --app-navy: #071c27;
  --app-ink: #102f3d;
  --app-cyan: #24bfd3;
  --app-bg: #edf3f6;
  --app-card: #ffffff;
  --app-line: #d4e1e7;
  background: var(--app-bg);
}

.wcr-app-shell,
.wcr-app-shell body {
  overscroll-behavior-y: none;
}

.wcr-app-shell body {
  min-height: 100dvh;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  background: var(--app-bg);
  color: var(--app-ink);
  -webkit-tap-highlight-color: transparent;
}

.wcr-app-shell .client-header {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 44px;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(7, 28, 39, .96);
  backdrop-filter: blur(18px) saturate(1.35);
}

.wcr-app-shell .client-header > a {
  display: none !important;
}

.wcr-app-shell .client-header > span {
  margin: 0 auto;
  font-size: 10px;
  letter-spacing: .11em;
}

.wcr-app-shell main {
  width: 100%;
  max-width: none;
}

.wcr-app-shell .wcr-dashboard {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 13px 30px;
}

.wcr-app-shell .wcr-head {
  position: relative;
  display: block;
  min-height: 86px;
  margin: 0 -13px 16px;
  padding: 18px 108px 18px 16px;
  border: 0;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(145deg, #071c27 0%, #0b3545 100%);
  box-shadow: 0 10px 28px rgba(7, 28, 39, .18);
  color: #fff;
}

.wcr-app-shell .wcr-title {
  align-items: center;
  gap: 12px;
}

.wcr-app-shell .wcr-title img {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  max-width: 60px;
  max-height: 60px;
  padding: 7px !important;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: #020a0e;
  object-fit: contain !important;
}

.wcr-app-shell .wcr-title .kicker {
  color: #5bdded;
  font-size: 9px;
}

.wcr-app-shell .wcr-title h1 {
  color: #fff;
  font-size: clamp(23px, 7vw, 34px);
  line-height: 1.02;
}

.wcr-app-shell .wcr-title p:last-child {
  overflow: hidden;
  max-width: 38ch;
  margin-top: 5px;
  color: #bfd0d7;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wcr-app-shell .wcr-head-actions {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 14px;
  display: flex !important;
  width: auto;
  height: 42px;
  gap: 7px;
}

.wcr-app-shell .wcr-metrics {
  display: flex;
  gap: 10px;
  margin: 0 -13px 14px;
  padding: 0 13px 5px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.wcr-app-shell .wcr-metrics::-webkit-scrollbar {
  display: none;
}

.wcr-app-shell .wcr-metrics article {
  flex: 0 0 145px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  background: var(--app-card);
  box-shadow: 0 5px 16px rgba(22, 55, 69, .07);
  scroll-snap-align: start;
}

.wcr-app-shell .wcr-toolbar,
.wcr-app-shell .wcr-event-count-filters,
.wcr-app-shell .wcr-content-bank {
  border: 1px solid var(--app-line);
  border-radius: 20px;
  background: var(--app-card);
  box-shadow: 0 5px 18px rgba(22, 55, 69, .07);
}

.wcr-app-shell .wcr-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
}

.wcr-app-shell .wcr-toolbar label,
.wcr-app-shell .wcr-toolbar button,
.wcr-app-shell input,
.wcr-app-shell select,
.wcr-app-shell textarea {
  font-size: 16px;
}

.wcr-app-shell .wcr-toolbar input,
.wcr-app-shell .wcr-toolbar select,
.wcr-app-shell .wcr-toolbar button {
  width: 100%;
  min-height: 48px;
  border-radius: 13px;
}

.wcr-app-shell .wcr-event-count-filters {
  margin: 11px 0 15px;
  padding: 12px;
}

.wcr-app-shell .wcr-member-grid {
  grid-template-columns: 1fr;
  gap: 11px;
}

.wcr-app-shell .wcr-member-card {
  min-height: 0;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  background: var(--app-card);
  box-shadow: 0 5px 16px rgba(22, 55, 69, .07);
}

.wcr-app-shell .wcr-member-top {
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  min-height: 92px;
  padding: 12px;
}

.wcr-app-shell .wcr-photo {
  width: 68px;
  height: 78px;
  border-radius: 13px;
}

.wcr-app-shell .wcr-member-card h3 {
  font-size: 18px;
}

.wcr-app-shell .wcr-content-bank {
  margin: 18px 0 0;
  padding: 15px 11px;
}

.wcr-app-shell .wcr-content-heading h2 {
  font-size: 27px;
}

.wcr-app-shell .wcr-content-item {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  background: #fff;
}

.wcr-app-shell .wcr-content-actions button,
.wcr-app-shell .wcr-dialog-actions button,
.wcr-app-shell dialog button {
  min-height: 44px;
  border-radius: 12px;
}

.wcr-app-shell .wcr-member-dialog,
.wcr-app-shell .wcr-schedule-dialog,
.wcr-app-shell .wcr-calendar-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(14px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
}

.wcr-app-tabbar {
  position: fixed;
  z-index: 1000;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(66px + env(safe-area-inset-bottom));
  padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(15, 55, 72, .14);
  background: rgba(255,255,255,.94);
  box-shadow: 0 -8px 28px rgba(10, 39, 51, .12);
  backdrop-filter: blur(20px) saturate(1.45);
}

.wcr-app-tabbar[hidden] {
  display: none !important;
}

.wcr-app-tabbar button {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  padding: 3px 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #6b818b;
  font: 700 10px/1 "DM Sans", sans-serif;
}

.wcr-app-tabbar button.active {
  background: #e6f8fb;
  color: #087d90;
}

.wcr-app-tabbar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wcr-app-tools-dialog {
  position: fixed;
  top: auto;
  bottom: 0;
  width: 100%;
  max-width: 760px;
  max-height: min(82dvh, 760px);
  margin: auto auto 0;
  padding: 9px 14px calc(20px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  color: var(--app-ink);
  box-shadow: 0 -18px 55px rgba(4, 22, 31, .28);
}

.wcr-app-tools-dialog::backdrop {
  background: rgba(3, 18, 26, .6);
  backdrop-filter: blur(3px);
}

.wcr-app-tools-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: #cad7dc;
}

.wcr-app-tools-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 14px;
}

.wcr-app-tools-dialog header p,
.wcr-app-tools-dialog header h2 {
  margin: 0;
}

.wcr-app-tools-dialog header p {
  color: #087f93;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
}

.wcr-app-tools-dialog header h2 {
  font-size: 27px;
}

.wcr-app-tools-close {
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--app-line);
  border-radius: 50%;
  background: #f1f6f8;
  font-size: 25px;
}

.wcr-app-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 54dvh;
  padding: 2px;
  overflow-y: auto;
}

.wcr-app-tool {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  background: #fff;
  color: var(--app-ink);
  text-align: left;
}

.wcr-app-tool > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: #e6f8fb;
  color: #087d90;
  font-weight: 800;
}

.wcr-app-tool[data-tone="2"] > span { background: #f2edfb; color: #624590; }
.wcr-app-tool[data-tone="3"] > span { background: #fff3d7; color: #765914; }
.wcr-app-tool[data-tone="4"] > span { background: #eaf3ff; color: #315d8c; }
.wcr-app-tool[data-tone="5"] > span { background: #e9f8ef; color: #28704a; }
.wcr-app-tool[data-tone="6"] > span { background: #fff0e5; color: #81502b; }

.wcr-app-tool strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
}

.wcr-app-tools-signout {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 1px solid #efb6ba;
  border-radius: 14px;
  background: #fff2f3;
  color: #962f37;
  font-weight: 800;
}

.wcr-app-shell .login-shell {
  display: grid;
  min-height: calc(100dvh - 44px);
  padding: 18px 14px calc(90px + env(safe-area-inset-bottom));
  place-items: center;
  background: linear-gradient(155deg, #071c27 0%, #0c4153 100%);
}

.wcr-app-shell .login-intro {
  display: none;
}

.wcr-app-shell .login-card {
  width: min(100%, 470px);
  padding: 24px 20px;
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}

.wcr-app-shell .login-card input,
.wcr-app-shell .login-card button {
  min-height: 52px;
  border-radius: 14px;
}

@media (min-width: 700px) {
  .wcr-app-shell .wcr-member-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wcr-app-shell .wcr-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(180px, .4fr);
  }

  .wcr-app-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Keep every authorised section directly visible in the installed app. */
.wcr-app-shell .wcr-head {
  min-height: 0;
  padding: 18px 14px 16px;
}

.wcr-app-shell .wcr-title {
  width: 100%;
}

.wcr-app-shell .wcr-head-actions {
  position: static;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  height: auto;
  margin-top: 15px;
  gap: 8px;
}

.wcr-app-shell .wcr-head-actions > [hidden] {
  display: none !important;
}

.wcr-app-shell .wcr-head-actions > :not([hidden]) {
  position: static !important;
  display: flex !important;
  grid-column: auto !important;
  grid-row: auto !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-width: 0;
  height: 46px !important;
  min-height: 46px !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 7px 9px !important;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 13px;
  background: rgba(255,255,255,.11);
  color: #fff;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  backdrop-filter: blur(8px);
}

.wcr-app-shell .wcr-head-actions > :not([hidden]):active {
  transform: scale(.98);
  background: rgba(255,255,255,.2);
}

@media (min-width: 700px) {
  .wcr-app-shell .wcr-head-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Installed app only: keep all seven calendar days visible in phone portrait. */
@media (max-width: 600px) and (orientation: portrait) {
  .wcr-app-shell .wcr-events-dialog .wcr-calendar-canvas {
    width: 100%;
    overflow: hidden;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-weekday {
    min-width: 0;
    padding: 6px 1px;
    font-size: 8px;
    letter-spacing: 0;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-day {
    min-width: 0;
    min-height: 96px;
    padding: 3px 2px;
    overflow: hidden;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-date {
    margin-bottom: 3px;
    font-size: 10px;
    line-height: 1;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-event {
    display: block !important;
    width: 100%;
    min-width: 0;
    margin: 3px 0;
    padding: 3px 2px;
    border-left-width: 2px;
    line-height: 1.12;
    writing-mode: horizontal-tb !important;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-event-icon,
  .wcr-app-shell .wcr-events-dialog .wcr-cal-edit {
    display: none !important;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-event-copy {
    display: block;
    min-width: 0;
    max-height: 4.6em;
    overflow: hidden;
    color: #123f50;
    font-size: 7.5px;
    font-weight: 800;
    line-height: 1.15;
    text-align: left;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    writing-mode: horizontal-tb !important;
  }

  .wcr-app-shell .wcr-events-dialog .wcr-cal-event time {
    display: block;
    margin-bottom: 1px;
    font-size: 7px;
    line-height: 1;
    white-space: nowrap;
  }
}
