:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-muted: #f7f8f6;
  --ink: #17211d;
  --muted: #728078;
  --line: #e4e8e4;
  --blue: #356df3;
  --blue-soft: #eaf0ff;
  --green: #22b66f;
  --green-dark: #168451;
  --green-soft: #e8f8ef;
  --red: #ed5e64;
  --red-soft: #ffedef;
  --amber: #f2a93b;
  --amber-soft: #fff5df;
  --violet: #7659db;
  --violet-soft: #f0ecff;
  --shadow: 0 16px 40px rgba(33, 47, 39, .06);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, label.file-label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, label.file-label:focus-within {
  outline: 3px solid rgba(53, 109, 243, .2);
  outline-offset: 2px;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 240px;
  flex-direction: column;
  padding: 30px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(250, 251, 249, .94);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}
.brand-mark svg { width: 23px; }
.brand b { display: block; font-size: 17px; letter-spacing: -.4px; }
.brand small { display: block; margin-top: 3px; color: #8b958f; font-size: 10px; letter-spacing: .2px; }
.nav-list { display: grid; gap: 6px; margin-top: 52px; }
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #6f7b74;
  cursor: pointer;
  text-align: left;
  transition: .2s ease;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: #f0f2ef; color: var(--ink); }
.nav-item.active { background: #e9eeff; color: var(--blue); font-weight: 750; }
.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 9px;
  background: rgba(53, 109, 243, .1);
  font-size: 10px;
  text-align: center;
}
.sidebar-note {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid #e2e7e2;
  border-radius: 13px;
  background: #f6f8f5;
}
.sync-card { width: 100%; align-items: flex-start; color: inherit; cursor: pointer; text-align: left; transition: .2s ease; }
.sync-card:hover { border-color: #c7d5ca; background: #f0f6f2; }
.sync-card .note-icon.syncing { background: var(--blue-soft); color: var(--blue); animation: syncSpin 1s linear infinite; }
.sync-card .note-icon.synced { background: var(--green-soft); color: var(--green); }
.sync-card .note-icon.error { background: var(--red-soft); color: var(--red); }
@keyframes syncSpin { to { transform: rotate(360deg); } }
.note-icon { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 900; }
.sidebar-note b { display: block; font-size: 11px; }
.sidebar-note small { display: block; margin-top: 4px; color: #8a948e; font-size: 9px; line-height: 1.45; }
.sidebar-footer { margin-top: 18px; color: #abb2ae; font-size: 9px; text-align: center; }

.main-content { min-height: 100vh; margin-left: 240px; padding: 42px clamp(28px, 4vw, 66px) 72px; }
.view { display: none; max-width: 1480px; margin: 0 auto; animation: viewIn .3s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } }
.mobile-header, .mobile-nav { display: none; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { max-width: 720px; margin: 7px 0 8px; font-size: clamp(30px, 3.2vw, 47px); font-weight: 820; letter-spacing: -2px; line-height: 1.13; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.compact-heading h1 { font-size: clamp(30px, 2.8vw, 42px); }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: 1.5px; }
.primary-button, .ghost-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.primary-button { min-height: 46px; padding: 0 19px; border-radius: 12px; background: var(--blue); color: white; box-shadow: 0 8px 18px rgba(53, 109, 243, .2); font-weight: 760; transition: .2s ease; }
.primary-button:hover { background: #245bdc; transform: translateY(-1px); }
.primary-button.small { min-height: 39px; padding: 0 14px; font-size: 12px; }
.primary-button.full { width: 100%; }
.ghost-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: white; color: #637068; font-size: 12px; font-weight: 700; transition: .2s ease; }
.ghost-button:hover { border-color: #cbd3cd; color: var(--ink); }
.text-button { background: transparent; color: var(--blue); font-size: 11px; font-weight: 800; }
.heading-actions { display: flex; gap: 8px; }
.file-label input { display: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 145px; padding: 20px 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #758179; font-size: 11px; font-weight: 670; }
.metric-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; font-size: 12px; font-weight: 900; }
.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-icon.mint { background: var(--green-soft); color: var(--green); }
.metric-icon.violet { background: var(--violet-soft); color: var(--violet); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }
.metric-card > strong { display: block; margin-top: 16px; overflow: hidden; font-size: clamp(24px, 2.3vw, 34px); font-weight: 820; letter-spacing: -1.3px; text-overflow: ellipsis; white-space: nowrap; }
.metric-card > strong small { margin-left: 2px; font-size: 13px; font-weight: 650; }
.best-card > strong { padding-top: 5px; font-size: 19px; letter-spacing: -.6px; }
.metric-foot { margin-top: 7px; overflow: hidden; color: #909a94; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.metric-foot .up { color: var(--green); font-weight: 800; }
.metric-foot .down { color: var(--red); font-weight: 800; }

.insight-banner { display: flex; align-items: center; gap: 13px; margin: 16px 0; padding: 16px 18px; border: 1px solid #dfe5dc; border-radius: 15px; background: linear-gradient(100deg, #f8fbf5, #f3f8ff); }
.insight-symbol { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 11px; background: #dff6e8; color: var(--green); }
.insight-banner > div:nth-child(2) { display: grid; gap: 3px; }
.insight-banner span { color: #879189; font-size: 9px; font-weight: 800; }
.insight-banner strong { font-size: 12px; }
.insight-banner .text-button { margin-left: auto; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .95fr); gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.trades-panel, .performance-panel, .equity-panel, .combo-panel { min-width: 0; padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.4px; }
.panel-heading p { margin: 5px 0 0; color: #929c96; font-size: 9px; }
.live-badge { display: flex; align-items: center; gap: 5px; color: #909a94; font-size: 8px; font-weight: 800; letter-spacing: .5px; }
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.table-wrap { overflow: auto; }
.trade-table { width: 100%; border-collapse: collapse; }
.trade-table th { padding: 0 9px 10px; color: #9ca49f; font-size: 8px; font-weight: 650; text-align: left; }
.trade-table td { padding: 12px 9px; border-top: 1px solid #edf0ed; font-size: 10px; vertical-align: middle; }
.trade-table td:last-child, .trade-table th:last-child { text-align: right; }
.symbol-cell { display: flex; align-items: center; gap: 9px; }
.coin-avatar { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 9px; background: #eff2ef; color: #59645d; font-size: 9px; font-weight: 850; }
.symbol-cell b { display: block; font-size: 10px; }
.symbol-cell small { display: block; margin-top: 3px; color: #a0a8a3; font-size: 8px; }
.direction-badge { color: #647168; font-size: 9px; font-weight: 750; }
.direction-badge.long { color: var(--green-dark); }
.direction-badge.short { color: #d34e54; }
.result-badge { display: inline-grid; min-width: 25px; height: 23px; padding: 0 6px; place-items: center; border-radius: 7px; font-size: 8px; font-weight: 850; }
.result-badge.win { background: var(--green-soft); color: var(--green-dark); }
.result-badge.loss { background: var(--red-soft); color: var(--red); }
.result-badge.draw { background: #eff1f0; color: #717b75; }
.tag-cluster { display: flex; max-width: 250px; gap: 4px; overflow: hidden; white-space: nowrap; }
.tag-chip { display: inline-block; padding: 5px 7px; border-radius: 7px; background: #f1f3f1; color: #7a857e; font-size: 7px; font-weight: 700; }
.tag-chip.more { background: var(--blue-soft); color: var(--blue); }
.pnl { font-weight: 850; white-space: nowrap; }
.pnl.positive { color: var(--green); }
.pnl.negative { color: var(--red); }
.pnl.neutral { color: #77817b; }
.empty-state { padding: 42px 20px; text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; margin: 0 auto; place-items: center; border-radius: 15px; background: var(--blue-soft); color: var(--blue); font-size: 24px; }
.empty-state h3 { margin: 13px 0 6px; font-size: 14px; }
.empty-state p { margin: 0 0 15px; color: var(--muted); font-size: 10px; }

.tag-performance { display: grid; gap: 16px; }
.tag-stat-top { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.tag-stat-top b { max-width: 170px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tag-stat-top strong { font-size: 12px; }
.tag-stat-top strong small { color: #a0aaa3; font-size: 8px; font-weight: 600; }
.progress-track { height: 5px; overflow: hidden; border-radius: 4px; background: #edf0ee; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #4ed190); transition: width .6s ease; }
.tag-stat-meta { margin-top: 5px; color: #a0aaa3; font-size: 8px; }
.equity-panel { min-height: 250px; }
.pnl-legend { color: #9ba49e; font-size: 8px; }
.pnl-legend span { display: inline-block; width: 15px; height: 2px; margin-right: 5px; background: var(--blue); vertical-align: middle; }
.equity-chart { height: 160px; }
.equity-chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: #eef0ee; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 2.5; }
.chart-area { fill: url(#areaGradient); stroke: none; }
.chart-dot { fill: white; stroke: var(--blue); stroke-width: 2; }
.chart-label { fill: #9ba49e; stroke: none; font-size: 8px; }
.chart-empty { display: grid; height: 100%; place-items: center; color: #9ca59f; font-size: 10px; }
.combo-list { display: grid; gap: 14px; }
.combo-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
.combo-tags { display: flex; min-width: 0; align-items: center; gap: 4px; }
.combo-tags span { max-width: 104px; overflow: hidden; padding: 5px 7px; border-radius: 7px; background: #f2f4f2; color: #68746c; font-size: 7px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.combo-tags i { color: #a6aea9; font-size: 9px; font-style: normal; }
.combo-item strong { color: var(--green-dark); font-size: 11px; }
.combo-item .progress-track { grid-column: 1 / -1; }
.data-note { color: #a1aaa5; font-size: 8px; }

.journal-toolbar { display: flex; align-items: center; gap: 15px; margin-bottom: 16px; padding: 12px; }
.search-box { display: flex; min-width: 240px; flex: 1; align-items: center; gap: 8px; }
.search-box svg { width: 17px; color: #a0aaa4; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input::placeholder { color: #aab2ad; }
.segmented-filter { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: #f2f4f2; }
.segmented-filter button { min-width: 38px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #87918b; cursor: pointer; font-size: 10px; font-weight: 750; }
.segmented-filter button.active { background: white; color: var(--ink); box-shadow: 0 2px 7px rgba(24, 35, 29, .08); }
.toolbar-count { color: #9aa39d; font-size: 10px; }
.journal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.journal-cards { display: grid; gap: 12px; }
.journal-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.journal-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.journal-symbol { display: flex; gap: 11px; }
.journal-symbol .coin-avatar { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; }
.journal-symbol h3 { margin: 1px 0 5px; font-size: 14px; }
.journal-symbol p { margin: 0; color: #9aa39d; font-size: 9px; }
.journal-result { display: flex; align-items: center; gap: 8px; }
.journal-result .pnl { font-size: 14px; }
.card-actions { position: relative; }
.card-menu-btn { width: 28px; height: 28px; border: 0; border-radius: 8px; background: #f4f6f4; color: #87918a; cursor: pointer; }
.journal-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 16px 0 12px; }
.journal-card-image { display: block; width: 100%; max-height: 320px; margin: 4px 0 12px; overflow: hidden; padding: 0; border: 1px solid #e5e9e5; border-radius: 13px; background: #f5f7f5; cursor: zoom-in; }
.journal-card-image img { display: block; width: 100%; max-height: 320px; object-fit: cover; transition: transform .25s ease; }
.journal-card-image:hover img { transform: scale(1.015); }
.journal-card-note { margin: 0; padding-top: 12px; border-top: 1px solid #eef0ee; color: #657168; font-size: 10px; line-height: 1.65; }
.journal-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; color: #99a29c; font-size: 8px; }
.journal-card-bottom dl { display: flex; gap: 16px; margin: 0; }
.journal-card-bottom dl div { display: flex; gap: 4px; }
.journal-card-bottom dt { color: #a6aea9; }
.journal-card-bottom dd { margin: 0; color: #6f7b73; font-weight: 750; }
.delete-trade { border: 0; background: transparent; color: #b0b7b2; cursor: pointer; font-size: 9px; }
.delete-trade:hover { color: var(--red); }
.journal-aside { display: grid; gap: 14px; position: sticky; top: 24px; }
.mini-stats, .lecture-note { padding: 21px; }
.mini-stats h2 { margin: 6px 0 17px; font-size: 17px; }
.edge-ring { display: grid; width: 132px; height: 132px; margin: 0 auto 19px; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) var(--rate, 0%), #edf0ed 0); position: relative; }
.edge-ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: white; }
.edge-ring span { position: relative; z-index: 1; display: grid; text-align: center; }
.edge-ring strong { font-size: 27px; }
.edge-ring small { color: #919b94; font-size: 9px; }
.mini-stats dl { display: grid; gap: 0; margin: 0; }
.mini-stats dl div { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid #eef0ee; }
.mini-stats dt { color: #8a948e; font-size: 9px; }
.mini-stats dd { margin: 0; font-size: 10px; font-weight: 800; }
.note-label { display: inline-block; padding: 5px 7px; border-radius: 7px; background: var(--amber-soft); color: #bf7b18; font-size: 8px; font-weight: 850; }
.lecture-note blockquote { margin: 17px 0 10px; font-size: 16px; font-weight: 800; letter-spacing: -.5px; line-height: 1.5; }
.lecture-note p { margin: 0; color: #7d8881; font-size: 9px; line-height: 1.65; }
.journal-empty { padding: 70px 20px; }

.calculator-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; }
.calculator-form { padding: 27px; }
.form-section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 21px; }
.form-section-heading > span, .modal-section-title > span { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 9px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 850; }
.form-section-heading h2, .modal-section-title h3 { margin: 1px 0 4px; font-size: 14px; }
.form-section-heading p, .modal-section-title p { margin: 0; color: #939c96; font-size: 9px; }
.field-grid { display: grid; gap: 13px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 8px; }
.field > span, .field-label { color: #5f6b64; font-size: 10px; font-weight: 750; }
.field > span i { margin-left: 4px; color: #9ca59f; font-size: 8px; font-style: normal; font-weight: 500; }
.field input, .field textarea, .input-unit { width: 100%; border: 1px solid #dfe4df; border-radius: 11px; background: #fafbfa; color: var(--ink); transition: .2s ease; }
.field input { height: 45px; padding: 0 13px; }
.field textarea { resize: vertical; padding: 13px; line-height: 1.65; }
.field input:focus, .field textarea:focus, .input-unit:focus-within { border-color: #9ab5ff; background: white; box-shadow: 0 0 0 3px rgba(53, 109, 243, .07); outline: 0; }
.input-unit { display: flex; align-items: center; overflow: hidden; }
.input-unit input { min-width: 0; flex: 1; border: 0; background: transparent; }
.input-unit input:focus { box-shadow: none; }
.input-unit em { padding-right: 12px; color: #9aa39e; font-size: 8px; font-style: normal; font-weight: 700; }
.field small { color: #8f9993; font-size: 8px; }
.section-divider { height: 1px; margin: 28px 0; background: #edf0ed; }
.direction-toggle { display: flex; gap: 7px; margin-bottom: 15px; }
.direction-toggle button { min-width: 82px; height: 35px; border: 1px solid var(--line); border-radius: 9px; background: white; color: #808a83; cursor: pointer; font-size: 10px; font-weight: 750; }
.direction-toggle button.long.active { border-color: #a9e4c4; background: var(--green-soft); color: var(--green-dark); }
.direction-toggle button.short.active { border-color: #ffc4c8; background: var(--red-soft); color: var(--red); }
.rate-note { display: flex; align-items: center; gap: 8px; margin-top: 13px; padding: 11px 13px; border-radius: 10px; background: #f6f8f6; font-size: 9px; }
.rate-note span { color: #828d86; }
.rate-note strong { color: var(--blue); }
.rate-note i { margin-left: auto; color: #a0aaa4; font-style: normal; }
.leverage-control { display: flex; align-items: center; gap: 20px; }
.leverage-control input[type=range] { width: 100%; accent-color: var(--blue); }
.leverage-value { display: flex; width: 74px; height: 41px; flex: 0 0 74px; align-items: center; overflow: hidden; border: 1px solid #dfe4df; border-radius: 10px; background: #fafbfa; }
.leverage-value input { width: 50px; height: 100%; padding-left: 13px; border: 0; outline: 0; background: transparent; font-weight: 800; }
.leverage-value span { color: #7c8780; }
.range-labels { display: flex; justify-content: space-between; margin-top: 4px; padding-right: 94px; color: #a3aba6; font-size: 7px; }
.calculator-result { display: grid; gap: 12px; position: sticky; top: 24px; }
.result-hero { padding: 25px; border-radius: var(--radius); background: #17221d; color: white; box-shadow: 0 18px 35px rgba(21, 34, 27, .15); }
.result-kicker { color: #a9b4ae; font-size: 9px; font-weight: 700; }
.result-hero > strong { display: block; margin: 11px 0 6px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -1.5px; }
.result-hero > strong small { color: #96a39c; font-size: 10px; letter-spacing: 0; }
.result-hero > p { margin: 0; color: #7e8d85; font-size: 8px; }
.risk-status { display: flex; align-items: center; gap: 7px; margin-top: 21px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.07); font-size: 9px; }
.risk-status i { width: 6px; height: 6px; border-radius: 50%; background: #4bd28b; box-shadow: 0 0 0 4px rgba(75, 210, 139, .1); }
.risk-status span { font-weight: 750; }
.risk-status small { margin-left: auto; color: #93a098; font-size: 8px; }
.risk-status.warn i { background: var(--amber); }
.risk-status.danger i { background: var(--red); }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.result-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.result-grid span { display: block; color: #89938d; font-size: 8px; }
.result-grid strong { display: block; margin: 8px 0 4px; font-size: 14px; }
.result-grid small { color: #a1aaa4; font-size: 7px; }
.positive { color: var(--green); }
.formula-card { padding: 15px; border: 1px solid #dfe7fa; border-radius: 13px; background: #f5f8ff; }
.formula-card > span { color: var(--blue); font-size: 8px; font-weight: 800; }
.formula-card p { margin: 8px 0 0; color: #67736b; font-size: 8px; }
.calculator-disclaimer { margin: 0; color: #99a29c; font-size: 7px; line-height: 1.55; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; padding: 20px; place-items: center; background: rgba(17, 27, 22, .56); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.journal-modal { display: flex; width: min(900px, 100%); max-height: min(900px, calc(100vh - 40px)); flex-direction: column; overflow: hidden; border-radius: 22px; background: white; box-shadow: 0 28px 80px rgba(11, 19, 15, .28); animation: modalIn .25s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 28px 19px; border-bottom: 1px solid #edf0ed; }
.modal-header h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.8px; }
.modal-close { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 10px; background: #f3f5f3; color: #758079; cursor: pointer; font-size: 20px; }
#journalForm { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.modal-scroll { overflow-y: auto; padding: 0 28px; }
.modal-section { padding: 24px 0; border-bottom: 1px solid #edf0ed; }
.modal-section:last-child { border-bottom: 0; }
.modal-section-title { display: flex; gap: 11px; margin-bottom: 19px; }
.choice-row.split { display: grid; grid-template-columns: 1fr 1.5fr; gap: 25px; margin-top: 16px; }
.choice-group { display: flex; gap: 7px; margin-top: 8px; }
.choice-group button { min-width: 72px; height: 39px; border: 1px solid #dfe4df; border-radius: 10px; background: #fafbfa; color: #7c8780; cursor: pointer; font-size: 10px; font-weight: 780; }
.choice-group button.long.active, .choice-group button.win.active { border-color: #aee5c7; background: var(--green-soft); color: var(--green-dark); }
.choice-group button.short.active, .choice-group button.loss.active { border-color: #ffc3c7; background: var(--red-soft); color: var(--red); }
.choice-group button.draw.active { border-color: #bdc5c0; background: #eef1ef; color: #5e6962; }
.pnl-preview { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding: 13px 15px; border-radius: 11px; background: #f6f8f6; }
.pnl-preview span { color: #7d8881; font-size: 9px; }
.pnl-preview strong { font-size: 14px; }
.pnl-preview small { margin-left: auto; color: #9da6a0; font-size: 8px; }
.pnl-preview.positive { background: var(--green-soft); }
.pnl-preview.negative { background: var(--red-soft); }
.selected-tags-summary { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: #f6f8f6; }
.selected-tags-summary span { color: #858f89; font-size: 9px; }
.selected-tags-summary strong { color: var(--blue); font-size: 10px; }
.tag-groups { display: grid; gap: 17px; }
.tag-group h4 { margin: 0 0 9px; color: #67736c; font-size: 9px; }
.tag-options { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-option { padding: 8px 10px; border: 1px solid #dfe4df; border-radius: 9px; background: white; color: #737e77; cursor: pointer; font-size: 9px; font-weight: 680; transition: .15s ease; }
.tag-option:hover { border-color: #b9c9f5; color: var(--blue); }
.tag-option.selected { border-color: #a9bef9; background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1px rgba(53,109,243,.05); }
.image-upload { display: grid; min-height: 142px; place-items: center; align-content: center; gap: 7px; border: 1.5px dashed #cfd8d1; border-radius: 14px; background: #f8faf8; color: #6e7a72; cursor: pointer; text-align: center; transition: .2s ease; }
.image-upload:hover, .image-upload.dragging { border-color: #8eabfa; background: #f3f6ff; color: var(--blue); }
.image-upload input { display: none; }
.image-upload-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 18px; font-weight: 800; }
.image-upload strong { font-size: 11px; }
.image-upload small { color: #98a29b; font-size: 8px; }
.image-preview { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding: 10px; border: 1px solid #e1e6e1; border-radius: 13px; background: #fafbfa; }
.image-preview[hidden] { display: none; }
.image-preview img { width: 88px; height: 60px; border-radius: 9px; object-fit: cover; }
.image-preview div { display: grid; gap: 4px; min-width: 0; }
.image-preview div strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.image-preview div small { color: #929d96; font-size: 8px; }
.image-preview button { padding: 6px 8px; border: 0; border-radius: 8px; background: var(--red-soft); color: var(--red); cursor: pointer; font-size: 8px; font-weight: 750; }
.validation-text { display: block; min-height: 12px; margin-top: 6px; color: var(--red); font-size: 8px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 28px; border-top: 1px solid #e9ede9; background: #fafbfa; }

.sync-modal { width: min(500px, 100%); overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 28px 80px rgba(11, 19, 15, .28); animation: modalIn .25s ease; }
.sync-modal-body { padding: 26px 28px 22px; }
.sync-illustration { display: grid; width: 48px; height: 48px; margin-bottom: 16px; place-items: center; border-radius: 15px; background: var(--blue-soft); color: var(--blue); font-size: 24px; font-weight: 800; }
.sync-modal-body > h3 { margin: 0 0 8px; font-size: 16px; letter-spacing: -.5px; }
.sync-modal-body > p { margin: 0 0 20px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.show-code-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: #7f8a83; cursor: pointer; font-size: 9px; }
.show-code-row input { accent-color: var(--blue); }
.sync-state-box { display: flex; align-items: center; gap: 11px; margin-top: 18px; padding: 13px; border: 1px solid #e3e7e3; border-radius: 12px; background: #f8faf8; }
.sync-state-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #adb5b0; box-shadow: 0 0 0 5px rgba(173,181,176,.12); }
.sync-state-box.syncing .sync-state-dot { background: var(--blue); box-shadow: 0 0 0 5px rgba(53,109,243,.1); }
.sync-state-box.synced .sync-state-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(34,182,111,.1); }
.sync-state-box.error .sync-state-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(237,94,100,.1); }
.sync-state-box div { display: grid; gap: 3px; }
.sync-state-box strong { font-size: 10px; }
.sync-state-box small { color: #929c96; font-size: 8px; }
.sync-modal-footer { justify-content: stretch; }
.sync-modal-footer .primary-button { margin-left: auto; }
.danger-text { color: var(--red); }
.mobile-header-actions { display: flex; gap: 7px; }
.sync-mobile-button { background: var(--green-soft); color: var(--green-dark); }

.image-lightbox { position: fixed; inset: 0; z-index: 160; display: grid; padding: 42px; place-items: center; background: rgba(10, 16, 13, .9); backdrop-filter: blur(8px); }
.image-lightbox[hidden] { display: none; }
.image-lightbox img { max-width: min(1200px, 100%); max-height: calc(100vh - 84px); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.4); object-fit: contain; }
.image-lightbox button { position: absolute; top: 18px; right: 22px; display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: white; cursor: pointer; font-size: 25px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 8px; }
.toast { min-width: 240px; padding: 13px 15px; border: 1px solid #dfe4df; border-radius: 11px; background: #17211d; color: white; box-shadow: 0 16px 35px rgba(21,33,27,.22); font-size: 10px; animation: toastIn .25s ease; }
.toast.error { background: #8f3136; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1160px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .performance-panel { grid-column: auto; }
  .tag-performance { grid-template-columns: repeat(2, 1fr); }
  .calculator-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .field-grid.four { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { width: 210px; }
  .main-content { margin-left: 210px; padding-inline: 24px; }
  .journal-layout, .calculator-layout { grid-template-columns: 1fr; }
  .journal-aside { grid-template-columns: 1fr 1fr; position: static; }
  .calculator-result { position: static; }
  .field-grid.three { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  body { background: #f5f7f4; }
  .sidebar { display: none; }
  .main-content { margin: 0; padding: 74px 16px 96px; }
  .mobile-header { position: fixed; inset: 0 0 auto; z-index: 40; display: flex; height: 58px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
  .mobile-header .brand { gap: 8px; }
  .mobile-header .brand-mark { width: 31px; height: 31px; flex-basis: 31px; border-radius: 9px; font-size: 12px; }
  .mobile-header .brand b { font-size: 15px; }
  .icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 20px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 50; display: grid; height: 68px; grid-template-columns: repeat(5, 1fr); padding: 7px 9px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(14px); }
  .mobile-nav button { display: grid; place-items: center; gap: 2px; border: 0; background: transparent; color: #929b95; font-size: 8px; }
  .mobile-nav button span { font-size: 16px; }
  .mobile-nav button.active { color: var(--blue); font-weight: 800; }
  .mobile-nav .mobile-create { width: 45px; height: 45px; margin: -20px auto 0; border-radius: 15px; background: var(--blue); color: white; box-shadow: 0 8px 20px rgba(53,109,243,.3); font-size: 24px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 30px; letter-spacing: -1.4px; }
  .page-heading > .primary-button { display: none; }
  .compact-heading { display: grid; }
  .heading-actions { width: 100%; overflow-x: auto; padding-bottom: 3px; }
  .heading-actions .primary-button { display: inline-flex; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 130px; padding: 16px; border-radius: 15px; }
  .metric-card > strong { font-size: 25px; }
  .best-card > strong { font-size: 15px; }
  .insight-banner { align-items: flex-start; }
  .insight-banner .text-button { display: none; }
  .trades-panel, .performance-panel, .equity-panel, .combo-panel { padding: 16px; }
  .trade-table { min-width: 620px; }
  .tag-performance { grid-template-columns: 1fr; }
  .journal-toolbar { flex-wrap: wrap; }
  .search-box { width: 100%; min-width: 100%; }
  .segmented-filter { flex: 1; justify-content: space-around; }
  .journal-aside { grid-template-columns: 1fr; }
  .field-grid.two, .field-grid.three, .field-grid.four { grid-template-columns: 1fr; }
  .calculator-form { padding: 20px 17px; }
  .choice-row.split { grid-template-columns: 1fr; }
  .journal-modal { max-height: 100vh; border-radius: 0; }
  .modal-backdrop { padding: 0; }
  .modal-header, .modal-scroll { padding-inline: 18px; }
  .modal-footer { padding-inline: 18px; }
  .sync-modal { max-height: calc(100vh - 24px); border-radius: 18px; }
  .sync-modal-body { padding-inline: 18px; }
  .sync-modal-footer { flex-wrap: wrap; }
  .sync-modal-footer .primary-button { width: 100%; margin-left: 0; order: -1; }
  .image-lightbox { padding: 18px; }
  .image-preview { grid-template-columns: 68px minmax(0, 1fr) auto; }
  .image-preview img { width: 68px; height: 52px; }
  .toast-region { right: 12px; bottom: 80px; left: 12px; }
  .toast { min-width: 0; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 124px; }
  .metric-card > strong { font-size: 21px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .journal-card-bottom { align-items: flex-start; flex-direction: column; gap: 10px; }
  .journal-card-bottom dl { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
