.webapp-login {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  margin: 0;
  padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #0e1116;
  color: #eef0f3;
  color-scheme: dark;
  font: 16px/1.4 'Segoe UI', system-ui, sans-serif;
}
.webapp-login-card {
  box-sizing: border-box;
  width: min(100%, 360px);
  padding: 25px;
  background: #171b21;
  border: 1px solid #2c3440;
  border-radius: 14px;
}
.webapp-login-card h1 { margin: 8px 0 22px; font-size: 1.45rem; }
.webapp-login-card form, .webapp-login-card label { display: grid; gap: 9px; }
.webapp-login-card input, .webapp-login-card button {
  box-sizing: border-box;
  min-height: 46px;
  width: 100%;
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
}
.webapp-login-card input { background: #101318; color: inherit; border: 1px solid #495262; }
.webapp-login-card button { background: #e7b769; color: #17130d; border: 0; font-weight: 700; cursor: pointer; }
.webapp-login-card [role=alert] { margin: 0; color: #ff9aa5; }

.webapp-viewer {
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.webapp-viewer :is(#open-mt5, #open-telegram), .webapp-viewer .mobile-draw-tools { display: none; }

@media (max-width: 650px), (pointer: coarse) and (max-height: 600px) {
  .webapp-viewer .topbar { height: 49px; padding: 0 8px; gap: 8px; }
  .webapp-viewer :is(.top-divider, .symbol-search kbd, #mode-label, .statusbar .bars-label, .statusbar svg) { display: none; }
  .webapp-viewer .statusbar { min-height: 23px; padding: 2px 6px; gap: 6px; font-size: .64rem; }
  .webapp-viewer .statusbar > span:first-child, .webapp-viewer #source-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .webapp-viewer .statusbar a { flex: none; white-space: nowrap; }
  .webapp-viewer .top-end { gap: 4px; }
  .webapp-viewer .symbol-search { min-width: 0; min-height: 40px; padding-inline: 7px; white-space: nowrap; }
  .webapp-viewer .top-end :is(button, .icon-button) { min-height: 40px; }
  .webapp-viewer .workspace { --workspace-gutter: 0px; --workspace-top: 0px; padding: 0; }
  .webapp-viewer .chart-card { --draw-toolbar-width: 0px; border: 0; border-radius: 0; }
  .webapp-viewer .chart-toolbar { padding: 2px 7px 5px; gap: 3px 5px; justify-content: flex-start; }
  .webapp-viewer .frame-list { flex: 1 0 100%; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .webapp-viewer .frame-list button { flex: 1 0 auto; min-height: 37px; }
  .webapp-viewer .chart-toolbar-status { flex: 1 0 100%; flex-wrap: nowrap; justify-content: flex-start; order: 1; }
  .webapp-viewer .session-clock, .webapp-viewer .calendar-alert { padding: 4px 6px; gap: 4px; font-size: .71rem; }
  .webapp-viewer .calendar-alert { min-height: 30px; margin-left: auto; max-width: none; }
  .webapp-viewer .chart-view-actions { margin-left: auto; gap: 2px; }
  .webapp-viewer .chart-toolbar :is(.toolbar-button, .icon-button, .chart-select) { min-height: 40px; }
  .webapp-viewer .chart-toolbar .icon-button { width: 38px; }
  .webapp-viewer .chart-select { padding: 0 3px; gap: 4px; }
  .webapp-viewer .chart-select select { font-size: 16px; min-height: 40px; }
  .webapp-viewer .chart-select > span:first-child { display: none; }
  .webapp-viewer .chart-select select:has(option:checked:is([value=volume], [value=footprint])) { width: 107px; }
  .webapp-viewer .toolbar-divider, .webapp-viewer #open-indicators > span:last-child { display: none; }
  .webapp-viewer #open-indicators { width: 36px; }
  .webapp-viewer .chart-body { flex-direction: column; }
  .webapp-viewer .mobile-draw-tools { display: inline-flex; }
  .webapp-viewer .draw-toolbar { display: none; }
  .webapp-viewer[data-tools-open] .draw-toolbar {
    display: flex;
    width: 100%;
    flex-direction: row;
    overflow: auto hidden;
    padding: 3px 6px;
    gap: 4px;
    border: 0;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }
  .webapp-viewer .draw-toolbar .icon-button { width: 40px; height: 40px; }
  .webapp-viewer .draw-divider { width: 1px; height: 22px; margin: 0 1px; }
  .webapp-viewer .drawing-options { flex-wrap: wrap; max-width: calc(100% - 12px); }
  .webapp-viewer .drawing-options button { min-height: 32px; }
  .webapp-viewer .calendar-strip { position: relative; }
  .webapp-viewer .calendar-action { position: absolute; z-index: 2; inset: 0 0 0 auto; width: 40px; background: var(--panel); }
  .webapp-viewer .calendar-action .icon-button { width: 40px; height: 32px; }
  .webapp-viewer .chart-footer { min-height: 38px; height: auto; gap: 2px; padding-inline: 5px; }
  .webapp-viewer .chart-footer button { min-height: 36px; }
  .webapp-viewer .clock { font-size: .63rem; }
  .webapp-viewer .dialog { max-height: calc(100dvh - 32px); max-width: calc(100vw - 16px); }
  .webapp-viewer .dialog :is(input:not([type=checkbox]):not([type=range]), select, textarea) { font-size: 16px; }
}

@media (max-width: 365px) {
  .webapp-viewer .connection span { display: none; }
  .webapp-viewer .chart-footer .clock { display: none; }
  .webapp-viewer .chart-toolbar { column-gap: 3px; }
  .webapp-viewer .chart-toolbar .icon-button { width: 36px; }
  .webapp-viewer .chart-select select:has(option:checked:is([value=volume], [value=footprint])) { width: 83px; text-overflow: ellipsis; }
}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  .webapp-viewer .chart-toolbar .frame-list { flex-basis: auto; }
  .webapp-viewer .chart-toolbar-status { flex-basis: 100%; }
}
