:root {
  --bg: #0b1220;
  --bg2: #111b2e;
  --card: #17243a;
  --card2: #1d2d47;
  --line: #263a58;
  --text: #e8f0fb;
  --muted: #8ea4c2;
  --accent: #2f9bff;
  --accent2: #22d3a6;
  --danger: #ff5d6c;
  --warn: #ffb454;
  --radius: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
html[data-theme="light"] {
  --bg: #f3f7fc;
  --bg2: #e9eff8;
  --card: #ffffff;
  --card2: #edf3fa;
  --line: #d7e2ef;
  --text: #162235;
  --muted: #5e7088;
  --accent: #1f7fe8;
  --accent2: #0e9f7a;
  --danger: #d63c4c;
  --warn: #b7791f;
  --shadow: 0 10px 30px rgba(36, 55, 85, .12);
}
html[data-theme="light"] body {
  background: radial-gradient(1100px 520px at 80% -10%, #dbe9fb 0%, var(--bg) 55%) fixed;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #17325a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: 82px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
small { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 118px 82px;
  grid-template-rows: 1fr 1fr;
  height: 60px; min-height: 60px; max-height: 60px;
  gap: 0 12px; padding: 4px 12px;
  background: rgba(11, 18, 32, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.tb-logo { grid-column: 1; grid-row: 1 / 3; display: grid; place-items: center; }
.tb-identity { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.2; }
.tb-identity b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-identity small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tb-state { grid-column: 3; grid-row: 1 / 3; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding-right: 6px; line-height: 1.25; font-size: 10px; color: var(--muted); white-space: nowrap; }
.tb-state b { font-size: 11px; color: var(--text); }
#onlineState { color: var(--danger); }
#onlineState.online { color: var(--accent2); }
.tb-dd { grid-column: 4; grid-row: 1 / 3; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding-left: 10px; padding-right: 4px; border-left: 1px solid var(--line); line-height: 1; }
.tb-dd b { font-size: 21px; font-weight: 800; color: var(--warn); }
.tb-dd small { font-size: 9px; color: var(--muted); margin-top: 3px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: white; font-weight: 800; font-size: 11px;
  box-shadow: 0 4px 12px rgba(47, 155, 255, .3);
}
.logo.big { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.welcome, .activation { border-color: rgba(47,155,255,.35); }
.activation { border-color: rgba(255,180,84,.4); }
.token-progress { margin-top: 10px; }
.token-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.token-progress i.warn { background: var(--warn); }
.token-progress i.danger { background: var(--danger); }
.icon-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 12px;
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-size: 18px; line-height: 1;
}
.icon-btn:active { background: var(--card2); }

main { padding: 16px; max-width: 720px; margin: 0 auto; }
.screen { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.tab { display: flex; flex-direction: column; gap: 14px; width: 100%; }

.card {
  width: 100%;
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.idea-head > b { flex: 0 0 auto; }
.symbol-tabs { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; max-width: 68%; margin-left: auto; }
.symbol-tabs::-webkit-scrollbar { display: none; }
.symbol-tab { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.symbol-tab.active { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; border-color: transparent; }
.swipe-hint { margin: 7px 0 0; font-size: 10px; text-align: center; }
.symbol-anim { will-change: transform, opacity; }
.sym-out-left { animation: symOutLeft .08s ease forwards; }
.sym-out-right { animation: symOutRight .08s ease forwards; }
.sym-in-right { animation: symInRight .16s cubic-bezier(.2,.8,.2,1) both; }
.sym-in-left { animation: symInLeft .16s cubic-bezier(.2,.8,.2,1) both; }
.sym-out-pop { animation: symOutPop .07s ease forwards; }
.sym-in-pop { animation: symInPop .15s cubic-bezier(.2,.8,.2,1) both; }
@keyframes symOutLeft { to { opacity: 0; transform: translateX(-34px); } }
@keyframes symOutRight { to { opacity: 0; transform: translateX(34px); } }
@keyframes symInRight { from { opacity: 0; transform: translateX(38px); } to { opacity: 1; transform: translateX(0); } }
@keyframes symInLeft { from { opacity: 0; transform: translateX(-38px); } to { opacity: 1; transform: translateX(0); } }
@keyframes symOutPop { to { opacity: 0; transform: scale(.985); } }
@keyframes symInPop { from { opacity: 0; transform: scale(.975); } to { opacity: 1; transform: scale(1); } }
.card-actions { display: flex; gap: 6px; align-items: center; }
.card-actions button { padding: 6px 9px; font-size: 11px; }
.close-pos { width: 30px; height: 30px; padding: 0; border-radius: 6px; font-size: 18px; line-height: 1; background: rgba(255,93,108,.14); color: var(--danger); border: 1px solid rgba(255,93,108,.35); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric b { font-size: 22px; letter-spacing: .2px; }
.metric span { color: var(--muted); font-size: 12px; }

.hero { text-align: center; padding: 26px 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.hero h1 { font-size: 24px; margin: 6px 0 0; max-width: 100%; overflow-wrap: anywhere; }
.hero p { color: var(--muted); margin: 0; max-width: 420px; width: 100%; }

.form { display: flex; flex-direction: column; gap: 10px; }
label { font-size: 13px; color: var(--muted); }
input {
  width: 100%; padding: 13px 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(8, 14, 26, .75); color: var(--text);
  font-size: 16px; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 155, 255, .18); }
#loginPassword { margin-bottom: 10px; }
#registerPassword2 { margin-bottom: 10px; }
.token-copy { margin-top: 10px; width: 100%; }
.version-card { padding: 12px 14px; }
.version-card p { margin: 0; font-size: 12px; }
.version-card #updateAppBtn { margin-top: 8px; }
.setup-card { padding: 13px 14px; }
.setup-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.setup-step { display: flex; align-items: flex-start; gap: 9px; }
.setup-step > span { flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: rgba(47,155,255,.14); color: var(--accent); font-size: 11px; font-weight: 800; }
.setup-step b { display: block; font-size: 12px; line-height: 1.35; }
.setup-step small { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; margin-top: 2px; }
.support-sheet { max-height: 85vh; display: flex; flex-direction: column; }
.support-messages { flex: 1; min-height: 220px; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: rgba(3,8,16,.55); border: 1px solid rgba(142,164,194,.28); border-radius: 14px; box-shadow: inset 0 1px 0 rgba(255,255,255,.03); scrollbar-width: thin; scrollbar-color: rgba(142,164,194,.38) transparent; }
.support-msg { max-width: 88%; padding: 8px 10px; border-radius: 11px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.support-msg.user { align-self: flex-end; background: rgba(47,155,255,.2); border: 1px solid rgba(47,155,255,.3); }
.support-msg.admin { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); }
.support-form { display: flex; gap: 7px; padding-top: 8px; }
.support-form input { flex: 1; min-width: 0; }
.support-form button { flex: 0 0 auto; }
.link-btn { background: transparent; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; display: inline; }
.terms-text { max-height: 55vh; overflow-y: auto; padding-right: 4px; font-size: 12px; line-height: 1.5; scrollbar-width: thin; scrollbar-color: rgba(142, 164, 194, .38) transparent; }
.terms-text p { margin: 0 0 10px; }
.terms-text::-webkit-scrollbar { width: 3px; }
.terms-text::-webkit-scrollbar-thumb { background: rgba(142, 164, 194, .38); border-radius: 999px; }

button {
  border: 0; border-radius: 12px; padding: 12px 16px;
  font: inherit; font-weight: 700; cursor: pointer;
  color: var(--text); background: var(--card2);
  transition: transform .08s ease, filter .15s ease;
}
button:active { transform: scale(.98); }
button.primary { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; }
button.danger { background: rgba(255, 93, 108, .14); color: var(--danger); border: 1px solid rgba(255, 93, 108, .35); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 8px 12px; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }

.list { display: flex; flex-direction: column; gap: 10px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(8, 14, 26, .45); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px;
}
.row .left { display: flex; flex-direction: column; gap: 2px; }
.row.pos-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 10px; padding: 10px 12px; }
.pos-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.pos-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.pos-line-1 { justify-content: flex-start; }
.closed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.closed-main { min-width: 0; }
.closed-line1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.closed-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.closed-profit { flex: 0 0 auto; font-size: 14px; font-weight: 700; white-space: nowrap; }
.closed-profit.pos { color: var(--accent2); }
.closed-profit.neg { color: var(--danger); }

.pos-title { min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.pos-open { flex: 0 0 auto; font-size: 10px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.pos-profit-value { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.pos-line-2 { display: block; }
.pos-details { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-row .close-pos { align-self: stretch; height: auto; min-height: 0; width: 32px; font-size: 18px; }
.row .left b { font-size: 14px; }
.row .left small { font-size: 12px; }
.pill { font-size: 11px; padding: 4px 8px; border-radius: 999px; background: rgba(47, 155, 255, .15); color: #9fcbff; }
.pill.sell { background: rgba(255, 93, 108, .15); color: #ff9aa5; }
.pill.buy { background: rgba(34, 211, 166, .15); color: #7ff0d0; }
.pill.gray { background: rgba(142, 164, 194, .15); color: var(--muted); }

.badge { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: rgba(47, 155, 255, .15); color: #9fcbff; }
.badge.gray { background: rgba(142, 164, 194, .15); color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(38, 58, 88, .5); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

/* chat */
#tab-chat { min-height: calc(100vh - 190px); }
.chat-messages {
  flex: 1; min-height: 300px; max-height: calc(100vh - 300px);
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px 10px;
}
.msg { max-width: 86%; padding: 11px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #2f9bff, #6d7cff); color: #fff; border-bottom-right-radius: 5px; }
.msg.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg .meta { display: block; font-size: 10px; opacity: .7; margin-top: 4px; }
.msg strong { font-weight: 800; color: #fff; }
.msg em { font-style: italic; opacity: .95; }
.msg code { font-family: ui-monospace, monospace; font-size: 12px; background: rgba(255,255,255,.08); padding: 1px 4px; border-radius: 4px; }
.chat-form { display: flex; gap: 8px; align-items: center; }
.chat-form input { flex: 1; }
.chat-form button { width: 48px; height: 48px; padding: 0; font-size: 20px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.quick button { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; padding: 8px 11px; font-size: 13px; }
#tab-chat { height: calc(100dvh - 170px); min-height: 0; overflow: hidden; }
#tab-chat .chat-messages { flex: 1; min-height: 0; max-height: none; }
#tab-chat .quick { flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto; padding: 6px 0; scrollbar-width: thin; scrollbar-color: rgba(142, 164, 194, .35) transparent; }
#tab-chat .quick button { flex: 0 0 auto; white-space: nowrap; }
#tab-chat .quick::-webkit-scrollbar { height: 3px; }
#tab-chat .quick::-webkit-scrollbar-thumb { background: rgba(142, 164, 194, .35); border-radius: 999px; }
.quick-wrap { position: relative; flex: 0 0 auto; }
.quick-pair { color: var(--accent) !important; border-color: rgba(47,155,255,.45) !important; }
.chat-symbol-menu { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 40; width: 190px; max-height: 230px; overflow-y: auto; padding: 5px; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.35); scrollbar-width: thin; scrollbar-color: rgba(142, 164, 194, .38) transparent; }
.chat-symbol-menu button { width: 100%; text-align: left; padding: 9px 10px; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 8px; font-size: 12px; }
.chat-symbol-menu button.active { background: rgba(47,155,255,.15); border-color: rgba(47,155,255,.4); color: var(--accent); }
#tab-chat .chat-form { flex: 0 0 auto; padding-top: 6px; background: var(--bg); position: relative; z-index: 2; }
#tab-chat .token-bar, #tab-chat #chatActivation { flex: 0 0 auto; }

/* bottom nav */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(11, 18, 32, .94);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(14px);
}
.bottom button { 
  background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; padding: 6px 0;
}
.bottom button span { font-size: 18px; line-height: 1; }
.bottom button.active { color: var(--accent); }
.calendar-days { grid-template-columns: 1fr 1fr; }
.calendar-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: thin; scrollbar-color: rgba(142, 164, 194, .35) transparent; }
.calendar-chip { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.calendar-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#calendarList { max-height: 500px; overflow-y: auto; padding-right: 3px; scrollbar-width: thin; scrollbar-color: rgba(142, 164, 194, .38) transparent; }
#calendarList::-webkit-scrollbar { width: 3px; }
#calendarList::-webkit-scrollbar-thumb { background: rgba(142, 164, 194, .38); border-radius: 999px; }
.calendar-event { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.calendar-event:last-child { border-bottom: 0; }
.calendar-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.calendar-meta span:first-child { overflow: hidden; text-overflow: ellipsis; }
.calendar-stars { color: #ffcb3d; letter-spacing: 1px; font-size: 11px; flex: 0 0 auto; }
.calendar-event .name { font-size: 13px; line-height: 1.35; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(3, 7, 14, .66); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.sheet {
  width: 100%; max-width: 720px; max-height: 90vh; overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .6; } to { transform: translateY(0) scale(1); opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sheet-head h2 { margin: 2px 0 0; font-size: 22px; }
.idea-sheet { min-height: 260px; }
.idea-text { font-size: 16px; line-height: 1.55; margin: 18px 0 4px; white-space: pre-wrap; }
.dm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.dm-grid div { background: rgba(8, 14, 26, .55); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.dm-grid b { font-size: 16px; }
.dm-reason { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.dm-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dm-edit label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.dm-edit button { grid-column: 1 / -1; }
.dm-edit-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dm-edit-actions button { grid-column: auto; }
.dm-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.mode-switch { grid-template-columns: 1fr 1fr; }
.autopilot-split { display: grid; grid-template-columns: minmax(0, 1fr) 34px; border-radius: 10px; overflow: hidden; }
.autopilot-split button { border-radius: 0; padding: 10px 6px; font-size: 12px; }
.autopilot-split .autopilot-gear { border-left: 1px solid var(--line); font-size: 16px; padding: 0; }
.autopilot-split button.active, .autopilot-split .autopilot-gear.active { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--text); font-size: 13px; }
.check-row input { width: auto; }
.ap-pairs { margin: 4px 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card2); }
.pair-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pair-options label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.pair-options input { width: auto; }
html[data-theme="light"] .ap-pairs { background: #f4f8fc; }
#authTabs { grid-template-columns: repeat(2, 1fr); }
.segmented button { padding: 10px 6px; font-size: 12px; }
.segmented button.active { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; }
.two-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cmd-row { display: flex; gap: 8px; margin-top: 10px; }
.cmd-row input { flex: 1; min-width: 0; }
.cmd-row button { flex: 0 0 auto; }
.cmd-preview {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: rgba(47, 155, 255, .10); border: 1px solid rgba(47, 155, 255, .28);
}
.cmd-preview p { margin: 0 0 6px; font-size: 13px; }
.cmd-preview small { display: block; margin-bottom: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.field input, .field textarea { font-size: 14px; }
.field textarea { min-height: 90px; resize: vertical; }
.token-bar { background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; margin-bottom: 10px; }
.token-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.token-head b { color: var(--text); font-size: 13px; }
.token-bar .progress { height: 6px; background: #1e293b; border-radius: 4px; overflow: hidden; margin: 7px 0 5px; }
.token-bar .progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s; }
.token-bar .progress i.warn { background: #f59e0b; }
.token-bar .progress i.danger { background: #ef4444; }
.token-bar small { display: block; font-size: 11px; }
.news-analysis { font-size: 14px; line-height: 1.55; margin-bottom: 8px; }
.news-analysis b { font-weight: 500; }
.news-item .news-title { font-weight: 400; }
.news-more { width: 100%; height: 25px; padding: 0; margin-top: 8px; border-radius: 6px; font-size: 11px; }
.stack-actions { display: grid; gap: 8px; margin-top: 10px; }
.force-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.force-actions button { width: 100%; padding: 12px 8px; font-size: 14px; font-weight: 800; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.force-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.force-buy { background: rgba(34, 197, 94, .14); border: 1px solid rgba(34, 197, 94, .55); color: #4ade80; }
.force-sell { background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .55); color: #f87171; }
.force-actions button:disabled { opacity: .45; }
.idea-button-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; }
.idea-gear { padding: 0; font-size: 20px; line-height: 1; }
.settings-h { margin: 18px 0 8px; font-size: 14px; }
.idea-options { margin-top: 0; }
.idea-options.two { grid-template-columns: 1fr 1fr; }
.idea-options button.active { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; }
.snap-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.proof-img { display: block; width: 100%; max-height: 340px; object-fit: contain; margin-top: 8px; border-radius: 10px; border: 1px solid var(--line); background: #0a1322; }
.stats-periods { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-tile { background: var(--card2); border: 1px solid var(--line); border-radius: 11px; padding: 10px; min-height: 62px; }
.stat-tile small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .03em; }
.stat-tile b { display: block; font-size: 19px; margin-top: 3px; }
.stat-tile span { color: var(--muted); font-size: 11px; }
.stat-tile.good b { color: var(--accent2); }
.stat-tile.bad b { color: var(--danger); }
.stat-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .pos { color: var(--accent2); }
.stat-row .neg { color: var(--danger); }
.contest-card { border-color: rgba(255,180,84,.35); }
.contest-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 8px; }
.contest-rules div { background: rgba(255,180,84,.08); border: 1px solid rgba(255,180,84,.22); border-radius: 9px; padding: 7px 6px; min-width: 0; }
.contest-rules b { display: block; font-size: 12px; color: var(--warn); white-space: nowrap; }
.contest-rules small { display: block; color: var(--muted); font-size: 9px; line-height: 1.25; margin-top: 2px; }
.profit-card { padding: 12px; }
.profit-card .card-head { margin-bottom: 7px; }
.profit-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.profit-grid div { min-width: 0; }
.profit-grid small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .02em; }
.profit-grid b { display: block; font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profit-grid b.pos { color: var(--accent2); }
.profit-grid b.neg { color: var(--danger); }
html[data-theme="light"] .stat-tile { background: #f4f8fc; }
.action-msg { border-color: rgba(47, 155, 255, .4); }
.action-msg p { margin: 6px 0; }
.action-msg small { display: block; margin-bottom: 2px; }
.mini-select { width: auto; padding: 7px 9px; font-size: 12px; border-radius: 9px; }
.news-item { display: flex; flex-direction: column; gap: 3px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item .news-time { font-size: 11px; color: var(--muted); }
.news-item .news-title { font-size: 13px; }
.news-item .news-impact { font-size: 10px; padding: 2px 7px; border-radius: 999px; width: fit-content; background: rgba(255, 93, 108, .14); color: var(--danger); }
.news-empty { color: var(--muted); font-size: 13px; }
#newsList {
  height: 256px;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 164, 194, .38) transparent;
}
#newsList .news-item, #geoList .news-item, #geoList .news-analysis { flex: 0 0 auto; }
#geoList {
  height: 392px;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 164, 194, .38) transparent;
}
#newsList::-webkit-scrollbar, #geoList::-webkit-scrollbar { width: 3px; }
#newsList::-webkit-scrollbar-track, #geoList::-webkit-scrollbar-track { background: transparent; }
#newsList::-webkit-scrollbar-thumb, #geoList::-webkit-scrollbar-thumb { background: rgba(142, 164, 194, .38); border-radius: 999px; }
html[data-theme="light"] #newsList, html[data-theme="light"] #geoList { scrollbar-color: rgba(91, 111, 137, .35) transparent; }
html[data-theme="light"] #newsList::-webkit-scrollbar-thumb, html[data-theme="light"] #geoList::-webkit-scrollbar-thumb { background: rgba(91, 111, 137, .35); }
.symbol-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.symbol-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--muted); }
.symbol-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.symbol-chip.online { color: var(--text); }
.symbol-chip.online i { background: var(--accent2); }
.dm-chart {
  width: 100%; height: 210px; display: block; margin: 12px 0;
  background: #0a1322; border: 1px solid var(--line); border-radius: 12px;
}
.idea-proof { margin: 10px 0 4px; padding: 8px; border: 1px solid rgba(34,211,166,.35); border-radius: 12px; background: rgba(34,211,166,.06); }
.idea-proof-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.idea-proof-head b { color: #7ff0d0; font-weight: 600; }
.idea-proof-head small { color: var(--muted); }
.idea-view-switch { display: flex; justify-content: flex-end; }
#ideaViewToggle { padding: 4px 8px; font-size: 12px; }
#ideaProofImg { display: block; width: 100%; max-height: 260px; object-fit: contain; cursor: zoom-in; border-radius: 8px; background: #0a1322; }
html[data-theme="light"] .idea-proof { background: #eafaf5; border-color: #a7e3d3; }
html[data-theme="light"] .idea-proof-head b { color: #0b7f62; }
.dm-status {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
  background: rgba(34, 211, 166, .12); border: 1px solid rgba(34, 211, 166, .35);
  color: #7ff0d0; font-size: 13px;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: #0f1a2c; border: 1px solid var(--line); color: var(--text);
  padding: 11px 16px; border-radius: 12px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .2s ease; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
  .bottom { max-width: 720px; margin: 0 auto; border-radius: 18px 18px 0 0; }
}
html[data-theme="light"] .topbar,
html[data-theme="light"] .bottom { background: rgba(255, 255, 255, .94); }
html[data-theme="light"] input { background: #f7fafd; }
html[data-theme="light"] .dm-grid div { background: #f4f8fc; }
html[data-theme="light"] .dm-chart { background: #fff; }
html[data-theme="light"] .token-bar .progress { background: #e2e9f2; }
html[data-theme="light"] .toast { background: #fff; box-shadow: var(--shadow); }
html[data-theme="light"] .modal { background: rgba(20, 32, 48, .38); }
html[data-theme="light"] .news-impact { background: rgba(214, 60, 76, .1); }
html[data-theme="light"] .badge { background: #e7f0fd; color: #1f5f9e; }
html[data-theme="light"] .badge.gray { background: #edf1f6; color: #5e7088; }
html[data-theme="light"] .pill { background: #e7f0fd; color: #1f5f9e; }
html[data-theme="light"] .pill.sell { background: #fde9ec; color: #b42334; }
html[data-theme="light"] .pill.buy { background: #e5f7f0; color: #0b7f62; }
html[data-theme="light"] .dm-status { color: #0b7f62; }
html[data-theme="light"] .geo-meta {
  background: rgb(183, 121, 31) !important;
  border: 1px solid #9e691b !important;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
}
html[data-theme="light"] .geo-meta .badge { background: rgba(255, 255, 255, .18); color: #fff; }
html[data-theme="light"] .geo-meta small.muted { color: #fcffa7; }
html[data-theme="light"] #positions .row small.pos-small { color: #fff; }
html[data-theme="light"] .row {
  background: #f4f8fc;
  border-color: #d7e2ef;
  color: #17263d;
}
html[data-theme="light"] .row b,
html[data-theme="light"] .row .left b {
  color: #12233a;
}
html[data-theme="light"] .row small,
html[data-theme="light"] #positions .row small.pos-small {
  color: #5b6f89;
}
@media (max-width: 700px) {
  .topbar { gap: 0 10px; padding: 3px 12px; }
  .tb-identity b { font-size: 13px; }
  .tb-dd b { font-size: 19px; }
}

.auth-actions { display: flex; gap: 8px; }
.auth-actions button { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.auth-actions button.ghost { padding-left: 10px; padding-right: 10px; }

.bonus-carousel { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; touch-action: pan-x; padding: 2px 2px 10px; scrollbar-width: none; }
.bonus-carousel::-webkit-scrollbar { display: none; }
.bonus-slide { flex: 0 0 calc((100% - 52px) / 3); min-width: 0; scroll-snap-align: start; padding: 14px 12px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(47,155,255,.08), rgba(255,255,255,.018)); }
.bonus-slide b { display: block; color: var(--accent); font-size: 16px; letter-spacing: -.3px; margin-bottom: 7px; }
.bonus-slide small { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; }

.bonus-slide:nth-child(1) { background: linear-gradient(145deg, rgba(47,155,255,.20), rgba(47,155,255,.04)); }
.bonus-slide:nth-child(2) { background: linear-gradient(145deg, rgba(36,210,156,.20), rgba(36,210,156,.04)); }
.bonus-slide:nth-child(3) { background: linear-gradient(145deg, rgba(255,176,64,.20), rgba(255,176,64,.04)); }
.bonus-slide:nth-child(4) { background: linear-gradient(145deg, rgba(170,120,255,.20), rgba(170,120,255,.04)); }
.bonus-slide:nth-child(5) { background: linear-gradient(145deg, rgba(255,104,130,.20), rgba(255,104,130,.04)); }
html[data-theme="light"] .bonus-slide:nth-child(1) { background: linear-gradient(145deg, #e3f0ff, #f5faff); }
html[data-theme="light"] .bonus-slide:nth-child(2) { background: linear-gradient(145deg, #ddf7ee, #f5fffb); }
html[data-theme="light"] .bonus-slide:nth-child(3) { background: linear-gradient(145deg, #fff0d8, #fffbf3); }
html[data-theme="light"] .bonus-slide:nth-child(4) { background: linear-gradient(145deg, #efe8ff, #fbf8ff); }
html[data-theme="light"] .bonus-slide:nth-child(5) { background: linear-gradient(145deg, #ffe6eb, #fff8f9); }
.theme-choice { display: flex; gap: 8px; margin-top: 10px; }
.theme-choice button { flex: 1 1 0; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 10px; }
.theme-choice button.active { background: linear-gradient(135deg, var(--accent), #6d7cff); color: #fff; border-color: transparent; }

#autopilotSettingsModal .sheet { padding-bottom: 22px; }
.ap-select { appearance: none; -webkit-appearance: none; width: 100%; padding: 12px 38px 12px 12px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.01)), var(--card2); color: var(--text); font: inherit; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.ap-select:focus { outline: none; border-color: var(--accent); }
#autopilotSettingsModal label { margin-top: 14px; }
#autopilotSettingsModal .two-fields { gap: 12px; margin-top: 4px; }
#autopilotSettingsModal .two-fields label { margin-top: 10px; }
#autopilotSettingsModal .ap-equal-fields { align-items: stretch; }
#autopilotSettingsModal .ap-equal-fields label { display: flex; flex-direction: column; justify-content: flex-start; min-height: 78px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
#autopilotSettingsModal .ap-equal-fields input { margin-top: auto; }
.ap-pro-notice { margin: 4px 0 14px; padding: 12px 14px; border-radius: 11px; border: 1px solid rgba(255,93,108,.45); background: rgba(255,93,108,.10); color: #ffb4bc; font-size: 13px; line-height: 1.4; }
@media (max-width: 520px) { #autopilotSettingsModal .two-fields { grid-template-columns: 1fr; } }

.app-dialog { width: min(440px, 100%); }
.app-dialog h2 { margin: 2px 0 0; font-size: 19px; }
.app-dialog p { margin: 12px 0 0; line-height: 1.45; }
.app-dialog input { margin-top: 12px; }
#appDialog .two-actions { display: flex; gap: 10px; }
#appDialog .two-actions button { flex: 1 1 0; }

/* Prevent the login form from flashing when a saved session exists. */
html.has-session #loginScreen { display: none !important; }
.boot-splash { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 58vh; color: var(--muted); }
html.has-session .boot-splash { display: flex; }
.boot-splash .logo.big { margin: 0; }
.boot-splash b { color: var(--text); font-size: 15px; font-weight: 600; }

/* compact parameter-calculation state */
.force-sheet { max-width: 360px; }
.force-loading { display: flex; align-items: center; gap: 12px; padding: 8px 2px 2px; }
.force-loading .exec-spinner { flex: 0 0 20px; width: 20px; height: 20px; border-width: 2px; }
.force-loading h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.force-loading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* order execution feedback */
.exec-sheet { max-width: 760px; }
.exec-status { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin: 14px 0 4px; border: 1px solid rgba(142,164,194,.28); border-radius: 11px; background: rgba(8,14,26,.55); color: var(--muted); font-size: 14px; line-height: 1.45; }
.exec-status.processing { color: #9fcbff; border-color: rgba(47,155,255,.4); background: rgba(47,155,255,.09); }
.exec-status.success { color: #7ff0d0; border-color: rgba(34,211,166,.42); background: rgba(34,211,166,.10); }
.exec-status.error { color: #ffb4bc; border-color: rgba(255,93,108,.42); background: rgba(255,93,108,.10); }
.exec-spinner { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; border: 2px solid rgba(159,203,255,.25); border-top-color: #9fcbff; border-radius: 50%; animation: exec-spin .75s linear infinite; }
.exec-status.success .exec-spinner { display: none; }
.exec-status.error .exec-spinner { display: none; }
@keyframes exec-spin { to { transform: rotate(360deg); } }
.exec-grid { margin: 14px 0 10px; }
.exec-proof { max-height: 55vh; margin-top: 12px; cursor: zoom-in; }
#execCaption { margin: 8px 0 0; line-height: 1.4; }
html[data-theme="light"] .exec-status { background: #f5f8fc; border-color: #d5dfeb; color: #5e7088; }
html[data-theme="light"] .exec-status.processing { color: #1f5f9e; background: #edf5ff; border-color: #b9d5f4; }
html[data-theme="light"] .exec-status.success { color: #0b7f62; background: #eafaf5; border-color: #a7e3d3; }
html[data-theme="light"] .exec-status.error { color: #a83240; background: #fff0f2; border-color: #f0b9c0; }

/* мини-блок «версия + сайт» во вкладке Ещё */
.site-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg2));
}
.site-mini-ver { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.site-mini-ver span { color: var(--muted); font-size: 12px; line-height: 1.2; }
.site-mini-ver b { font-size: 15px; line-height: 1.2; }
.site-mini-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.site-mini-link:hover { background: rgba(47, 155, 255, .12); }
