:root {
  --bg: #f4f7fb;
  --surface: rgba(255,255,255,.74);
  --surface-strong: rgba(255,255,255,.9);
  --surface-soft: rgba(255,255,255,.56);
  --line: rgba(112,128,153,.17);
  --line-strong: rgba(112,128,153,.26);
  --text: #152033;
  --muted: #6d788a;
  --subtle: #8994a5;
  --blue: #1677ff;
  --blue-soft: rgba(22,119,255,.11);
  --green: #159b68;
  --green-soft: rgba(21,155,104,.11);
  --red: #dc4b52;
  --red-soft: rgba(220,75,82,.10);
  --amber: #b77908;
  --amber-soft: rgba(183,121,8,.11);
  --shadow: 0 22px 60px rgba(35,55,85,.10), 0 3px 12px rgba(35,55,85,.06);
  --shadow-soft: 0 12px 35px rgba(35,55,85,.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 17px;
  --radius-sm: 12px;
  --blur: blur(24px) saturate(150%);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 5%, rgba(110,174,255,.15), transparent 26rem),
    radial-gradient(circle at 92% 18%, rgba(185,155,255,.12), transparent 25rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.glass {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.ambient { position: fixed; width: 340px; height: 340px; border-radius: 50%; filter: blur(70px); pointer-events: none; opacity: .25; z-index: -1; }
.ambient-one { top: -150px; left: -130px; background: #8fc1ff; }
.ambient-two { right: -140px; bottom: 5%; background: #d6b7ff; }

h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin-bottom: 6px; font-size: 20px; letter-spacing: -.025em; }
h3 { font-size: 16px; }
p { line-height: 1.55; }
a { color: inherit; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-panel {
  width: min(100%, 510px);
  padding: 34px;
  border-radius: 34px;
}
.auth-brand { display: flex; gap: 18px; align-items: center; margin-bottom: 34px; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 18px; box-shadow: 0 12px 25px rgba(22,119,255,.16); }
.auth-brand h1 { margin: 0; font-size: 30px; }
.auth-brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { padding: 24px; border-radius: 23px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.8); }
.auth-form h2 { font-size: 26px; }
.field-label { display: block; margin: 17px 0 8px; color: #4e5a6e; font-size: 12px; font-weight: 750; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,.72);
  border-radius: 14px;
  padding: 13px 14px;
  transition: .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
input:focus, textarea:focus { border-color: rgba(22,119,255,.45); box-shadow: 0 0 0 4px rgba(22,119,255,.09); }
textarea { min-height: 130px; resize: vertical; }
.primary-btn, .ghost-btn, .logout-btn, .btn-danger, .text-btn {
  border: 0;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-btn {
  color: white;
  background: linear-gradient(135deg, #2385ff, #1268e9);
  padding: 12px 18px;
  border-radius: 13px;
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(22,119,255,.22);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(22,119,255,.25); }
.full-btn { width: 100%; margin-top: 20px; }
.text-btn { display: block; margin: 14px auto 0; color: var(--blue); background: transparent; font-weight: 650; }
.error-text { min-height: 20px; margin-top: 12px; color: var(--red); font-size: 13px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--subtle); font-size: 11px; margin-top: 22px; }
.separator { opacity: .5; }

#app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 16px;
  z-index: 20;
  width: min(1220px, calc(100% - 32px));
  margin: 16px auto 0;
  border-radius: 22px;
}
.header-inner { min-height: 70px; display: flex; align-items: center; gap: 22px; padding: 9px 13px 9px 17px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 0 0 auto; }
.brand-logo { width: 39px; height: 39px; border-radius: 11px; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 15px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--subtle); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-bar { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.nav-btn {
  border: 0;
  color: #5f6b7e;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  transition: .18s ease;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.58); }
.nav-btn.active { color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px rgba(22,119,255,.07); }
.header-user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; max-width: 190px; overflow: hidden; }
.header-user > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-live { display: inline-flex; align-items: center; gap: 5px; font-weight: 750; color: var(--green); }
.dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.dot-live { background: #19ad72; box-shadow: 0 0 0 4px rgba(25,173,114,.11); }
.dot-offline { background: #a1a9b6; }
.menu-toggle { display: none; margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.68); }
.menu-toggle span { display: block; width: 17px; height: 2px; margin: 4px auto; background: #526075; border-radius: 2px; transition: .2s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.page-shell { width: min(1220px, calc(100% - 32px)); margin: 28px auto 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 28px 2px 22px; }
.page-heading p { color: var(--muted); margin: 0; font-size: 14px; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.ghost-btn, .logout-btn {
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: #536075;
  background: rgba(255,255,255,.6);
  font-size: 12px;
  font-weight: 700;
}
.logout-btn { color: var(--red); background: var(--red-soft); border-color: rgba(220,75,82,.12); }
.info-pill { display: inline-flex; align-items: center; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.65); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 750; }

.hero-grid { display: grid; grid-template-columns: .95fr 1.35fr; gap: 16px; }
.hero-card, .chart-card { min-width: 0; border-radius: var(--radius-xl); }
.hero-card { padding: 24px; }
.card-topline, .section-head, .signal-header, .calendar-banner, .pairing-card > div:first-child { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 25px; }
.metric { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.5); }
.metric span, .stat-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric strong { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; letter-spacing: -.02em; }
.sync-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--subtle); font-size: 10px; }
.sync-line b { color: var(--muted); }
.status-tag { display: inline-flex; align-items: center; width: fit-content; padding: 6px 9px; border-radius: 999px; font-size: 9px; font-weight: 850; letter-spacing: .07em; }
.status-live { color: #08734a; background: var(--green-soft); }
.status-wait { color: #7a8290; background: rgba(115,127,146,.10); }
.status-revoked { color: #a23d43; background: var(--red-soft); }

.chart-card { padding: 22px 22px 15px; }
.chart-status { display: flex; align-items: center; gap: 9px; }
.chart-price { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 17px 0 8px; }
.symbol-pills { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.symbol-pills::-webkit-scrollbar { display: none; }
.symbol-pill { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 9px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.symbol-pill.active { color: var(--blue); background: var(--blue-soft); }
.chart-note { color: var(--subtle); font-size: 10px; white-space: nowrap; }
.chart-wrap { position: relative; height: 270px; overflow: hidden; border-radius: 17px; background: rgba(248,250,253,.58); border: 1px solid rgba(112,128,153,.10); }
#price-chart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--subtle); font-size: 12px; pointer-events: none; }

.section-block { margin-top: 26px; }
.section-head { margin-bottom: 13px; }
.section-head h2 { margin: 0; }
.section-head > .muted { font-size: 11px; }
.section-head sup { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 5px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 10px; vertical-align: middle; }

.quote-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.quote-card {
  min-width: 0;
  padding: 15px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: .18s ease;
}
.quote-card:hover, .quote-card.selected { transform: translateY(-2px); border-color: rgba(22,119,255,.28); box-shadow: 0 15px 30px rgba(35,55,85,.10); }
.quote-card-top, .quote-foot, .quote-prices { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.quote-card-top strong { font-size: 13px; }
.quote-live { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 8px; font-weight: 850; }
.quote-live.offline { color: var(--subtle); }
.quote-prices { margin-top: 17px; align-items: end; }
.quote-prices div span { display: block; color: var(--subtle); font-size: 9px; margin-bottom: 3px; }
.quote-prices b { font-size: 13px; }
.bid-price { color: var(--red); }
.ask-price { color: var(--green); }
.quote-foot { margin-top: 13px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 9px; }
.quote-foot b { color: var(--muted); }
.quote-offline { padding-top: 18px; color: var(--subtle); font-size: 10px; }

.analytics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-card { border-radius: 18px; padding: 18px; }
.stat-card strong { display: block; margin-top: 7px; font-size: 23px; letter-spacing: -.035em; }
.stat-card small { display: block; margin-top: 5px; color: var(--subtle); font-size: 9px; }

.table-card { overflow: hidden; border-radius: var(--radius-lg); padding: 21px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th { color: var(--subtle); text-align: left; padding: 11px 10px; font-size: 9px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; border-bottom: 1px solid var(--line); }
td { padding: 13px 10px; border-bottom: 1px solid rgba(112,128,153,.11); color: #465267; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.symbol-cell { color: var(--text); font-weight: 750; }
.buy { color: var(--green) !important; font-weight: 800; }
.sell { color: var(--red) !important; font-weight: 800; }
.neutral { color: var(--muted) !important; }
.profit-pos { color: var(--green) !important; font-weight: 800; }
.profit-neg { color: var(--red) !important; font-weight: 800; }
.table-empty, .empty-state { padding: 25px 15px; text-align: center; color: var(--subtle); font-size: 11px; }

.notice-card { display: flex; align-items: center; gap: 10px; padding: 14px 17px; border-radius: 16px; margin-bottom: 16px; }
.notice-card strong { font-size: 11px; }
.notice-card span { color: var(--muted); font-size: 11px; }
.signal-list { display: grid; gap: 13px; }
.signal-card { padding: 21px; border-radius: var(--radius-lg); }
.signal-title { display: flex; align-items: center; gap: 10px; }
.symbol-title { font-size: 19px; font-weight: 850; letter-spacing: -.025em; }
.direction { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: rgba(115,127,146,.08); font-size: 9px; font-weight: 850; }
.signal-meta { display: flex; gap: 6px; align-items: center; }
.timeframe-pill { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 9px; font-weight: 750; }
.signal-strategy { display: flex; gap: 25px; margin: 15px 0; color: var(--muted); font-size: 11px; }
.signal-strategy b, .confluence b { color: var(--text); margin-right: 5px; }
.signal-levels { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.signal-levels > div { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.5); }
.signal-levels span { display: block; color: var(--subtle); font-size: 9px; margin-bottom: 6px; }
.signal-levels strong { font-size: 14px; }
.level-danger { color: var(--red); }
.level-success { color: var(--green); }
.confluence { margin-top: 9px; padding: 12px; border-radius: 12px; background: rgba(247,249,252,.72); color: var(--muted); font-size: 10px; }
.confluence span { color: #667387; }

.calendar-banner { padding: 3px 3px 17px; }
.calendar-banner strong { display: block; font-size: 14px; }
.calendar-banner span:not(.status-tag) { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }

.journal-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 16px; align-items: start; }
.journal-form, .journal-log { border-radius: var(--radius-lg); padding: 21px; }
.journal-form .primary-btn { width: 100%; margin-top: 16px; }
.journal-entry { padding: 15px 0; border-bottom: 1px solid var(--line); }
.journal-entry:last-child { border-bottom: 0; }
.journal-entry-top { display: flex; justify-content: space-between; gap: 14px; }
.journal-entry-top strong { font-size: 14px; }
.entry-meta { margin-left: 8px; color: var(--subtle); font-size: 9px; }
.entry-right { display: flex; flex-direction: column; align-items: end; gap: 4px; }
.entry-right span { color: var(--subtle); font-size: 9px; }
.setup-line { margin-top: 9px; color: var(--blue); font-size: 10px; }
.notes-box { margin-top: 8px; padding: 10px; border-radius: 11px; background: rgba(245,248,252,.8); color: #657084; font-size: 10px; line-height: 1.5; }
.journal-entry .direction { margin-left: 7px; }

.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.news-card { position: relative; overflow: hidden; min-height: 220px; padding: 25px; border-radius: var(--radius-lg); }
.news-card::after { content: ""; position: absolute; width: 150px; height: 150px; right: -60px; top: -60px; border-radius: 50%; background: rgba(22,119,255,.08); }
.news-green::after { background: rgba(21,155,104,.08); }
.news-tag { display: inline-flex; padding: 6px 8px; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-weight: 850; }
.news-green .news-tag { color: var(--green); background: var(--green-soft); }
.news-card h2 { max-width: 560px; margin-top: 22px; font-size: 23px; }
.news-card p { max-width: 560px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.news-card small { color: var(--subtle); font-size: 9px; font-weight: 750; }

.pairing-card { margin-top: 16px; padding: 22px; border-radius: var(--radius-lg); }
.pairing-card p { margin-bottom: 0; font-size: 11px; }
.pairing-code { min-height: 45px; display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.pairing-code span { color: var(--subtle); font-size: 10px; }
.pairing-code strong { padding: 10px 14px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); letter-spacing: .18em; font-size: 18px; }
code { color: var(--blue); background: var(--blue-soft); padding: 4px 6px; border-radius: 6px; }
.btn-danger { padding: 7px 9px; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 9px; font-weight: 800; }

@media (max-width: 1040px) {
  .header-user { display: none; }
  .nav-btn { padding-inline: 9px; }
  .quote-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app-header { top: 9px; margin-top: 9px; width: calc(100% - 18px); border-radius: 18px; }
  .header-inner { position: relative; min-height: 62px; }
  .menu-toggle { display: block; }
  .nav-bar {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 9px;
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 17px;
    background: rgba(255,255,255,.88);
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
  }
  .nav-bar.open { display: flex; }
  .nav-btn { text-align: left; padding: 13px; }
  .page-shell { width: calc(100% - 18px); margin-top: 22px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .quote-grid, .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .journal-layout { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .auth-screen { padding: 12px; }
  .auth-panel { padding: 20px; border-radius: 25px; }
  .auth-form { padding: 18px; }
  .brand-copy small { display: none; }
  .page-shell { margin-bottom: 45px; }
  h1 { font-size: 29px; }
  .hero-card, .chart-card, .table-card, .journal-form, .journal-log { padding: 17px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric strong { font-size: 15px; }
  .sync-line { flex-direction: column; }
  .chart-toolbar { align-items: flex-start; flex-direction: column; }
  .chart-note { display: none; }
  .chart-wrap { height: 230px; }
  .quote-grid, .analytics-grid { grid-template-columns: 1fr 1fr; }
  .signal-header, .signal-strategy, .calendar-banner, .pairing-card > div:first-child { align-items: flex-start; flex-direction: column; }
  .signal-levels { grid-template-columns: 1fr 1fr; }
  .signal-strategy { gap: 6px; }
  .news-card { min-height: 190px; padding: 20px; }
  .news-card h2 { font-size: 20px; }
  .journal-entry-top { flex-direction: column; }
  .entry-right { align-items: flex-start; }
}
@media (max-width: 380px) {
  .quote-grid, .analytics-grid { grid-template-columns: 1fr; }
}
