/* Mobile-first app shell — same color tokens, different layout */

.app-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 0;
}
.app-brand-logo {
  height: 30px;
  width: auto;
  display: block;
}

.top-bar {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
/* RTL: ستون ۱ راست، ۲ وسط، ۳ چپ */
.top-bar > .theme-switch {
  grid-column: 1 !important;
  justify-self: start !important;
}
.top-bar > .app-brand {
  grid-column: 2 !important;
  justify-self: center !important;
}
.top-bar > .top-account {
  grid-column: 3 !important;
  justify-self: end !important;
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.theme-switch-icons {
  display: inline-grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
}
.theme-switch-icons .theme-opt {
  width: 34px;
  height: 32px;
  padding: 0 !important;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.top-connect-btn {
  border: 1px solid rgba(84, 210, 215, 0.35);
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary-dim);
  border-radius: 999px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.top-connect-btn:hover {
  border-color: rgba(84, 210, 215, 0.55);
  background: color-mix(in srgb, var(--primary) 24%, transparent);
}
.top-connect-btn.hidden { display: none !important; }

.top-account .tc-account { position: relative; }
.top-account .tc-account.hidden { display: none !important; }
.top-account .tc-account-menu {
  right: auto;
  left: 0;
}

html[data-theme="light"] .top-connect-btn {
  border-color: rgba(15, 124, 128, 0.28);
  background: rgba(15, 124, 128, 0.1);
  color: #0b5f62;
}

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(84, 210, 215, 0.28);
  background: rgba(84, 210, 215, 0.1);
}
.install-banner.hidden { display: none !important; }
.install-banner p {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.45;
}
.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.install-btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #003738;
  background: linear-gradient(135deg, #54d2d7, #2fb6bb);
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
}
.install-btn:hover {
  filter: brightness(1.05);
}
html[data-theme="light"] .install-btn {
  background: linear-gradient(135deg, #0f7c80, #0b5f62);
  color: #fff;
}
html[data-theme="light"] .install-banner {
  background: rgba(15, 124, 128, 0.1);
  border-color: rgba(15, 124, 128, 0.22);
}

.mobile-nav {
  display: none;
}

@media (max-width: 860px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
  }
  html,
  body {
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  /* iOS: فونت زیر ۱۶px روی فوکوس زوم می‌کند — برای همه فیلدها */
  input,
  textarea,
  select,
  .search,
  .note-modal-input,
  .journal-field input,
  .journal-field textarea,
  .journal-field select,
  .tc-link-form input,
  .tc-link-form textarea,
  .tc-otp-row input,
  .add-link-form input,
  .trade-modal-panel input,
  .trade-modal-panel textarea,
  .trade-modal-panel select {
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  .atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
  }

  .shell {
    position: relative;
    z-index: 1;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding:
      max(8px, env(safe-area-inset-top))
      10px
      calc(52px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 8px !important;
    overflow: hidden !important;
    animation: none !important;
    transform: none !important;
    display: flex;
    flex-direction: column;
  }

  .top-bar {
    position: relative;
    z-index: 20;
    flex: 0 0 auto;
    padding: 4px 0;
    background: transparent;
  }

  .app-brand-logo { height: 26px; }
  .theme-switch-icons .theme-opt {
    width: 32px;
    height: 30px;
    font-size: 14px;
  }
  .top-connect-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  .tc-account-btn { padding: 5px 9px; font-size: 11px; }

  .install-banner,
  .backup-banner,
  .today-note-banner,
  .update-banner,
  .status {
    flex: 0 0 auto;
  }

  .backup-banner {
    flex-wrap: wrap;
    padding: 8px 10px;
    border-color: rgba(84, 210, 215, 0.28) !important;
    background: rgba(84, 210, 215, 0.1) !important;
  }
  .backup-banner p {
    font-size: 11px;
    line-height: 1.45;
    color: var(--on-surface) !important;
  }
  .backup-banner .backup-connect {
    background: linear-gradient(135deg, #54d2d7, #2fb6bb) !important;
    color: #003738 !important;
    border-radius: 999px;
    font-size: 12px;
    padding: 7px 12px;
  }
  html[data-theme="light"] .backup-banner {
    background: rgba(15, 124, 128, 0.1) !important;
    border-color: rgba(15, 124, 128, 0.22) !important;
  }
  html[data-theme="light"] .backup-banner .backup-connect {
    background: linear-gradient(135deg, #0f7c80, #0b5f62) !important;
    color: #fff !important;
  }

  /* Single scroll surface */
  .workspace {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    align-items: stretch !important;
  }

  .left-col,
  .center-col,
  .market-sidebar {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #panel-home,
  .center-launch-row,
  .left-launch-row { display: none !important; }

  body[data-mobile-tab="market"] .center-col,
  body[data-mobile-tab="market"] .left-col { display: none !important; }
  body[data-mobile-tab="market"] .market-sidebar {
    display: block !important;
  }

  body[data-mobile-tab="calendar"] .market-sidebar,
  body[data-mobile-tab="calendar"] .left-col { display: none !important; }
  body[data-mobile-tab="calendar"] .workspace {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  body[data-mobile-tab="calendar"] .center-col {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  body[data-mobile-tab="calendar"] #panel-calendar {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }
  body[data-mobile-tab="calendar"] #panel-calendar .section-head,
  body[data-mobile-tab="calendar"] #panel-calendar .impact-filters,
  body[data-mobile-tab="calendar"] #panel-calendar .calendar-head {
    flex: 0 0 auto !important;
  }
  body[data-mobile-tab="calendar"] #panel-calendar .calendar-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    display: flex !important;
    flex-direction: column !important;
    align-content: flex-start !important;
  }
  body[data-mobile-tab="calendar"] #panel-calendar .calendar-list > .cal-row {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
  }
  body[data-mobile-tab="calendar"] #panel-calendar #calendar-empty,
  body[data-mobile-tab="calendar"] #panel-calendar .sk-cal {
    flex: 0 0 auto !important;
  }

  body[data-mobile-tab="journal"] .workspace { display: none !important; }

  .home-update-btn { display: none !important; }

  .hero-brand {
    justify-content: center;
    padding-top: 4px;
  }
  .hero-brand .logo { height: 36px; }
  .center-home {
    justify-content: flex-start;
    padding-top: 4px;
    gap: 12px;
    min-height: 0;
    overflow: visible;
  }

  /* Market: فقط لیست نمادها اسکرول شود */
  body[data-mobile-tab="market"] .workspace {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  body[data-mobile-tab="market"] .market-sidebar,
  body[data-mobile-tab="market"] .market-sidebar-inner,
  body[data-mobile-tab="market"] .main-panel,
  body[data-mobile-tab="market"] .market-board {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }
  body[data-mobile-tab="market"] .market-sidebar-head {
    flex: 0 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
  }
  body[data-mobile-tab="market"] .market-sidebar-head h3 {
    margin: 0;
    text-align: center;
    width: 100%;
  }
  body[data-mobile-tab="market"] .watch-cards {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    gap: 4px;
    padding-bottom: 8px;
  }

  .watch-cards {
    gap: 4px;
  }

  .watch-card {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    border-radius: 11px;
    gap: 8px !important;
    padding: 0 8px 0 34px !important;
    grid-template-columns: 26px minmax(0, 1fr) auto 30px !important;
  }
  .watch-card .card-logo { order: 1; width: 26px; height: 26px; }
  .watch-card .card-meta { order: 2; min-width: 0; }
  .watch-card .card-quote { order: 3; }
  .watch-card .card-chart {
    order: 4;
    width: 30px !important;
    height: 30px !important;
    border-radius: 9px;
    z-index: 5;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }
  .watch-card .card-remove {
    width: 20px;
    height: 20px;
    left: 6px;
    font-size: 14px;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translate(0, -50%) !important;
    z-index: 5;
  }
  .card-ticker { font-size: 12px !important; }
  .card-broker { font-size: 9px !important; }
  .card-price { font-size: 12px !important; }
  .card-change { font-size: 10px !important; padding: 1px 5px; }
  .watch-card.add-card {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 10px !important;
    grid-template-columns: none !important;
  }
  .add-card-plus { width: 24px; height: 24px; font-size: 18px; }

  /* ---- Compact calendar ---- */
  #panel-calendar.calendar-panel {
    gap: 8px;
    padding: 10px !important;
  }
  #panel-calendar .section-head {
    display: block !important;
    margin-bottom: 0;
  }
  #panel-calendar .section-tools,
  #panel-calendar .calendar-tools {
    width: 100%;
    display: grid !important;
    grid-template-columns: auto auto auto auto 1fr;
    align-items: center;
    gap: 6px;
  }
  #panel-calendar #cal-date-label {
    grid-column: 5;
    justify-self: end; /* فیزیکی چپ در RTL */
    margin: 0;
  }
  #panel-calendar #cal-prev,
  #panel-calendar #cal-next {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
  }
  #panel-calendar #cal-today,
  #panel-calendar #cal-pick-btn {
    border-radius: 999px;
    padding: 7px 12px;
  }
  #panel-calendar #cal-pick-btn {
    box-shadow: 0 6px 14px rgba(84, 210, 215, 0.28);
  }
  #panel-calendar .impact-filters {
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
  }
  #panel-calendar .filter-chip {
    padding: 5px 8px;
    font-size: 10px;
  }
  .calendar-head { display: none !important; }
  .calendar-list {
    gap: 8px !important;
  }
  .cal-row {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    height: auto !important;
    min-height: 58px !important;
    max-height: none !important;
    padding: 10px 10px !important;
    border-radius: 12px !important;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "time title currency"
      ". vals vals" !important;
    column-gap: 8px !important;
    row-gap: 4px !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
  .cal-row .time {
    grid-area: time;
    font-size: 11px !important;
    font-weight: 800;
    text-align: right !important;
    line-height: 1.2;
    align-self: center;
  }
  .cal-title {
    grid-area: title;
    font-size: 12px !important;
    font-weight: 650;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
  }
  .cal-currency {
    grid-area: currency;
    font-size: 11px !important;
    gap: 4px !important;
  }
  .cal-currency img {
    width: 16px !important;
    height: 16px !important;
  }
  .cal-row > .cal-num {
    display: none !important;
  }
  .cal-row .cal-vals {
    grid-area: vals;
    display: flex !important;
    flex-wrap: nowrap;
    gap: 8px !important;
    direction: ltr;
    padding-top: 2px;
    overflow: hidden;
    min-height: 16px;
  }
  .cal-row .cal-vals .cal-num {
    display: inline-flex !important;
    font-size: 10px !important;
    font-weight: 700;
    opacity: 0.9;
    white-space: nowrap;
  }
  .impact-inline {
    width: 6px !important;
    height: 6px !important;
    margin-left: 4px;
    vertical-align: middle;
  }

  /* ---- Fixed bottom nav (outside shell) ---- */
  .mobile-nav {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    z-index: 200 !important;
    width: 100% !important;
    margin: 0 !important;
    gap: 0;
    padding: 4px 6px 0;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-top: 1px solid var(--outline);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: none !important;
    /* iOS: بکش تا لبهٔ فیزیکی پایین */
    padding-left: max(6px, env(safe-area-inset-left, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
  }
  .mobile-nav-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    padding: 6px 2px 4px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-btn .mobile-nav-ico {
    font-size: 16px;
    line-height: 1;
    opacity: 0.9;
  }
  .mobile-nav-btn.active {
    color: var(--primary-dim);
    background: color-mix(in srgb, var(--primary) 18%, transparent);
  }

  /* ---- Journal: one scrollable page ---- */
  body.journal-mode {
    overflow: hidden !important;
    height: 100dvh !important;
  }
  body.journal-mode .shell {
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.journal-mode .install-banner,
  body.journal-mode .backup-banner {
    display: none !important;
  }
  body.journal-mode .top-bar {
    display: grid !important;
    flex: 0 0 auto;
  }
  .journal-screen {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 4px 0 0 !important;
    gap: 8px !important;
  }
  body.journal-mode .journal-screen:not(.hidden) {
    display: flex !important;
  }
  .journal-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .journal-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    flex: none !important;
    min-height: 0 !important;
    height: auto !important;
    gap: 10px !important;
  }
  .journal-trades,
  .journal-report {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
  }
  .journal-trade-list {
    max-height: none !important;
    overflow: visible !important;
    flex: none !important;
    gap: 4px !important;
    padding: 0 !important;
  }
  .journal-trade-card {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    grid-template-rows: auto !important;
    gap: 6px 8px !important;
    align-items: center !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
    min-height: 0 !important;
  }
  .journal-trade-card:hover { transform: none; }
  .journal-trade-card > div:last-child {
    grid-column: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 1px !important;
  }
  .journal-trade-side {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    font-size: 9px !important;
  }
  .journal-trade-symbol {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }
  .journal-trade-date {
    display: none !important;
  }
  .journal-trade-meta {
    margin-top: 1px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    gap: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
    max-width: 100%;
  }
  .journal-trade-tags {
    display: none !important;
  }
  .journal-trade-result {
    padding: 2px 6px !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
  }
  .journal-trade-pnl {
    margin-top: 0 !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }
  .journal-empty {
    padding: 16px 10px !important;
    font-size: 12px !important;
  }
  .journal-day-notes {
    overflow: visible !important;
    flex: none !important;
  }
  .journal-charts {
    grid-template-columns: 1fr !important;
  }
  .journal-top {
    position: relative;
    top: auto;
    z-index: 6;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px;
    width: 100%;
    padding: 4px 0 4px;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
  }
  .journal-top-main { display: none !important; }
  .journal-back { display: none !important; }
  /* RTL: دکمه‌ها راست، تاریخ چپ — روبروی هم */
  .journal-day-nav {
    order: 1;
    width: auto !important;
    flex: 0 0 auto !important;
    justify-content: flex-start;
    gap: 8px;
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
  }
  .journal-top > .journal-date-open {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    margin: 0 !important;
    text-align: left;
    align-items: flex-end;
  }
  .journal-top .journal-date-fa {
    font-size: 14px !important;
    line-height: 1.25;
  }
  .journal-top .journal-date-en {
    font-size: 10px !important;
    margin-top: 1px;
  }
  .journal-day-nav .secondary-btn,
  .journal-day-nav .primary-btn {
    flex: 0 0 auto;
    justify-content: center;
    border-radius: 999px !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  }
  html[data-theme="light"] .journal-day-nav .secondary-btn,
  html[data-theme="light"] .journal-day-nav .primary-btn {
    box-shadow: 0 6px 14px rgba(15, 40, 44, 0.12);
  }
  .journal-day-nav .primary-btn.tiny-save {
    box-shadow: 0 6px 16px rgba(84, 210, 215, 0.28);
  }
  html[data-theme="light"] .journal-day-nav .primary-btn.tiny-save {
    box-shadow: 0 6px 14px rgba(15, 124, 128, 0.22);
  }
  .journal-title { font-size: 18px !important; }
  .journal-date-row {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 8px;
  }
  .journal-date-main {
    width: 100%;
    align-items: center !important;
    justify-content: center;
  }
  .journal-scope-tabs {
    margin-inline: auto;
  }
  .journal-stats {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .journal-stat {
    min-width: 0;
    padding: 6px 8px;
  }
  .journal-stat span { font-size: 10px; }
  .journal-stat strong { font-size: 12px; }

  /* Chart fullscreen */
  body:has(#symbol-chart-modal:not(.hidden)) .mobile-nav {
    display: none !important;
  }
  .symbol-chart-modal {
    padding: 0 !important;
    align-items: stretch !important;
    z-index: 240 !important;
  }
  .symbol-chart-modal .symbol-chart-panel.modal-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: 0 !important;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom)) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    overflow: hidden !important;
  }
  .symbol-chart-modal .modal-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "heading close"
      "actions actions";
    align-items: start;
    gap: 6px 8px;
  }
  .symbol-chart-modal .chart-heading {
    grid-area: heading;
    min-width: 0;
  }
  .symbol-chart-modal .chart-head-actions {
    grid-area: actions;
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
  }
  .symbol-chart-modal #close-symbol-chart {
    grid-area: close;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    flex-shrink: 0;
    justify-self: start;
  }
  .symbol-chart-modal .chart-title-row {
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 6px 8px;
  }
  .symbol-chart-modal .chart-title-row h2 {
    font-size: 16px;
    margin: 0;
    white-space: nowrap;
  }
  .symbol-chart-modal .chart-last {
    font-size: 15px !important;
    white-space: nowrap;
  }
  .symbol-chart-modal .chart-change {
    font-size: 11px;
    padding: 2px 7px;
  }
  .symbol-chart-modal .chart-heading .side-label {
    margin-top: 2px;
    font-size: 10px;
    opacity: 0.8;
  }
  .symbol-chart-modal .dw-modes {
    padding: 2px !important;
    gap: 2px !important;
  }
  .symbol-chart-modal .dw-mode {
    padding: 5px 8px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    white-space: nowrap;
  }
  .symbol-chart-modal .chart-tf-modes,
  .symbol-chart-modal .chart-cal-modes {
    flex: 0 0 auto;
    width: 100%;
    justify-content: space-between;
  }
  .symbol-chart-modal .chart-cal-modes {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
  }
  .symbol-chart-modal .symbol-chart-stage {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    border-radius: 12px !important;
  }
  .symbol-chart-modal .chart-credit {
    font-size: 11px;
    padding: 2px 0;
  }

  .modal,
  .sheet-modal {
    padding: 0 !important;
    align-items: end !important;
    justify-items: stretch !important;
    place-items: end stretch !important;
    z-index: 230 !important;
  }
  .modal-panel {
    width: 100%;
    max-height: min(90dvh, 780px);
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #symbol-modal.sheet-modal .symbol-sheet-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: min(82dvh, 720px) !important;
    max-height: min(82dvh, 720px) !important;
    border-radius: 18px 18px 0 0 !important;
    margin: 0 !important;
    padding: 14px 14px max(14px, env(safe-area-inset-bottom, 0px)) !important;
    animation: modalUp .28s ease both;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    overscroll-behavior: contain;
    box-sizing: border-box !important;
  }
  #symbol-modal .modal-head,
  #symbol-modal .search,
  #symbol-modal .symbol-cats-panel {
    flex: 0 0 auto !important;
  }
  /* iOS: زیر زیر 16px → جلوگیری از زوم خودکار روی فوکوس */
  #symbol-modal #symbol-search.search {
    font-size: 16px !important;
    line-height: 1.35 !important;
    transform: translateZ(0);
  }
  #symbol-modal .symbol-results {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    gap: 4px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  #symbol-modal .watch-row,
  #symbol-modal .watch-row-compact {
    padding: 0 8px !important;
    min-height: 42px !important;
    height: 42px !important;
    max-height: 42px !important;
    border-radius: 11px !important;
    gap: 8px !important;
  }
  #symbol-modal .sym-main {
    gap: 8px !important;
    min-width: 0;
  }
  #symbol-modal .sym-main img {
    width: 26px !important;
    height: 26px !important;
  }
  #symbol-modal .sym-text .ticker {
    font-size: 12px !important;
    line-height: 1.2;
  }
  #symbol-modal .sym-text .desc {
    font-size: 9px !important;
    line-height: 1.2;
  }
  #symbol-modal .toggle-btn {
    padding: 5px 8px !important;
    font-size: 10px !important;
    border-radius: 8px !important;
  }
  .tc-link-panel {
    width: 100%;
    max-width: 100%;
  }
}

/* Landscape phone */
@media (max-width: 860px) and (orientation: landscape) {
  .shell {
    padding-top: max(4px, env(safe-area-inset-top)) !important;
    padding-bottom: calc(52px + env(safe-area-inset-bottom)) !important;
  }
  .mobile-nav {
    padding-top: 2px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-nav-btn {
    min-height: 40px;
    flex-direction: row;
    gap: 6px;
    font-size: 11px;
    padding: 4px 6px;
  }
  .mobile-nav-btn .mobile-nav-ico { font-size: 14px; }
  .cal-row {
    flex: 0 0 auto !important;
    min-height: 48px !important;
    grid-template-columns: 40px minmax(0, 1fr) auto minmax(120px, 0.8fr) !important;
    grid-template-areas: "time title currency vals" !important;
    padding: 8px 10px !important;
  }
  .cal-row .cal-vals { padding-top: 0; }
  .journal-stats {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 480px) {
  .shell { padding-inline: 8px !important; }
  .google-go { display: none; }
  .cal-title { -webkit-line-clamp: 1; }
}

html[data-theme="light"] .mobile-nav {
  background: rgba(247, 251, 251, 0.96);
  box-shadow: 0 -6px 20px rgba(15, 40, 44, 0.08);
}

@media (min-width: 861px) {
  .mobile-nav { display: none !important; }
  .install-banner { display: none !important; }
  .app-brand-logo { height: 32px; }
}
