/* Exact application shell transferred from design/CdApp.dc.html. */
:root {
  --cdx-chrome: #0e0f12;
  --cdx-ink: #15171c;
  --cdx-text-3: #5b616e;
  --cdx-muted-icon: #8a909c;
  --cdx-page: #f4f5f7;
  --cdx-line: #e6e8ec;
  --cdx-control: #dcdfE4;
  --cdx-red: #e3202b;
  --cdx-red-on-dark: #ff3b44;
  --cdx-scrim: rgba(14, 15, 18, .5);
  --cdx-safe-bottom: max(20px, env(safe-area-inset-bottom));
  --cdx-shell-width: 480px;
  --cdx-content-scale: 1;
}

body.cdx-shell-ready {
  --cdx-header-space:calc(56px + env(safe-area-inset-top));
  --cdx-subheader-space:0px;
  --cdx-tab-space:calc(62px + var(--cdx-safe-bottom));
  --cdx-connection-space:0px;
  --cdx-content-height:calc(100dvh - var(--cdx-header-space) - var(--cdx-subheader-space) - var(--cdx-tab-space) - var(--cdx-connection-space));
  margin: 0;
  min-width: 0;
  background: #e9ebef;
  color: var(--cdx-ink);
  font: 400 16px/21px "Golos Text", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.cdx-shell-ready.cdx-has-subheader{--cdx-subheader-space:52px}
body.cdx-shell-ready.cdx-no-header{--cdx-header-space:0px}
body.cdx-shell-ready.cdx-no-tabs{--cdx-tab-space:0px}
body.cdx-shell-ready:has(#connectionBanner:not([hidden])){--cdx-connection-space:56px}
.cdx-shell-ready:not(.cdx-chat) #app,.cdx-shell-ready:not(.cdx-chat) #app>.view{min-height:var(--cdx-content-height)}

.cdx-shell-ready .shell {
  width: min(100%, var(--cdx-shell-width));
  min-height: 100dvh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  overflow: clip;
  background: var(--cdx-page);
  box-shadow: none;
}

/* 56 px source header: fixed 96 / 1fr / 96 composition. */
.cdx-shell-ready .topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 20);
  flex: 0 0 calc(56px + env(safe-area-inset-top));
  width: 100%;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  align-items: center;
  border: 0;
  background: var(--cdx-chrome);
  color: #fff;
  box-sizing: border-box;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.cdx-shell-ready .topbar > #openProfile { justify-self: start; }
.cdx-shell-ready .topbar .brand {
  position: static;
  left: auto;
  justify-self: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transform: none;
}
.cdx-shell-ready .brand-logo { display: block; width: 88.29px; height: 30px; }
.cdx-shell-ready .topbar-actions {
  justify-self: end;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}
.cdx-shell-ready .connection { display: none; }
.cdx-shell-ready .topbar .header-icon {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #fff;
}
.cdx-shell-ready .topbar .header-icon:active { background: #202328; }
.cdx-shell-ready .topbar .header-icon .ui-icon { width: 24px; height: 24px; }
.cdx-shell-ready .cdx-notification-badge {
  position: absolute;
  top: 6px;
  right: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--cdx-chrome);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: var(--cdx-red);
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cdx-shell-ready #connectionBanner { flex:0 0 56px;min-height:56px;box-sizing:border-box;display:flex;align-items:center;gap:10px;padding:10px 16px;border:0;border-radius:0;background:#2A2D33;color:#fff;font-size:13px;line-height:18px; }
.cdx-shell-ready #connectionBanner[hidden] {display:none;}
.cdx-shell-ready #connectionBanner :is(.icon,.ui-icon) {width:20px;height:20px;flex:0 0 20px;}
.cdx-shell-ready main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 calc(62px + var(--cdx-safe-bottom));
  background: var(--cdx-page);
}

/* Source subheader, created once by exact-shell.js. */
.cdx-shell-ready .cdx-subheader {
  flex: 0 0 52px;
  min-height: 52px;
  padding: 4px 16px 4px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--cdx-line);
  background: #fff;
}
.cdx-shell-ready .cdx-subheader[hidden] { display: none; }
.cdx-shell-ready .cdx-subheader__back {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--cdx-ink);
}
.cdx-shell-ready .cdx-subheader__back .ui-icon { width: 24px; height: 24px; }
.cdx-shell-ready .cdx-subheader__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--cdx-ink);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cdx-shell-ready.cdx-has-subheader #app > .view > :is(.page-head, .cd-page-head, .detail-head),
.cdx-shell-ready.cdx-has-subheader #app > .view > :is(.wizard-top, .add-intro--with-back) {
  display: none;
}

/* 62 px source tab bar plus the real device safe area. */
.cdx-shell-ready .tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: var(--z-nav, 30);
  width: min(100%, var(--cdx-shell-width));
  height: calc(62px + var(--cdx-safe-bottom));
  margin-inline: auto;
  padding: 0 0 var(--cdx-safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  box-sizing: border-box;
  border: 0;
  background: var(--cdx-chrome);
  box-shadow: none;
  transform: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.cdx-shell-ready .tabbar a {
  width: auto;
  min-width: 0;
  min-height: 62px;
  height: 62px;
  margin: 0;
  padding: 0 2px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: #c9ccd2;
  font-size: 11px;
  line-height: 13px;
  font-weight: 500;
  text-decoration: none;
}
.cdx-shell-ready .tabbar a:active { background: #202328; }
.cdx-shell-ready .tabbar a.active,
.cdx-shell-ready .tabbar a[aria-current="page"] {
  background: transparent;
  color: var(--cdx-red-on-dark);
  font-weight: 600;
}
.cdx-shell-ready .tabbar a::before,
.cdx-shell-ready .tabbar a::after { display: none !important; }
.cdx-shell-ready .tabbar .ui-icon { width: 24px; height: 24px; }
.cdx-shell-ready .tabbar .add-tab { margin: 0; }
.cdx-shell-ready .tabbar .add-orb {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}
.cdx-shell-ready .tabbar .add-orb .ui-icon { width: 30px; height: 30px; }

.cdx-shell-ready:not(.cdx-authenticated) .topbar {
  display: flex;
  justify-content: center;
}
.cdx-shell-ready:not(.cdx-authenticated) .topbar > .header-icon,
.cdx-shell-ready:not(.cdx-authenticated) .topbar-actions,
.cdx-shell-ready:not(.cdx-authenticated) .tabbar { display: none; }
.cdx-shell-ready:not(.cdx-authenticated) main { padding-bottom: 0; }

/* Source Add sheet. Existing IDs/data attributes remain the event contract. */
.cdx-shell-ready .add-sheet {
  inset: auto 0 0;
  width: min(100%, var(--cdx-shell-width));
  max-width: none;
  max-height: calc(100dvh - 56px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: transparent;
  overflow: auto;
}
.cdx-shell-ready .add-sheet::backdrop { background: var(--cdx-scrim); }
.cdx-shell-ready .add-sheet[open] { animation: cdx-sheet-in 200ms ease-out; }
.cdx-shell-ready .add-sheet__card {
  padding: 8px 16px calc(36px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}
.cdx-shell-ready .add-sheet__handle {
  align-self: center;
  width: 36px;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  background: #cdd1d8;
}
.cdx-shell-ready .add-sheet__head { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cdx-shell-ready .add-sheet__head h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 700; }
.cdx-shell-ready .add-sheet__head .icon-button { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; margin-right: -10px; padding: 0; border: 0; border-radius: 22px; display: grid; place-items: center; background: transparent; color: var(--cdx-ink); }
.cdx-shell-ready .add-sheet__head .ui-icon { width: 24px; height: 24px; }
.cdx-shell-ready .add-sheet__photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cdx-shell-ready .add-sheet__photo {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--cdx-control);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  background: #fff;
  color: var(--cdx-ink);
  font-size: 15px;
  line-height: 19px;
  font-weight: 600;
  text-align: left;
}
.cdx-shell-ready .add-sheet__photo:first-child { border: 0; background: var(--cdx-red); color: #fff; }
.cdx-shell-ready .add-sheet__photo .ui-icon { width: 28px; height: 28px; }
.cdx-shell-ready .add-sheet__rows { display: flex; flex-direction: column; gap: 1px; overflow: hidden; border: 1px solid var(--cdx-line); border-radius: 12px; background: var(--cdx-line); }
.cdx-shell-ready .add-sheet__row {
  width: 100%;
  min-height: 56px;
  padding: 8px 16px 8px 12px;
  border: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: var(--cdx-ink);
  text-align: left;
}
.cdx-shell-ready .cdx-add-row-icon { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--cdx-page); }
.cdx-shell-ready .cdx-add-row-icon .ui-icon { width: 22px; height: 22px; }
.cdx-shell-ready .add-sheet__row > span:not(.cdx-add-row-icon) { flex: 1; min-width: 0; }
.cdx-shell-ready .add-sheet__row strong { display: block; font-size: 16px; line-height: 21px; font-weight: 500; }
.cdx-shell-ready .add-sheet__row small { display: block; margin-top: 2px; color: var(--cdx-text-3); font-size: 13px; line-height: 17px; }
.cdx-shell-ready .add-sheet__row > .ui-icon:last-child { width: 20px; height: 20px; color: var(--cdx-muted-icon); }
.cdx-shell-ready .add-sheet__note { display: none; }

/* Shared toast and dialog primitives from the source shell. */
.cdx-shell-ready .toast-stack {
  position: fixed;
  inset: auto 12px calc(70px + var(--cdx-safe-bottom));
  z-index: var(--z-toast, 70);
  width: auto;
  max-width: 456px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cdx-shell-ready .toast {
  min-height: 52px;
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  background: var(--cdx-ink);
  color: #fff;
  font-size: 14px;
  line-height: 19px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: cdx-toast-in 200ms ease-out;
}
.cdx-shell-ready dialog:not(.add-sheet):not(.cd-flow-sheet):not(.picker-dialog):not(.image-viewer) { width: min(340px, calc(100% - 48px)); max-height: calc(100dvh - 48px); border: 0; padding: 0; background: transparent; }
.cdx-shell-ready dialog::backdrop { background: var(--cdx-scrim); }
.cdx-shell-ready .dialog-card { padding: 20px; border-radius: 16px; display: flex; flex-direction: column; gap: 16px; background: #fff; box-shadow: none; }
.cdx-shell-ready .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cdx-shell-ready .dialog-head h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 700; }

@keyframes cdx-sheet-in { from { transform: translateY(24px); } to { transform: translateY(0); } }
@keyframes cdx-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .cdx-shell-ready *, .cdx-shell-ready *::before, .cdx-shell-ready *::after { animation-duration: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
}

.cdx-shell-ready.cdx-no-tabs .tabbar { display:none; }
.cdx-shell-ready.cdx-no-tabs main { padding-bottom:0; }
.cdx-shell-ready.cdx-no-header .topbar { display:none; }

/* Source sheets are above all navigation; legacy nav and sheets shared z=30. */
.cdx-shell-ready :is(.exact-plan-sheet,.exact-plan-overlay,.exact-history-sheet,.exact-history-delete) { z-index:60; }

/* S02 city sheet uses source dimensions, with native dialog focus isolation. */
.cdx-shell-ready #cityPickerDialog { width:min(100%,480px);max-width:480px;max-height:80dvh;margin:auto auto 0;padding:0;border:0;border-radius:20px 20px 0 0;background:#fff; }
.cdx-shell-ready #cityPickerDialog > div {display:flex;flex-direction:column;gap:12px;padding:8px 16px max(32px,env(safe-area-inset-bottom));max-height:80dvh;box-sizing:border-box;}
.cdx-shell-ready #cityPickerDialog .cd-sheet-handle {width:36px;height:4px;border-radius:2px;background:#CDD1D8;align-self:center;flex:none;margin:0;}
.cdx-shell-ready #cityPickerDialog .dialog-head h2 {font-size:20px;line-height:26px;}
.cdx-shell-ready #cityPickerDialog .icon-button {width:44px;height:44px;padding:0;display:grid;place-items:center;border:0;background:transparent;color:#15171C;}
.cdx-shell-ready #cityPickerDialog .cdx-city-search {position:relative;display:flex;margin:0;}
.cdx-shell-ready #cityPickerDialog [data-city-search-icon] {position:absolute;left:12px;top:14px;color:#5B616E;}
.cdx-shell-ready #cityPickerDialog [data-city-search-icon] .ui-icon {width:20px;height:20px;}
.cdx-shell-ready #citySearch {width:100%;min-width:0;height:48px;padding:0 14px 0 42px;border-radius:10px;border:1px solid #CDD1D8;font:inherit;font-size:16px;background:white;}
.cdx-shell-ready #cityPickerDialog [data-city-list] {min-height:0;overflow:auto;display:flex;flex-direction:column;}
.cdx-shell-ready #cityPickerDialog .cd-city-option {flex:none;display:flex;align-items:center;gap:12px;min-height:52px;padding:0 4px;border:0;border-bottom:1px solid #EEF0F3;background:white;text-align:left;font:inherit;font-size:16px;color:#15171C;}
.cdx-shell-ready #cityPickerDialog .cd-city-option span {flex:1;min-width:0;}
.cdx-shell-ready #cityPickerDialog .cd-city-option .ui-icon {width:22px;height:22px;color:#E3202B;}
.cdx-shell-ready #cityPickerDialog [data-geolocate-city] {flex:none;height:48px;display:flex;align-items:center;justify-content:center;gap:8px;border:1px solid #CDD1D8;border-radius:12px;background:#fff;font:600 15px/20px 'Golos Text',sans-serif;color:#15171C;}
.cdx-shell-ready #cityPickerDialog [data-city-pin-icon] .ui-icon {width:20px;height:20px;}
.cdx-shell-ready #cityPickerDialog [data-form-error]:empty {display:none;}

.cdx-shell-ready :is(.exact-plan-dialog,.exact-history-dialog) {z-index:60;}
.cdx-shell-ready #confirmDialog .dialog-head button {display:none;}
.cdx-shell-ready #confirmDialog .dialog-actions {display:flex;flex-direction:column-reverse;gap:8px;margin:0;}
.cdx-shell-ready :is(#confirmDialog,#accountDeleteDialog) .button {width:100%;height:48px;min-height:48px;padding:0 12px;border-radius:12px;font:600 16px/21px 'Golos Text',sans-serif;}
.cdx-shell-ready #confirmDialog[data-tone="dark"] [value="confirm"] {background:#0E0F12;border-color:#0E0F12;color:white;}
.cdx-shell-ready :is(#confirmDialog,#accountDeleteDialog) p {margin:0;font:400 15px/21px 'Golos Text',sans-serif;}
.cdx-shell-ready #accountDeleteDialog label {display:flex;flex-direction:column;gap:6px;font-size:14px;line-height:18px;}
.cdx-shell-ready #accountDeleteDialog input {height:48px;padding:0 14px;border:1px solid #CDD1D8;border-radius:10px;font:inherit;font-size:16px;}
.cdx-shell-ready :is(#confirmDialog,#accountDeleteDialog)::backdrop {background:rgba(14,15,18,.55);}

/* CdApp toast: source icon, wrapping text, and real six-second Undo action. */
.cdx-shell-ready .toast { padding:8px 8px 8px 16px; }
.cdx-shell-ready .toast__icon { display:flex;flex:0 0 20px;width:20px;height:20px;color:#5FD39A; }
.cdx-shell-ready .toast__icon svg {width:20px;height:20px;}
.cdx-shell-ready .toast__icon--err {color:#FF8A8F;}
.cdx-shell-ready .toast__icon--info {color:#C9CCD2;}
.cdx-shell-ready .toast__text {flex:1;min-width:0;overflow-wrap:anywhere;}
.cdx-shell-ready .toast__action {height:44px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:#FF8A8F;font:600 14px "Golos Text",system-ui,sans-serif;flex:0 0 auto;}
.cdx-no-tabs .toast-stack {bottom:calc(8px + var(--cdx-safe-bottom));}

.cdx-shell-ready #sessionExpiredDialog p {margin:0;color:#3A3F4A;font:400 15px/21px "Golos Text",system-ui,sans-serif;}
.cdx-shell-ready #sessionExpiredDialog [data-session-login] {height:52px;border:0;border-radius:12px;background:#E3202B;color:#fff;font:600 16px "Golos Text",system-ui,sans-serif;}

.cdx-shell-ready.cdx-chat main {padding-bottom:0;}

/* X01 scales the scrollable family content while shell chrome remains fixed. */
.cdx-shell-ready.cdx-large-text #app {zoom:var(--cdx-content-scale);}

/* Preserve source dimensions at narrow widths and make low-height sheets scrollable. */
@media (max-height: 700px) {
  .cdx-shell-ready .add-sheet {max-height:calc(100dvh - 12px);overscroll-behavior:contain;}
  .cdx-shell-ready dialog:not(.add-sheet):not(.cd-flow-sheet):not(.picker-dialog):not(.image-viewer) {max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;}
}
@media (max-width:359px){body.cdx-shell-ready:has(#connectionBanner:not([hidden])){--cdx-connection-space:74px}.cdx-shell-ready #connectionBanner{flex-basis:74px;min-height:74px}}
