:root {
    --blue: #0c46ff;
    --blue-dark: #062eb8;
    --blue-soft: #eaf0ff;
    --orange: #ff7108;
    --orange-soft: #fff0e5;
    --green: #0aa96e;
    --green-soft: #e8f8f2;
    --red: #e23c43;
    --red-soft: #fdecee;
    --amber: #c88300;
    --amber-soft: #fff6df;
    --ink: #14203b;
    --muted: #69738a;
    --line: #dce3f2;
    --bg: #f4f7ff;
    --panel: #ffffff;
    --shadow: 0 8px 28px rgba(27, 54, 112, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background:
        radial-gradient(circle at 5% 5%, rgba(12, 70, 255, .09), transparent 24%),
        radial-gradient(circle at 96% 8%, rgba(255, 113, 8, .08), transparent 22%),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 12px;
}

button { font: inherit; }
.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 14px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 8px;
    z-index: 30;
    backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { width: 48px; height: 48px; object-fit: contain; }
.brand-title { font-weight: 900; font-size: 16px; letter-spacing: .55px; color: var(--blue-dark); }
.brand-subtitle { color: var(--muted); font-size: 10px; margin-top: 2px; }
.clock-box { text-align: right; line-height: 1.1; min-width: 184px; }
.clock-day { font-weight: 800; color: var(--orange); font-size: 11px; text-transform: uppercase; }
.clock-date { font-size: 10px; color: var(--muted); margin: 3px 0; }
.clock-time-row { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
.clock-time { font-weight: 900; font-variant-numeric: tabular-nums; font-size: 16px; color: var(--blue-dark); }
.clock-zone { font-size: 8px; color: white; background: var(--blue); padding: 2px 5px; border-radius: 5px; }

main { padding-top: 16px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 4px 2px 9px; }
.section-head h1, .section-head h2 { margin: 0; font-size: 14px; letter-spacing: .15px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.compact-head { margin-top: 16px; }
.live-pill {
    display: inline-flex; align-items: center; gap: 6px; background: var(--green-soft); color: #087d54;
    border: 1px solid #cbeee0; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(10,169,110,.11); }

.chart-grid, .signal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.chart-panel { padding: 10px 10px 7px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.pair-label { font-size: 12px; font-weight: 900; color: var(--blue-dark); }
.last-price { margin-left: 7px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.tf-group { display: inline-flex; gap: 4px; background: #f1f4fb; border-radius: 9px; padding: 3px; }
.tf-btn { border: 0; background: transparent; color: var(--muted); padding: 4px 7px; border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 800; }
.tf-btn:hover { color: var(--blue); }
.tf-btn.active { background: white; color: var(--blue); box-shadow: 0 1px 6px rgba(24, 50, 100, .12); }
.chart { width: 100%; height: 405px; }
.mini-status { min-height: 17px; border-top: 1px dashed var(--line); padding: 6px 2px 1px; color: var(--muted); font-size: 9px; }
.mini-status.error { color: var(--red); }

.signal-panel { padding: 12px; min-height: 214px; }
.signal-loading { color: var(--muted); padding: 28px 0; text-align: center; }
.signal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.signal-pair { font-weight: 900; font-size: 12px; }
.signal-tf { color: var(--muted); font-size: 9px; margin-top: 2px; }
.signal-badge { font-size: 13px; font-weight: 900; letter-spacing: .7px; padding: 7px 13px; border-radius: 999px; }
.signal-badge.buy { background: var(--green-soft); color: var(--green); border: 1px solid #bfe9d9; }
.signal-badge.sell { background: var(--red-soft); color: var(--red); border: 1px solid #f6c7cb; }
.signal-badge.wait { background: var(--amber-soft); color: var(--amber); border: 1px solid #efdba9; }
.prob-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 10px; }
.prob { border: 1px solid var(--line); border-radius: 9px; padding: 7px; background: #fbfcff; }
.prob-label { display: flex; justify-content: space-between; gap: 5px; font-size: 9px; font-weight: 800; margin-bottom: 5px; }
.prob-track { height: 5px; background: #edf0f6; border-radius: 999px; overflow: hidden; }
.prob-fill { height: 100%; border-radius: 999px; }
.prob.buy .prob-fill { background: var(--green); }
.prob.sell .prob-fill { background: var(--red); }
.prob.wait .prob-fill { background: var(--amber); }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 9px 0; }
.metric { background: var(--blue-soft); border: 1px solid #d7e0ff; border-radius: 8px; padding: 6px; min-width: 0; }
.metric b { display: block; color: var(--blue-dark); font-size: 9px; margin-bottom: 2px; }
.metric span { font-variant-numeric: tabular-nums; font-size: 9px; overflow-wrap: anywhere; }
.reason-title { font-size: 9px; font-weight: 900; color: var(--ink); margin-top: 7px; }
.reason-list { margin: 5px 0 0 15px; padding: 0; color: #4f5b73; line-height: 1.45; font-size: 9px; }
.reason-list li { margin-bottom: 3px; }

.calendar-head { align-items: center; }
.refresh-btn { border: 1px solid #cbd8ff; background: white; color: var(--blue); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-weight: 800; font-size: 9px; }
.refresh-btn:hover { background: var(--blue-soft); }
.calendar-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.calendar-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.calendar-table th { background: #f2f5ff; color: var(--blue-dark); font-size: 9px; text-transform: uppercase; letter-spacing: .25px; text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.calendar-table td { padding: 8px 9px; border-bottom: 1px solid #edf0f6; font-size: 9px; vertical-align: middle; }
.calendar-table tbody tr:hover { background: #fafbff; }
.currency-chip { display: inline-block; min-width: 34px; text-align: center; background: var(--blue-soft); color: var(--blue-dark); font-weight: 900; border-radius: 6px; padding: 4px 6px; }
.impact-high { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 900; }
.impact-high::before { content: ""; width: 6px; height: 6px; background: var(--red); border-radius: 50%; box-shadow: 0 0 0 3px rgba(226,60,67,.11); }
.event-name { font-weight: 700; color: #25314d; }
.empty-cell { text-align: center; color: var(--muted); padding: 24px !important; }

footer { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px 2px; color: var(--muted); font-size: 9px; }

@media (max-width: 980px) {
    .chart-grid, .signal-grid { grid-template-columns: 1fr; }
    .chart { height: 380px; }
}
@media (max-width: 640px) {
    .app-shell { padding: 8px; }
    .topbar { position: static; border-radius: 14px; align-items: flex-start; }
    .brand-logo { width: 40px; height: 40px; }
    .brand-title { font-size: 13px; }
    .brand-subtitle { display: none; }
    .clock-box { min-width: 0; }
    .clock-date { max-width: 150px; }
    .chart { height: 330px; }
    .metric-row { grid-template-columns: repeat(2, 1fr); }
    .section-head { align-items: center; }
    footer { flex-direction: column; gap: 3px; }
}
