/* StockNote x58: consistent control scale, quiet stock list, context-first writing and appearance preferences.
   This file only affects presentation; the existing stock, trade, review and backup schemas stay unchanged. */
:root {
  --control-height: 44px;
  --control-font: 14px;
  --quiet-foreground: #596575;
  --quiet-foreground-soft: #717e8d;
  --list-separator: #edf0f4;
}
html,body { font-family:-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Pretendard","Noto Sans KR","Segoe UI",sans-serif; }
button { line-height:1.35; }
button:disabled { cursor:default; opacity:.45; }
.btn {
  min-height:var(--control-height) !important;
  font-size:var(--control-font) !important;
  padding:0 14px !important;
  display:inline-flex; align-items:center; justify-content:center;
  gap:6px;
}
.icon-btn { min-width:40px !important; min-height:40px !important; padding:0 !important; font-size:19px !important; line-height:1 !important; }
.icon-btn .ui-icon, .icon-btn svg { width:19px; height:19px; flex:none; }
.search-clear { min-width:34px !important; min-height:34px !important; display:inline-flex; align-items:center; justify-content:center; font-size:14px !important; line-height:1 !important; }
.segment { min-height:42px; font-size:14px; }
.mini-link, .compact-note-link, .section-inline-action { font-size:13px !important; }
.note-inline-filter-wrap,.note-inline-sort-wrap { min-height:38px !important; }
.note-inline-filter-label,.note-inline-sort-label { color:#4e5c6d !important; }
.note-inline-filter-caret,.note-inline-sort-caret { color:#596575 !important; }
.row-action-chip { padding:0 12px !important; min-height:36px !important; font-size:12.5px !important; line-height:1.25; }
.btn.text.section-inline-action { width:auto !important; min-height:38px !important; padding:0 6px !important; }
.section-title-with-action { align-items:center; }
.section-title-with-action .section-title-copy { gap:8px; }
.modal-head .icon-btn { border-radius:11px !important; }
#modalRoot .btn { flex:1 1 auto; }
#modalRoot .modal-head .btn { flex:0 0 auto; }
#modalRoot .icon-btn { flex:0 0 40px; }
#modalRoot .field label { font-size:13px !important; line-height:1.35; }
#modalRoot .fields { gap:13px; }
#modalRoot input,#modalRoot select { min-height:45px; font-size:15px; }
#modalRoot textarea { font-size:15px; line-height:1.5; }

/* Home: settings sits opposite the title without visually competing with it. */
.home-header-v2 { align-items:center !important; }
.home-settings-button {
  display:inline-flex; align-items:center; justify-content:center;
  width:42px; height:42px; flex:0 0 42px;
  color:#586575; background:transparent; border-radius:12px;
}
.home-settings-button svg { display:block; width:22px; height:22px; }
.home-settings-button:active { background:#f3f6f9; }
.home-settings-button:focus-visible, .screen-compose-btn:focus-visible, .stock-list-item__open:focus-visible, .stock-list-item__action:focus-visible, .appearance-option:focus-visible {
  outline:3px solid rgba(49,130,246,.36); outline-offset:2px;
}

/* A small, consistent per-tab writing action. The global + menu remains available. */
.screen-compose-btn {
  display:inline-flex; justify-content:center; align-items:center; gap:4px;
  flex:0 0 auto; min-height:38px; padding:0 12px;
  color:#176ad8; background:#edf4ff; border-radius:11px;
  font-size:13px; font-weight:700; white-space:nowrap;
}
.screen-compose-btn span { font-family:Arial,sans-serif; font-size:21px; line-height:1; font-weight:400; transform:translateY(-1px); }
.screen-compose-btn:active { background:#dceafe; }

/* Stock cards are now one information-led list. Critical status/due signals stay visible,
   while low-priority meta, snippets, and duplicate 'detail' links live in the detail screen. */
.stock-list-item {
  display:block; min-width:0; margin:0; padding:20px 0 13px;
  border-bottom:1px solid var(--list-separator);
  background:transparent; color:var(--text); cursor:pointer;
}
.stock-list-item:first-of-type { padding-top:17px; }
.stock-list-item__open { display:block; padding:0; width:100%; text-align:left; color:inherit; border-radius:7px; }
.stock-list-item__open:active { opacity:.82; }

.stock-list-item__heading { display:flex; align-items:center; justify-content:space-between; min-width:0; gap:8px; }
.stock-list-item__identity { display:flex; align-items:center; gap:11px; min-width:0; flex:1 1 auto; }
.stock-list-item__logo { flex:0 0 42px; width:42px; height:42px; display:flex; align-items:center; justify-content:center; }
.stock-list-item__logo .row-logo-slot { width:42px !important; height:42px !important; }
.stock-list-item__names { min-width:0; display:flex; flex-direction:column; justify-content:center; gap:3px; }
.stock-list-item__name { min-width:0; font-size:16px; font-weight:750; letter-spacing:-.025em; line-height:1.28; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.stock-list-item__ticker { font-size:11.5px; color:var(--quiet-foreground-soft); line-height:1.2; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.stock-list-item__status.badge { flex:0 0 auto; max-width:95px; overflow:hidden; text-overflow:ellipsis; padding:0 9px !important; font-size:11.5px !important; height:27px !important; border-radius:8px !important; }
.stock-list-item__thesis { margin:12px 0 0; color:#495564; font-size:14px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }
.stock-list-item__context { margin:5px 0 0; font-size:12.5px; color:var(--quiet-foreground-soft); line-height:1.5; overflow-wrap:anywhere; }
.stock-list-item__signals { display:flex; flex-wrap:wrap; align-items:center; gap:5px 0; margin-top:10px; font-size:12px; font-weight:500; color:var(--quiet-foreground); line-height:1.35; }
.stock-list-item__signals span+span::before { content:'·'; color:#b8c0c8; padding:0 7px; }
.stock-list-item__signal--warning { color:#ba6b23; }
.stock-list-item__footer { margin-top:8px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.stock-list-item__updated { font-size:11px; line-height:1.3; color:#86919e; }
.stock-list-item__actions { display:flex; gap:5px; align-items:center; flex:0 0 auto; }
.stock-list-item__action { display:inline-flex; align-items:center; justify-content:center; min-width:58px; min-height:36px; padding:0 12px; border-radius:10px; background:#f4f6f9; color:#526171; font-weight:650; font-size:12.5px; }
.stock-list-item__action--review { color:#176ad8; background:#edf4ff; }
.stock-list-item__action:active { filter:brightness(.96); }
@media (hover:hover) { .stock-list-item:hover .stock-list-item__name { color:var(--primary); } }

/* Stock detail: three equally clear actions, no cramped labels. */
#notesScreen .detail-primary-actions { display:grid !important; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px !important; }
#notesScreen .detail-primary-actions .btn { width:100% !important; min-width:0 !important; padding:0 5px !important; font-size:12.5px !important; min-height:44px !important; white-space:nowrap; }
#notesScreen .detail-action-btn--trade { color:#fff !important; }
#notesScreen .detail-action-btn--review { background:#f3f6fa !important; color:#405064 !important; }

/* Settings: actual options rather than decorative toggles. */
.settings-section { margin:0 0 22px; }
.settings-section h3 { margin:0; font-size:16px; font-weight:750; line-height:1.4; }
.settings-section p { margin:5px 0 14px; color:var(--muted); line-height:1.55; font-size:13px; }
.appearance-options { display:grid; grid-template-columns:1fr; gap:8px; }
.appearance-option { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 15px; min-height:64px; text-align:left; background:#f6f8fa; border:1.5px solid transparent; border-radius:13px; }
.appearance-option.is-selected { border-color:var(--primary); background:#eff5ff; }
.appearance-option__copy { display:flex; flex-direction:column; gap:3px; min-width:0; }
.appearance-option__copy strong { font-size:14px; line-height:1.4; font-weight:700; }
.appearance-option__copy small { font-size:12px; line-height:1.4; color:var(--muted); }
.appearance-option__check { display:inline-flex; align-items:center; justify-content:center; width:21px; height:21px; flex:0 0 21px; font-weight:800; color:var(--primary); font-size:18px; }
.settings-storage-note { padding-top:18px; border-top:1px solid var(--line); margin:0; }
.settings-storage-note p { margin:8px 0 0; }

/* Global controls use restrained highlights, not washes of accent color. */
.quick-action-item__label { font-size:14px !important; font-weight:700 !important; }
.quick-action-item__hint { font-size:12px !important; }
.quick-action-handle__bars::before { font-size:14px !important; }
.badge.invalid,.badge.due-today { font-weight:700 !important; }
@media(max-width:355px) {
  .stock-list-item__identity { gap:8px; }
  .stock-list-item__logo,.stock-list-item__logo .row-logo-slot { width:38px !important; height:38px !important; flex-basis:38px; }
  .stock-list-item__name { font-size:15px; }
  .stock-list-item__signals { font-size:11px; }
  .stock-list-item__signals span+span::before { padding:0 5px; }
  .stock-list-item__action { min-width:52px; padding:0 9px; }
  .screen-compose-btn { padding:0 9px; }
}

/* Complete dark theme: neutral surfaces and explicit semantic profit/loss colors. */
html[data-stocknote-theme="dark"] {
  --bg:#15171c; --bg-accent:#15171c;
  --panel:#1d2128; --panel-soft:#252a33;
  --text:#e9edf3; --text-strong:#f5f7fb;
  --muted:#acb5c1; --muted-soft:#9aa6b5;
  --line:#343b45; --line-strong:#434b57;
  --slate-soft:#292f39;
  --primary:#72a8ff; --primary-strong:#95beff;
  --primary-soft:#263a55; --primary-soft-strong:#314a6a;
  --profit:#ff7972; --profit-soft:#4a2b30; --buy:#ff7972; --buy-soft:#4a2b30;
  --loss:#77aaff; --loss-soft:#243953; --sell:#77aaff; --sell-soft:#243953;
  --warn:#ffc078; --warn-soft:#493923; --danger:#ffb68f; --danger-soft:#4d332b;
  --quiet-foreground:#aab6c5; --quiet-foreground-soft:#9ba8b9; --list-separator:#313842;
  color-scheme:dark;
}
html[data-stocknote-theme="dark"],html[data-stocknote-theme="dark"] body { background:#0f1217 !important; color:var(--text) !important; }
html[data-stocknote-theme="dark"] .app { background:#15171c !important; box-shadow:none !important; }
html[data-stocknote-theme="dark"] .screen { color:var(--text) !important; }
html[data-stocknote-theme="dark"] .title,
html[data-stocknote-theme="dark"] .home-title-v2,
html[data-stocknote-theme="dark"] .section-title h2,
html[data-stocknote-theme="dark"] .home-section-title-v2,
html[data-stocknote-theme="dark"] .modal-title,
html[data-stocknote-theme="dark"] .stock-list-item__name,
html[data-stocknote-theme="dark"] .row-name,
html[data-stocknote-theme="dark"] .stock-detail-title,
html[data-stocknote-theme="dark"] .card[data-trade-card-id] .trade-record-title strong,
html[data-stocknote-theme="dark"] .card[data-review-card-id] .review-record-title strong { color:var(--text-strong) !important; }
html[data-stocknote-theme="dark"] .stock-list-item__thesis,
html[data-stocknote-theme="dark"] .note-line,
html[data-stocknote-theme="dark"] .connection-main { color:#d2d9e3 !important; }
html[data-stocknote-theme="dark"] .stock-list-item__status.badge,
html[data-stocknote-theme="dark"] .badge.tag,
html[data-stocknote-theme="dark"] .badge.hold,
html[data-stocknote-theme="dark"] .badge.closed,
html[data-stocknote-theme="dark"] .badge.avgprice,
html[data-stocknote-theme="dark"] .badge.watch,
html[data-stocknote-theme="dark"] .badge.keep { color:#bec7d3 !important; background:#2b313b !important; }
html[data-stocknote-theme="dark"] .badge.buy { color:var(--buy) !important; background:var(--buy-soft) !important; }
html[data-stocknote-theme="dark"] .badge.sell { color:var(--sell) !important; background:var(--sell-soft) !important; }
html[data-stocknote-theme="dark"] .stock-list-item__signal--warning { color:#f2b075; }
html[data-stocknote-theme="dark"] .badge.shaky,
html[data-stocknote-theme="dark"] .badge.invalid,
html[data-stocknote-theme="dark"] .badge.due-today { color:#ffbf86 !important; background:#473628 !important; }
html[data-stocknote-theme="dark"] .home-summary-card-v2,
html[data-stocknote-theme="dark"] .home-empty-card,
html[data-stocknote-theme="dark"] .analysis-hero-card,
html[data-stocknote-theme="dark"] .analysis-metric-grid .metric,
html[data-stocknote-theme="dark"] .detail-metrics-grid .metric,
html[data-stocknote-theme="dark"] .metric,
html[data-stocknote-theme="dark"] .secondary-block,
html[data-stocknote-theme="dark"] .analysis-diagnosis-line,
html[data-stocknote-theme="dark"] .analysis-compare-line,
html[data-stocknote-theme="dark"] .analysis-scope-banner,
html[data-stocknote-theme="dark"] .review-pending-section,
html[data-stocknote-theme="dark"] .detail-trade-preview-modal-row,
html[data-stocknote-theme="dark"] .card:not([data-trade-card-id]):not([data-review-card-id]):not(.compact-card) { color:var(--text) !important; background:#222731 !important; border-color:#343b45 !important; }
html[data-stocknote-theme="dark"] .home-summary-card-v2 .summary-value-v2,
html[data-stocknote-theme="dark"] .home-summary-card-v2.is-clear .summary-item-v2:first-child .summary-value-v2 { color:var(--text-strong) !important; }
html[data-stocknote-theme="dark"] .home-summary-card-v2.has-tasks .summary-item-v2:first-child .summary-value-v2 { color:var(--primary) !important; }
html[data-stocknote-theme="dark"] .summary-divider-v2,
html[data-stocknote-theme="dark"] .divider { background:var(--line) !important; }
html[data-stocknote-theme="dark"] .home-list-row,
html[data-stocknote-theme="dark"] .card[data-trade-card-id],
html[data-stocknote-theme="dark"] .card[data-review-card-id],
html[data-stocknote-theme="dark"] .review-segment-row,
html[data-stocknote-theme="dark"] .trade-summary-line,
html[data-stocknote-theme="dark"] .detail-collapsible-section { border-color:var(--line) !important; }
html[data-stocknote-theme="dark"] .home-settings-button,
html[data-stocknote-theme="dark"] .icon-btn,
html[data-stocknote-theme="dark"] .note-inline-filter-label,
html[data-stocknote-theme="dark"] .note-inline-sort-label,
html[data-stocknote-theme="dark"] .note-inline-filter-caret,
html[data-stocknote-theme="dark"] .note-inline-sort-caret { color:#bec8d6 !important; }
html[data-stocknote-theme="dark"] .home-settings-button:active,
html[data-stocknote-theme="dark"] .icon-btn:active { background:#2d3541 !important; }
html[data-stocknote-theme="dark"] .screen-compose-btn,
html[data-stocknote-theme="dark"] .row-action-chip,
html[data-stocknote-theme="dark"] .btn.secondary,
html[data-stocknote-theme="dark"] .stock-list-item__action--review { color:#9cc5ff !important; background:#283d59 !important; }
html[data-stocknote-theme="dark"] .btn.primary,
html[data-stocknote-theme="dark"] .detail-action-btn--trade,
html[data-stocknote-theme="dark"] .quick-action-handle { color:#111b2a !important; background:#82b4ff !important; border-color:#82b4ff !important; }
html[data-stocknote-theme="dark"] .btn.ghost,
html[data-stocknote-theme="dark"] #notesScreen .detail-action-btn--review,
html[data-stocknote-theme="dark"] .stock-list-item__action { background:#2c333e !important; color:#e0e6ef !important; }
html[data-stocknote-theme="dark"] .search-box,
html[data-stocknote-theme="dark"] .search-box:focus-within,
html[data-stocknote-theme="dark"] input,
html[data-stocknote-theme="dark"] textarea,
html[data-stocknote-theme="dark"] select { color:var(--text) !important; background:#252b35 !important; border-color:#414b5a !important; }
html[data-stocknote-theme="dark"] input::placeholder,
html[data-stocknote-theme="dark"] textarea::placeholder { color:#a0aaba !important; }
html[data-stocknote-theme="dark"] .search-box input { background:transparent !important; border-color:transparent !important; }
html[data-stocknote-theme="dark"] .search-box .search-icon,
html[data-stocknote-theme="dark"] .search-clear { color:#b8c4d2 !important; }
html[data-stocknote-theme="dark"] .tabbar { background:rgba(22,25,31,.98) !important; border-color:#323943 !important; }
html[data-stocknote-theme="dark"] .tab { color:#a0adbc !important; }
html[data-stocknote-theme="dark"] .tab.active { color:var(--primary) !important; }
html[data-stocknote-theme="dark"] .quick-action-sheet,
html[data-stocknote-theme="dark"] .modal,
html[data-stocknote-theme="dark"] .modal.center { background:#20252d !important; color:var(--text) !important; border-color:#3a424e !important; }
html[data-stocknote-theme="dark"] .quick-action-item { color:var(--text) !important; border-color:#38404d !important; }
html[data-stocknote-theme="dark"] .quick-action-item__hint,
html[data-stocknote-theme="dark"] .small.muted,
html[data-stocknote-theme="dark"] .muted,
html[data-stocknote-theme="dark"] .row-subtext,
html[data-stocknote-theme="dark"] .row-date,
html[data-stocknote-theme="dark"] .search-meta,
html[data-stocknote-theme="dark"] .stock-list-item__updated { color:#aab6c5 !important; }
html[data-stocknote-theme="dark"] .review-segment-row .segment { color:#aeb9c7 !important; }
html[data-stocknote-theme="dark"] .review-segment-row .segment.active { color:var(--text-strong) !important; }
html[data-stocknote-theme="dark"] .data-management-fold,
html[data-stocknote-theme="dark"] .detail-collapsible-section { background:#1d2229 !important; border-color:#37404b !important; }
html[data-stocknote-theme="dark"] .data-management-summary,
html[data-stocknote-theme="dark"] .detail-collapsible-summary { color:var(--text) !important; }
html[data-stocknote-theme="dark"] .data-management-summary:active,
html[data-stocknote-theme="dark"] .detail-collapsible-summary:active { background:#29303a !important; }
html[data-stocknote-theme="dark"] .appearance-option { background:#292f39; color:#e2e8f1; }
html[data-stocknote-theme="dark"] .appearance-option.is-selected { background:#273d5b; border-color:#81b4ff; }
html[data-stocknote-theme="dark"] .appearance-option__check { color:#99c4ff; }
html[data-stocknote-theme="dark"] .settings-storage-note { border-color:var(--line); }
html[data-stocknote-theme="dark"] .settings-section h3 { color:var(--text-strong); }
html[data-stocknote-theme="dark"] .pnl-positive,html[data-stocknote-theme="dark"] .pnl-positive .pnl-value { color:var(--profit) !important; }
html[data-stocknote-theme="dark"] .pnl-negative,html[data-stocknote-theme="dark"] .pnl-negative .pnl-value { color:var(--loss) !important; }
html[data-stocknote-theme="dark"] .note-trade-history-footer { background:#20252d !important; border-color:var(--line) !important; }
html[data-stocknote-theme="dark"] .logo-attribution { color:#96a6ba !important; }
html[data-stocknote-theme="dark"] .toast { background:#3a4350 !important; color:#fff !important; }

/* Last-mile contrast and equal-action fixes. */
#notesScreen .detail-primary-actions .detail-action-btn--trade.btn.secondary {
  color:#45566b !important; background:#f3f6fa !important;
}
#notesScreen .detail-primary-actions .detail-action-btn--review.btn.secondary {
  color:#176ad8 !important; background:#eaf2ff !important;
}
html[data-stocknote-theme="dark"] .home-empty-card h3,
html[data-stocknote-theme="dark"] .home-empty-card--large h3 { color:#e5ebf4 !important; }
html[data-stocknote-theme="dark"] .home-empty-card p,
html[data-stocknote-theme="dark"] .home-empty-card--large p { color:#b4bfcc !important; }
html[data-stocknote-theme="dark"] .home-summary-card-v2 .summary-label-v2,
html[data-stocknote-theme="dark"] .home-section-link-v2 { color:#b2bdcb !important; }
html[data-stocknote-theme="dark"] .home-summary-card-v2 .summary-divider-v2 { background:#424955 !important; }
html[data-stocknote-theme="dark"] #notesScreen .detail-primary-actions .detail-action-btn--trade.btn.secondary { color:#dce4ef !important; background:#303946 !important; }
html[data-stocknote-theme="dark"] #notesScreen .detail-primary-actions .detail-action-btn--review.btn.secondary { color:#a7caff !important; background:#2a3f5e !important; }

html[data-stocknote-theme="dark"] .stock-list-item__action--review {
  color:#a7caff !important; background:#293f5d !important;
}

/* Dark theme: detail fold panels and trade navigation had hard-coded light !important rules. */
html[data-stocknote-theme="dark"] .detail-collapsible-summary,
html[data-stocknote-theme="dark"] .detail-collapsible-body {
  background:#1d2229 !important;
  color:#e4ebf4 !important;
}
html[data-stocknote-theme="dark"] .detail-collapsible-title strong { color:#e4ebf4 !important; }
html[data-stocknote-theme="dark"] .detail-collapsible-caret { color:#b5bfcb !important; }
html[data-stocknote-theme="dark"] .summary-link,
html[data-stocknote-theme="dark"] .detail-record-btn--trade,
html[data-stocknote-theme="dark"] .detail-record-btn--review {
  background:#303946 !important;
  border-color:#455165 !important;
  color:#d9e8ff !important;
}
html[data-stocknote-theme="dark"] #modalRoot .field label {color:#cbd6e3 !important;}
html[data-stocknote-theme="dark"] .data-management-summary strong {color:#e3ebf5 !important;}
html[data-stocknote-theme="dark"] .schedule-chip {
  color:#dce5ee !important;
  background:#29313c !important;
  border-color:#435065 !important;
}
html[data-stocknote-theme="dark"] .backup-recommendation {
  background:#453526 !important;
  color:#ffd2a0 !important;
}
html[data-stocknote-theme="dark"] .detail-collapsible-body .list-item {
  border-color:#38434f !important;
  color:#e0e7f3 !important;
}

/* Trade/review surfaces in night mode: preserve contrast against legacy high-specificity pill styles. */
html[data-stocknote-theme="dark"] .card[data-trade-card-id] .badge.tag,
html[data-stocknote-theme="dark"] .card[data-review-card-id] .badge.tag {
  background:#2b313b !important;
  color:#cad4e0 !important;
}
html[data-stocknote-theme="dark"] .card[data-trade-card-id] .divider,
html[data-stocknote-theme="dark"] .card[data-review-card-id] .divider {
  background:#39424f !important;
}
html[data-stocknote-theme="dark"] .card[data-trade-card-id] .mini-link,
html[data-stocknote-theme="dark"] .card[data-review-card-id] .mini-link {
  color:#9db6d6 !important;
}
