@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:         #0b0b0c;
  --sidebar-bg: #0f1011;
  --surface:    #141516;
  --surface2:   #1a1b1d;
  --surface3:   #202224;
  --border:     rgba(255,255,255,0.06);
  --border-med: rgba(255,255,255,0.10);
  --accent:     #4dab9a;
  --accent-dim: rgba(77,171,154,0.12);
  --accent-text:#4dab9a;
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,0.10);
  --red:        #f43f5e;
  --red-dim:    rgba(244,63,94,0.10);
  --yellow:     #eab308;
  --text:       #f0f0f2;
  --text-dim:   rgba(162,162,173,0.72);
  --text-muted: rgba(162,162,173,0.45);
  --sidebar-w:  240px;
  --sidebar-w-collapsed: 58px;
  --radius:     10px;
  --radius-sm:  7px;
}

body {
  font-family: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 50;
  transition: width 0.22s ease;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 57px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

/* Pulsante toggle sidebar */
.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
  margin-left: auto;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.06); color: var(--text); border-color: var(--border-med); }

/* ── SIDEBAR COLLASSATA ── */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed ~ .main {
  margin-left: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-account-section,
.sidebar.collapsed .user-info,
.sidebar.collapsed .save-status-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}
/* logo-text rimosso completamente dal flusso flex → logo perfettamente centrato */
.sidebar.collapsed .logo-text {
  display: none;
}
.sidebar.collapsed .sidebar-top {
  justify-content: center;
  padding: 18px 0 14px;
  gap: 0;
}
.sidebar.collapsed .logo-icon {
  margin: 0 auto;
}
.sidebar.collapsed .sidebar-toggle {
  display: none;
}
.sidebar.collapsed .logo-icon {
  cursor: pointer;
  transition: transform 0.15s;
}
.sidebar.collapsed .logo-icon:hover {
  transform: scale(1.15);
}
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 9px 0;
  gap: 0;
  margin-left: 0;
  border-left: none;
  width: 100%;
}
.sidebar.collapsed .sidebar-section ul {
  padding: 0;
  margin: 0;
  align-items: center;
}
.sidebar.collapsed .sidebar-section li {
  width: 100%;
  display: flex;
  justify-content: center;
}
.sidebar.collapsed .nav-icon {
  font-size: 16px;
  display: flex;
  justify-content: center;
  width: 20px;
  text-align: center;
}
.sidebar.collapsed .sidebar-section {
  padding: 16px 0 8px;
}
.sidebar.collapsed .save-status-bar {
  justify-content: center;
  padding: 8px 0;
  gap: 0;
}
.sidebar.collapsed .save-dot {
  display: none;
}
.sidebar.collapsed .save-status-text {
  display: none;
}
.sidebar.collapsed .save-now-btn {
  margin-left: 0;
  opacity: 0.55;
  width: auto;
  padding: 5px 10px;
  font-size: 15px;
  justify-content: center;
}
.sidebar.collapsed .sidebar-bottom {
  padding: 4px 0 10px;
}
.sidebar.collapsed .user-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border-color: transparent;
  padding: 6px 0;
}
.sidebar.collapsed .user-avatar {
  margin: 0;
}
.sidebar.collapsed .settings-gear-btn {
  margin-left: 0;
  opacity: 0.6;
}

.sidebar-section {
  padding: 20px 10px 8px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
  border-left: 2px solid transparent;
  margin-left: -2px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.nav-link.active {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-left-color: var(--accent);
}

.nav-icon { font-size: 14px; opacity: 0.8; }

/* ── SAVE STATUS BAR ─────────────────────────── */
.save-status-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  transition: background 0.3s;
}
.save-dot-ok     { background: var(--green); box-shadow: 0 0 5px rgba(34,197,94,0.4); }
.save-dot-err    { background: var(--red);   box-shadow: 0 0 5px rgba(244,63,94,0.4); }
.save-dot-saving { background: var(--yellow); animation: pulse-dot 1s infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.save-status-text {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.save-now-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.5;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s;
  line-height: 1;
}
.save-now-btn:hover { opacity: 1; background: rgba(255,255,255,0.06); }

.sidebar-bottom {
  padding: 10px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
}
.user-card .user-info { flex: 1; min-width: 0; }
.user-card .settings-gear-btn { margin-left: auto; }

/* Popup selezione account (sidebar collassata) */
.sidebar-acct-popup {
  position: fixed;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 4px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 180px;
}
.sidebar-acct-popup .acct-option {
  display: block;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-acct-popup .acct-option:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar-acct-popup .acct-option.active { color: var(--accent); }
.sidebar-acct-popup .acct-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 4px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  border: none;
  cursor: default;
  font-family: inherit;
}
.sidebar.collapsed .user-avatar {
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s;
}
.sidebar.collapsed .settings-gear-btn:hover {
  opacity: 1;
}
.sidebar.collapsed .user-avatar:hover {
  background: rgba(77,171,154,0.22);
}

.user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub  { font-size: 11px; color: var(--text-muted); }

/* ── MAIN ────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 40px 44px;
  transition: margin-left 0.22s ease;
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

/* ── WIDGET DOWNLOAD BANNER ──────────────────── */
.widget-download-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(77,171,154,0.12) 0%, rgba(77,171,154,0.06) 100%);
  border: 1px solid rgba(77,171,154,0.3);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 28px;
}
.widget-download-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.widget-download-icon { font-size: 28px; line-height: 1; }
.widget-download-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.widget-download-sub  { font-size: 12px; color: var(--text-dim); }
.widget-upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── PAGE HEADER ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── STATS GRID ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s;
}

.stat-card:hover { border-color: var(--border-med); }

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }

/* ── SECTION TITLE ───────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 28px 0 14px;
}

/* ── TABLE ───────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

thead tr {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover { background: rgba(77,171,154,0.08) !important; }

td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
}

.tag-long  { color: var(--green); font-weight: 600; font-size: 12px; }
.tag-short { color: var(--red);   font-weight: 600; font-size: 12px; }
.pnl-pos   { color: var(--green); font-weight: 600; }
.pnl-neg   { color: var(--red);   font-weight: 600; }
.pnl-zero  { color: var(--text-muted); }

/* ── TAGS/BADGES ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

.badge-green  { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.2); }
.badge-red    { background: var(--red-dim);   color: var(--red);   border-color: rgba(244,63,94,0.2); }
.badge-accent { background: var(--accent-dim);color: var(--accent);border-color: rgba(77,171,154,0.2); }
.badge-gray   { background: var(--surface3);  color: var(--text-dim); border-color: var(--border); }

/* ── FORM ────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 740px;
}

.form-section {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-section-title::before {
  content: '';
  display: block;
  width: 3px; height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.form-row:last-child { margin-bottom: 0; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, background 0.12s;
  width: 100%;
}

input:hover, select:hover, textarea:hover { border-color: var(--border-med); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface3); }

select { cursor: pointer; }
textarea { resize: vertical; }

/* P&L Preview */
.pnl-box {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all 0.2s;
}

.pnl-box.neutral { color: var(--text-muted); }
.pnl-box.pos { color: var(--green); border-color: rgba(34,197,94,0.25); background: var(--green-dim); }
.pnl-box.neg { color: var(--red);   border-color: rgba(244,63,94,0.25); background: var(--red-dim); }

.pnl-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  padding: 18px 24px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

/* ── BUTTONS ─────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost, .btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.12s, transform 0.1s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary  { background: var(--accent); color: #051010; }
.btn-secondary{ background: var(--surface3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost    { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-accent   { background: rgba(77,171,154,0.15); color: var(--accent); border: 1px solid rgba(77,171,154,0.35); }

.btn-primary:hover  { opacity: 0.88; }
.btn-secondary:hover{ background: var(--surface2); }
.btn-ghost:hover    { color: var(--text); border-color: var(--border-med); }
.btn-accent:hover   { background: rgba(77,171,154,0.25); border-color: var(--accent); }
.btn-primary:active { transform: scale(0.98); }

/* ── FILTERS ─────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.filters input, .filters select {
  padding: 7px 11px;
  font-size: 12px;
  width: auto;
}

.filter-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}

/* ── TABLE ACTION BUTTONS ────────────────────── */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 3px 5px;
  border-radius: 5px;
  transition: color 0.12s, background 0.12s;
}
.btn-icon:hover     { color: var(--text); background: var(--surface3); }
.btn-icon.del:hover { color: var(--red); }

/* ── IMPORT ──────────────────────────────────── */
.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  max-width: 640px;
}

.import-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.import-card p  { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; line-height: 1.6; }
.import-card code {
  background: var(--surface3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--yellow);
  font-family: 'Fira Code', monospace;
}

.file-drop {
  border: 1px dashed var(--border-med);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.import-preview { margin-top: 20px; }
.import-preview h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-dim); }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: 90%;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.modal-close:hover { color: var(--text); background: var(--surface3); }

.modal-body { padding: 20px 22px; }

.modal-row { display: flex; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.modal-field { display: flex; flex-direction: column; gap: 4px; }
.modal-field .mf-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.modal-field .mf-value { font-size: 15px; font-weight: 600; }

.modal-notes {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.modal-notes .mf-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 8px; }
.modal-notes p { color: var(--text); font-size: 13px; line-height: 1.7; white-space: pre-wrap; }

/* ── TOAST ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(0);
}

.toast.success { border-color: rgba(34,197,94,0.4);  color: var(--green);  }
.toast.error   { border-color: rgba(244,63,94,0.4);  color: var(--red);    }
.toast.info    { border-color: rgba(77,171,154,0.4); color: var(--accent); }

.hidden { display: none !important; }

/* ── BTN TOGGLE GROUP ────────────────────────── */
.btn-toggle-group { display: flex; gap: 4px; flex-wrap: wrap; }

.btn-toggle {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  transition: all 0.12s;
  font-family: inherit;
}
.btn-toggle:hover  { background: var(--surface3); color: var(--text); }
.btn-toggle.active { background: var(--surface3); color: var(--text); border-color: var(--border-med); }
.btn-toggle.long.active    { background: rgba(34,197,94,0.12);  color: var(--green);  border-color: rgba(34,197,94,0.3); }
.btn-toggle.short.active   { background: rgba(244,63,94,0.12);  color: var(--red);    border-color: rgba(244,63,94,0.3); }
.btn-toggle.grade-a.active { background: rgba(34,197,94,0.12);  color: var(--green);  border-color: rgba(34,197,94,0.3); }
.btn-toggle.grade-b.active { background: rgba(77,171,154,0.12); color: var(--accent); border-color: rgba(77,171,154,0.3); }
.btn-toggle.grade-c.active { background: rgba(234,179,8,0.12);  color: var(--yellow); border-color: rgba(234,179,8,0.3); }
.btn-toggle.plan-yes.active     { background: rgba(34,197,94,0.12); color: var(--green);  border-color: rgba(34,197,94,0.3); }
.btn-toggle.plan-partial.active { background: rgba(234,179,8,0.12); color: var(--yellow); border-color: rgba(234,179,8,0.3); }
.btn-toggle.plan-no.active      { background: rgba(244,63,94,0.12); color: var(--red);    border-color: rgba(244,63,94,0.3); }

/* ── R:R BOX ──────────────────────────────────── */
.rr-box { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; border: 1px solid var(--border); background: var(--surface2); transition: all 0.2s; }
.rr-box.neutral { color: var(--text-muted); }
.rr-box.pos { color: var(--green); border-color: rgba(34,197,94,0.25); background: var(--green-dim); }
.rr-box.neg { color: var(--red);   border-color: rgba(244,63,94,0.25); background: var(--red-dim); }

/* ── FILTER PANEL ─────────────────────────────── */
.filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row input, .filter-row select { padding: 7px 11px; font-size: 12px; width: auto; }

/* ── BADGE EXTRA ──────────────────────────────── */
.badge-yellow { background: rgba(234,179,8,0.12); color: var(--yellow); border-color: rgba(234,179,8,0.25); }
.badge-muted  { background: var(--surface3); color: var(--text-muted); border-color: var(--border); }
.text-muted   { color: var(--text-muted); font-size: 12px; }
.empty-row    { text-align: center; color: var(--text-muted); padding: 32px !important; }

/* ── SESSION GRID ─────────────────────────────── */
.session-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.session-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.session-name { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.session-pnl  { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.session-pnl.green { color: var(--green); }
.session-pnl.red   { color: var(--red); }
.session-meta { font-size: 11px; color: var(--text-muted); }

/* ── WEEKDAY GRID ─────────────────────────────── */
.weekday-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 28px; }
.weekday-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-align: center; transition: border-color 0.15s; }
.weekday-card.pos { border-color: rgba(34,197,94,0.2); background: rgba(34,197,94,0.04); }
.weekday-card.neg { border-color: rgba(244,63,94,0.2); background: rgba(244,63,94,0.04); }
.wd-name { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.wd-pnl  { font-size: 14px; font-weight: 700; }
.wd-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.weekday-card.pos .wd-pnl { color: var(--green); }
.weekday-card.neg .wd-pnl { color: var(--red); }

/* ── SETUPS GRID ──────────────────────────────── */
.setups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.15s; }
.setup-card:hover { border-color: var(--border-med); }
.setup-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.setup-card-identity { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setup-card-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.setup-name     { font-size: 15px; font-weight: 700; color: var(--text); }
.setup-strategy { font-size: 11px; color: var(--text-muted); }
.setup-version  { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.03em; }
.setup-aliases  { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.setup-alias    { font-size: 10px; color: var(--text-muted); background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.setup-quicknote { font-size: 12px; color: var(--accent); font-style: italic; border-left: 2px solid var(--accent); padding-left: 8px; line-height: 1.4; }
.setup-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px; background: var(--surface2); border-radius: var(--radius-sm); }
.setup-stat       { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.setup-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.setup-stat-val   { font-size: 13px; font-weight: 700; }
.setup-stat-val.green { color: var(--green); }
.setup-stat-val.red   { color: var(--red); }
.setup-thesis { font-size: 12px; color: var(--text-dim); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.setup-actions { display: flex; gap: 8px; margin-top: 4px; }
.label-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── EMPTY STATE ──────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-icon  { font-size: 40px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 13px; margin-bottom: 20px; }

/* ── BULK IMPORT GRID ─────────────────────────── */
.bulk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.bulk-grid .form-group { margin-bottom: 0; }

/* ── MODAL WIDE / XLARGE ──────────────────────── */
.modal-wide   { max-width: 680px; }
.modal-xlarge { max-width: 820px; }

/* ── SCREENSHOT GALLERY ───────────────────────── */
.screenshots-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.screenshot-thumb {
  position: relative;
  width: 110px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.screenshot-thumb:hover { border-color: var(--accent); }
.screenshot-thumb img   { width: 100%; height: 100%; object-fit: cover; display: block; }

.screenshot-delete {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  font-size: 11px;
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.screenshot-thumb:hover .screenshot-delete { opacity: 1; }

.screenshot-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-med);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}
.screenshot-upload-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── LIGHTBOX ─────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: fixed;
  top: 20px; right: 24px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 36px;
  width: 50px; height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
}

/* ── BULK EDIT ───────────────────────────────── */
.col-check {
  width: 36px;
  text-align: center !important;
  padding: 0 4px !important;
}
input[type="checkbox"].trade-checkbox,
input[type="checkbox"]#select-all-trades {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  vertical-align: middle;
  position: relative;
}
input[type="checkbox"].trade-checkbox:hover,
input[type="checkbox"]#select-all-trades:hover {
  border-color: var(--accent);
}
input[type="checkbox"].trade-checkbox:checked,
input[type="checkbox"]#select-all-trades:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 11px 11px;
  background-position: center;
  background-repeat: no-repeat;
}
tr.selected-row td {
  background: rgba(77,171,154,0.06);
}
.bulk-edit-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.bulk-edit-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.bulk-edit-count-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
}
.bulk-edit-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.bulk-edit-fields select,
.bulk-edit-fields input[type="text"] {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  min-width: 120px;
  transition: border-color 0.15s;
}
.bulk-edit-fields select:focus,
.bulk-edit-fields input[type="text"]:focus { border-color: var(--accent); }
.bulk-edit-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

/* ── CALENDARIO ──────────────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.cal-month-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  min-width: 200px;
  text-align: center;
}
.cal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.cal-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-summary-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cal-summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.cal-summary-value.green { color: var(--green); }
.cal-summary-value.red   { color: var(--red); }

.cal-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header-cell {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 4px 12px;
}
.cal-day {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  min-height: 74px;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cal-day.has-trades { cursor: pointer; }
.cal-day.has-trades:hover { border-color: rgba(255,255,255,0.16); }
.cal-day.profit       { background: rgba(34,197,94,0.09);  border-color: rgba(34,197,94,0.22); }
.cal-day.profit-strong{ background: rgba(34,197,94,0.18);  border-color: rgba(34,197,94,0.42); }
.cal-day.loss         { background: rgba(244,63,94,0.09);  border-color: rgba(244,63,94,0.22); }
.cal-day.loss-strong  { background: rgba(244,63,94,0.18);  border-color: rgba(244,63,94,0.42); }
.cal-day.today        { border-color: var(--accent) !important; border-width: 2px; }
.cal-day.other-month  { opacity: 0.2; cursor: default; pointer-events: none; }
.cal-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-day-pnl {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}
.cal-day-pnl.green { color: var(--green); }
.cal-day-pnl.red   { color: var(--red); }
.cal-day-count {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.cal-day-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.cal-day-detail-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cal-day-detail-header .green { color: var(--green); }
.cal-day-detail-header .red   { color: var(--red); }

/* ── CONTI ──────────────────────────────── */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s;
}
.account-card:hover { border-color: var(--border-med); }
.account-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.account-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.account-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.account-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.account-stat { display: flex; flex-direction: column; gap: 3px; }
.account-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
}
.account-stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.account-stat-val.green { color: var(--green); }
.account-stat-val.red   { color: var(--red); }
.account-progress-wrap {
  background: var(--surface3);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
  margin-bottom: 4px;
}
.account-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.4s;
  min-width: 2px;
}
.account-progress-bar.over { background: var(--green); }
.account-progress-bar.neg  { background: var(--red); }
.account-progress-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.account-notes {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.account-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Sidebar account selector */
.sidebar-account-section {
  padding: 0 12px 20px;
}
.sidebar-account-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.sidebar-account-select:hover,
.sidebar-account-select:focus { border-color: var(--accent); }
.sidebar-account-select option { background: var(--surface2); }

/* Mini-calendario Dashboard */
.dash-cal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-cal-nav span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
  text-align: center;
}
.mini-cal-grid .cal-day {
  min-height: 56px;
  padding: 5px 4px;
}
.mini-cal-grid .cal-day-num  { font-size: 0.7rem; }
.mini-cal-grid .cal-day-pnl  { font-size: 0.78rem; }
.mini-cal-grid .cal-day-count{ font-size: 0.58rem; }

/* ── LEAK MAP ────────────────────────────────── */
.lm-window-tabs { display: flex; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; }
.lm-tab { background: none; border: none; color: var(--text-dim); font-family: inherit; font-size: 0.82rem; font-weight: 500; padding: 5px 14px; border-radius: calc(var(--radius) - 2px); cursor: pointer; transition: background 0.15s, color 0.15s; }
.lm-tab:hover { color: var(--text); }
.lm-tab.active { background: var(--surface2); color: var(--text); }

.lm-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.lm-summary-stat { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.lm-summary-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lm-summary-val { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.lm-summary-val.green { color: var(--green); }
.lm-summary-val.red { color: var(--red); }

.lm-next-moves { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.lm-next-title { font-size: 0.7rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.lm-move { font-size: 0.85rem; color: var(--text-dim); display: flex; gap: 8px; line-height: 1.5; }
.lm-move strong { color: var(--text); }

.lm-table-header { display: grid; grid-template-columns: 2fr 1.4fr 1fr 0.7fr 0.7fr 0.7fr 1.2fr; gap: 12px; padding: 8px 16px; font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.lm-section-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 0 6px; }
.lm-label-leak { color: var(--red); }
.lm-label-edge { color: var(--green); margin-top: 12px; }

.lm-rows { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.lm-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr 0.7fr 0.7fr 0.7fr 1.2fr; gap: 12px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color 0.15s; }
.lm-row:hover { border-color: var(--border-med); }

.lm-row-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm-setup-name { font-size: 0.88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-setup-count { font-size: 0.72rem; color: var(--text-muted); }

.lm-row-wr { display: flex; align-items: center; gap: 8px; }
.lm-bar-wrap { flex: 1; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.lm-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.lm-bar-fill-green  { background: var(--green); }
.lm-bar-fill-yellow { background: var(--yellow); }
.lm-bar-fill-red    { background: var(--red); }
.lm-bar-label { font-size: 0.78rem; font-weight: 600; color: var(--text-dim); width: 32px; text-align: right; flex-shrink: 0; }

.lm-row-stat { display: flex; flex-direction: column; gap: 2px; }
.lm-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.lm-stat-val { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.lm-stat-val.green { color: var(--green); }
.lm-stat-val.red { color: var(--red); }

.lm-row-action { display: flex; }
.lm-action { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.lm-action-red    { background: rgba(244,63,94,0.15);  color: var(--red); }
.lm-action-orange { background: rgba(249,115,22,0.15); color: #f97316; }
.lm-action-yellow { background: rgba(234,179,8,0.13);  color: var(--yellow); }
.lm-action-teal   { background: var(--accent-dim);     color: var(--accent); }
.lm-action-green  { background: rgba(34,197,94,0.13);  color: var(--green); }
.lm-action-gray   { background: var(--surface2);       color: var(--text-muted); }

/* ── REPORTS ─────────────────────────────────── */
.reports-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
}
.reports-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 20px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.reports-tab:hover { color: var(--text); }
.reports-tab.active {
  background: var(--surface2);
  color: var(--text);
}
.reports-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.report-card-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}
.report-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.report-grade {
  font-size: 1rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}
.grade-aplus { background: rgba(34,197,94,0.15); color: #22c55e; }
.grade-a     { background: rgba(34,197,94,0.10); color: #4ade80; }
.grade-bplus { background: rgba(234,179,8,0.13); color: #eab308; }
.grade-b     { background: rgba(234,179,8,0.08); color: #ca8a04; }
.grade-c     { background: rgba(244,63,94,0.10); color: #f43f5e; }
.grade-d     { background: rgba(244,63,94,0.15); color: #f43f5e; }
.report-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.report-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.report-stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.report-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 8px 0;
}
.reports-info {
  margin-bottom: 20px;
}
.reports-info-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.reports-info-toggle:hover { color: var(--text); border-color: var(--border-med); }
.reports-info-body {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.reports-grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.reports-grade-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 12px 8px 0;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.reports-grade-table td {
  padding: 5px 12px 5px 0;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.reports-grade-table td:last-child { color: var(--text-dim); }
.reports-info-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.reports-info-note strong { color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════
   BACKTESTER
═══════════════════════════════════════════════════════ */

.bt-filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.bt-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}
.bt-filter-row:last-of-type { margin-bottom: 0; }

.bt-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}
.bt-filter-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.bt-filter-group input,
.bt-filter-group select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.bt-filter-group input:focus,
.bt-filter-group select:focus { border-color: var(--accent); }

.bt-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bt-date-range input { flex: 1; min-width: 110px; }
.bt-date-range > span { color: var(--text-muted); font-size: 12px; flex: 0 0 auto; }

.bt-filter-actions {
  flex-direction: row !important;
  gap: 8px !important;
  align-items: flex-end !important;
  flex: 0 0 auto !important;
  min-width: auto !important;
}

.bt-insights-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.bt-insights-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.bt-insight-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.bt-insight-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Active filters pills */
.bt-active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.bt-filters-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.bt-filter-tag {
  background: var(--accent-dim);
  border: 1px solid rgba(77,171,154,0.25);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
}

/* Stats comparison */
.bt-stats-compare {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}
.bt-stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.bt-stat-card-highlight {
  border-color: rgba(77,171,154,0.35);
  background: rgba(77,171,154,0.03);
}
.bt-stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.bt-stat-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.bt-grade-badge {
  font-size: 12px !important;
  padding: 3px 9px !important;
  min-width: 34px !important;
  text-align: center;
}
.bt-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.bt-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bt-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.bt-stat-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.bt-stat-val.green { color: var(--green); }
.bt-stat-val.red   { color: var(--red);   }
.bt-stat-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}
.bt-compare-arrow {
  font-size: 22px;
  color: var(--accent);
  flex: 0 0 auto;
  align-self: center;
  opacity: 0.6;
}

/* Sections */
.bt-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.bt-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Chart */
.bt-chart-wrap { width: 100%; overflow: hidden; }
.bt-chart-svg  { display: block; width: 100%; height: 180px; }
.bt-chart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 13px;
}

/* Breakdown cards grid */
.bt-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.bt-breakdown-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.bt-breakdown-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.bt-breakdown-pnl {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}
.bt-breakdown-pnl.green { color: var(--green); }
.bt-breakdown-pnl.red   { color: var(--red);   }
.bt-breakdown-meta { font-size: 11px; color: var(--text-muted); }
.bt-breakdown-empty { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   NOTE
══════════════════════════════════════════════════════ */

/* Filtri */
.notes-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.notes-search-input {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
}
.notes-search-input:focus { outline: none; border-color: var(--accent); }
.notes-filter-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-med);
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.notes-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.notes-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Griglia */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

/* Card */
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
}
.note-card:hover { border-color: var(--border-med); transform: translateY(-2px); }
.note-card.is-fav { border-color: rgba(234,179,8,0.35); }

/* Cover immagine */
.note-cover {
  width: 100%;
  height: 170px;
  overflow: hidden;
  background: var(--surface2);
  flex-shrink: 0;
  position: relative;
}
.note-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.note-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.3;
}
.note-cover-count {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

/* Body card */
.note-body {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.note-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.note-date-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 4px;
}
.note-linked-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 7px;
  border-radius: 4px;
}
.note-tags-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.note-tag-chip {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Footer card */
.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
}
.note-fav-star {
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}
.note-fav-star.active { color: var(--yellow); }
.note-card-actions { display: flex; gap: 4px; }

/* Tag input nel modal */
.note-tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 40px;
  cursor: text;
}
.note-tag-input-wrap:focus-within { border-color: var(--accent); }
.note-tag-input-wrap input {
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: 2px 0;
}
.nf-tag-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface3);
  border: 1px solid var(--border-med);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.nf-tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.nf-tag-remove:hover { color: var(--red); }

/* Favorite toggle nel form */
.note-fav-toggle {
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  transition: all 0.15s;
  user-select: none;
}
.note-fav-toggle.active { color: var(--yellow); border-color: rgba(234,179,8,0.4); background: rgba(234,179,8,0.06); }

/* ═══════════════════════════════════════════════════════
   DASHBOARD — EQUITY CURVE
══════════════════════════════════════════════════════ */

.dash-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 16px;
  margin-bottom: 28px;
}
.dash-chart-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.dash-chart-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.dash-chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.dash-chart-wrap {
  position: relative;
  width: 100%;
}
.dash-equity-svg {
  display: block;
  width: 100%;
  height: 200px;
}
.dash-equity-tooltip {
  position: absolute;
  top: 10px;
  left: 60px;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.dash-equity-tooltip.hidden { display: none; }

/* ── Stat sub-label ─────────────────────────── */
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ── Commission Tracker ─────────────────────── */
.dash-commission-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.dash-commission-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 140px;
}
.dash-commission-stats {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  flex-wrap: wrap;
}
.dash-com-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 20px;
  flex: 1;
  min-width: 110px;
}
.dash-com-item:first-child { padding-left: 0; }
.dash-com-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}
.dash-com-label {
  font-size: 11px;
  color: var(--text-muted);
}
.dash-com-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.dash-com-value.green { color: var(--green); }
.dash-com-value.red   { color: var(--red); }

/* ── Trading Pulse ──────────────────────────── */
.dash-pulse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px 16px;
  margin-bottom: 24px;
}
.dash-pulse-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  min-height: 28px;
  align-items: center;
}
.dash-pulse-block {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: default;
  transition: transform 0.1s, opacity 0.1s;
  flex-shrink: 0;
}
.dash-pulse-block:hover {
  transform: scale(1.3);
  opacity: 1 !important;
  z-index: 2;
}
.dash-pulse-block.win  { background: var(--green); opacity: 0.85; }
.dash-pulse-block.loss { background: var(--red);   opacity: 0.85; }
.dash-pulse-block.be   { background: var(--text-muted); opacity: 0.5; }
.dash-pulse-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.dash-pulse-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.dash-pulse-dot.win  { background: var(--green); }
.dash-pulse-dot.loss { background: var(--red); }
.dash-pulse-dot.be   { background: var(--text-muted); }
.dash-pulse-tooltip {
  position: fixed;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  display: none;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* ── Dashboard empty message ────────────────────────── */
.dash-empty-msg {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

/* ── TQS info button + popup ────────────────────────── */
.tqs-info-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-med);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.tqs-info-btn:hover { border-color: var(--accent); color: var(--accent); }
.tqs-info-popup {
  position: absolute;
  top: 28px;
  right: 0;
  width: 320px;
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  padding: 14px 16px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
}
.tqs-info-popup.hidden { display: none; }
.tqs-info-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.tqs-info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 4px;
  font-size: 11px;
}
.tqs-info-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--border);
}
.tqs-info-table td {
  padding: 4px 6px 4px 0;
  color: var(--text-dim);
  vertical-align: top;
}
.tqs-info-table td:first-child { white-space: nowrap; padding-right: 12px; }

/* ── Trade Quality Score ────────────────────────────── */
.tqs-layout {
  display: flex;
  align-items: center;
  gap: 32px;
}
.tqs-gauge-wrap { flex-shrink: 0; }
.tqs-gauge-svg {
  width: 128px;
  height: 80px;
  display: block;
}
.tqs-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tqs-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tqs-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 40px;
  flex-shrink: 0;
}
.tqs-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.tqs-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.tqs-bar-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}
.tqs-bar-na {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Overtrading Analysis ───────────────────────────── */
.ot-stat-row {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}
.ot-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  border-right: 1px solid var(--border);
}
.ot-stat:last-child { border-right: none; }
.ot-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.ot-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}
.ot-bars { display: flex; flex-direction: column; gap: 7px; }
.ot-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ot-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 52px;
  flex-shrink: 0;
}
.ot-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.ot-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  opacity: 0.7;
  transition: width 0.3s ease;
}
.ot-bar-fill.hot { background: var(--yellow); opacity: 0.9; }
.ot-bar-count {
  font-size: 11px;
  color: var(--text-muted);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Revenge Trading Detector ───────────────────────── */
.rv-alert {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.rv-alert-ok   { background: var(--green-dim);              color: var(--green); }
.rv-alert-med  { background: rgba(234,179,8,0.10);          color: var(--yellow); }
.rv-alert-high { background: var(--red-dim);                color: var(--red); }
.rv-stat-row {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
}
.rv-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border-right: 1px solid var(--border);
}
.rv-stat:last-child { border-right: none; }
.rv-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.rv-val.green { color: var(--green); }
.rv-val.red   { color: var(--red); }
.rv-lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}
.rv-list {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.rv-item-date     { color: var(--text-muted); flex-shrink: 0; }
.rv-item-contract { color: var(--text-dim); flex: 1; }
.rv-item-pnl      { font-weight: 600; flex-shrink: 0; }
.rv-item-pnl.green { color: var(--green); }
.rv-item-pnl.red   { color: var(--red); }
.rv-more { font-size: 11px; color: var(--text-muted); text-align: center; padding-top: 4px; }

/* ── 52-Week Consistency Map ────────────────────────── */
.dash-wmap-wrap { width: 100%; overflow-x: auto; }
.wmap-month-row {
  display: grid;
  grid-template-columns: repeat(52, 14px);
  gap: 3px;
  margin-bottom: 4px;
  min-width: fit-content;
}
.wmap-month-label {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  grid-row: 1;
}
.wmap-grid {
  display: grid;
  grid-template-columns: repeat(52, 14px);
  gap: 3px;
  min-width: fit-content;
}
.wmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  cursor: default;
  transition: transform 0.1s;
}
.wmap-cell:hover { transform: scale(1.3); z-index: 2; position: relative; }
.wmap-cell.empty { background: var(--surface2); opacity: 0.4; }
.dash-wmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-muted);
}
.dash-wmap-leg-block {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.dash-wmap-leg-label { padding: 0 2px; }

/* ── Dashboard two-col row ──────────────────────────── */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.dash-dd-svg {
  display: block;
  width: 100%;
  height: 160px;
}

/* ═══════════════════════════════════════════════════════
   PROP TRACKER
══════════════════════════════════════════════════════ */

/* Grid pagina */
.pt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 20px;
}

/* Card challenge */
.pt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: border-color 0.15s;
}
.pt-card-failed {
  border-color: rgba(244,63,94,0.35);
  background: rgba(244,63,94,0.03);
}
.pt-card-passed {
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.03);
}

/* Header card */
.pt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.pt-card-identity { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pt-firm-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 4px;
  width: fit-content;
}
.pt-card-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.pt-card-sub  { font-size: 12px; color: var(--text-muted); }

.pt-card-status-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.pt-card-actions { display: flex; gap: 6px; align-items: center; }

/* Violations */
.pt-violations { display: flex; flex-direction: column; gap: 6px; }
.pt-violation {
  background: rgba(244,63,94,0.10);
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  line-height: 1.4;
}

/* Stats row */
.pt-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 14px 16px;
}
.pt-stat { display: flex; flex-direction: column; gap: 3px; }
.pt-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.pt-stat-val { font-size: 15px; font-weight: 700; }

/* Metriche progress */
.pt-metrics { display: flex; flex-direction: column; gap: 12px; }
.pt-metric  { display: flex; flex-direction: column; gap: 6px; }
.pt-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.pt-metric-label { font-size: 12px; color: var(--text-dim); }
.pt-metric-val   { font-size: 12px; font-weight: 700; white-space: nowrap; }

.pt-dd-type {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface3);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* Barre progresso */
.pt-bar-wrap {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.pt-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
  min-width: 2px;
}
.pt-bar-green  { background: var(--green);  }
.pt-bar-teal   { background: var(--accent); }
.pt-bar-yellow { background: var(--yellow); }
.pt-bar-red    { background: var(--red);    }

/* Nota a fondo card */
.pt-note {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.5;
}

/* ── MODAL — Firm buttons ──────────────────────── */
.pt-firm-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pt-firm-btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-med);
  background: var(--surface2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.pt-firm-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.pt-firm-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── MODAL — Parametri custom ─────────────────── */
.pt-custom-rules {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 16px 18px 8px;
  margin-bottom: 16px;
}
.pt-custom-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── MODAL — Anteprima regole ─────────────────── */
.pt-rules-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.pt-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.pt-rule { display: flex; flex-direction: column; gap: 2px; }
.pt-rule > span    { font-size: 11px; color: var(--text-muted); }
.pt-rule > strong  { font-size: 14px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════
   AI COACH
══════════════════════════════════════════════════════ */

/* Insight cards row */
.coach-insights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.coach-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.coach-insight-card.positive { border-color: rgba(34,197,94,0.3);  background: rgba(34,197,94,0.04);  }
.coach-insight-card.negative { border-color: rgba(244,63,94,0.3);  background: rgba(244,63,94,0.04);  }
.coach-insight-card.warning  { border-color: rgba(234,179,8,0.3);  background: rgba(234,179,8,0.04);  }
.coach-insight-card.neutral  { border-color: rgba(77,171,154,0.3); background: rgba(77,171,154,0.04); }
.coach-insight-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.coach-insight-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.coach-insight-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.coach-insight-desc  { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* Sezione generica */
.coach-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.coach-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* Streak bar */
.coach-streak-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.coach-streak-box {
  flex: 1;
  min-width: 120px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.coach-streak-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.coach-streak-val   { font-size: 28px; font-weight: 800; line-height: 1.1; }
.coach-streak-sub   { font-size: 11px; color: var(--text-muted); }

/* Heatmap giorno × sessione */
.coach-heatmap {
  display: grid;
  grid-template-columns: 70px repeat(3, 1fr);
  gap: 4px;
}
.coach-heatmap-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 4px;
}
.coach-heatmap-row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding-left: 4px;
}
.coach-heatmap-cell {
  border-radius: 6px;
  padding: 10px 8px;
  text-align: center;
  background: var(--surface2);
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.coach-heatmap-cell.empty { opacity: 0.35; }
.coach-cell-pnl   { font-size: 13px; font-weight: 700; }
.coach-cell-meta  { font-size: 10px; color: var(--text-muted); }

/* Tilt / behaviour */
.coach-tilt-list { display: flex; flex-direction: column; gap: 10px; }
.coach-tilt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 12px 16px;
}
.coach-tilt-icon { font-size: 18px; flex-shrink: 0; }
.coach-tilt-body { display: flex; flex-direction: column; gap: 3px; }
.coach-tilt-title { font-size: 13px; font-weight: 700; }
.coach-tilt-desc  { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.coach-tilt-ok    { color: var(--green);  }
.coach-tilt-warn  { color: var(--yellow); }
.coach-tilt-bad   { color: var(--red);    }

/* What-If lab */
.coach-whatif-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}
.coach-whatif-group { display: flex; flex-direction: column; gap: 5px; }
.coach-whatif-group label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.coach-whatif-group select,
.coach-whatif-group input  {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  min-width: 130px;
}
.coach-whatif-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.coach-wi-stat { display: flex; flex-direction: column; gap: 3px; }
.coach-wi-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.coach-wi-val   { font-size: 16px; font-weight: 700; }
.coach-wi-val.green { color: var(--green); }
.coach-wi-val.red   { color: var(--red);   }

/* Comportamento per giorno — barre orizzontali */
.coach-bar-list { display: flex; flex-direction: column; gap: 8px; }
.coach-bar-row  { display: flex; align-items: center; gap: 10px; }
.coach-bar-name { font-size: 12px; font-weight: 600; width: 80px; flex-shrink: 0; }
.coach-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.coach-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; min-width: 2px; }
.coach-bar-fill.green  { background: var(--green);  }
.coach-bar-fill.red    { background: var(--red);    }
.coach-bar-fill.yellow { background: var(--yellow); }
.coach-bar-fill.teal   { background: var(--accent); }
.coach-bar-stat { font-size: 12px; font-weight: 700; width: 70px; text-align: right; flex-shrink: 0; }
.coach-bar-sub  { font-size: 11px; color: var(--text-muted); width: 55px; text-align: right; flex-shrink: 0; }

/* ── HAMBURGER MOBILE ────────────────────────── */
.mobile-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Overlay scuro dietro sidebar su mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 45;
}

/* ── RESPONSIVE ──────────────────────────────── */

/* Mobile: sidebar nascosta, hamburger in alto */
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; transition: transform 0.22s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0 !important; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .mobile-hamburger { display: flex !important; }
  .dash-two-col { grid-template-columns: 1fr; }
  .sidebar-overlay { display: block !important; }
}

/* ══════════════════════════════════════════════════════════
   CHECKLIST EDITOR (Setup form)
══════════════════════════════════════════════════════════ */
.checklist-editor-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
  min-height: 4px;
}

.checklist-editor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
}

.checklist-editor-item .cl-bullet {
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.checklist-editor-item .cl-text {
  flex: 1;
  min-width: 0;
}

.checklist-editor-item .cl-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.checklist-editor-item .cl-del:hover { color: var(--red); }

.checklist-editor-add {
  display: flex;
  gap: 8px;
}

.checklist-editor-add input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.checklist-editor-add input:focus { border-color: var(--accent); }

.checklist-editor-add button {
  background: var(--surface3);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}

.checklist-editor-add button:hover { background: var(--accent-dim); }

/* ══════════════════════════════════════════════════════════
   WIDGET PAGE
══════════════════════════════════════════════════════════ */
#page-widget { padding-top: 32px; }

.nav-link[data-page="widget"] .nav-icon {
  color: #47848f;
}

#widget-content { display: flex; flex-direction: column; gap: 20px; }

#widget-content .card {
  margin-bottom: 24px;
  margin-right: 0;
}

.widget-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.widget-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.widget-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 600;
}

.widget-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0 4px;
}

/* ── Note Rapide — griglia e card ──────────────────────────── */
.widget-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 260px;
  gap: 10px;
}
.widget-note-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}
.widget-note-card:hover {
  border-color: rgba(77,171,154,0.35);
  transform: translateY(-1px);
}
.widget-note-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.widget-note-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wn-no-img   .widget-note-text { -webkit-line-clamp: 12; }
.wn-one-img  .widget-note-text { -webkit-line-clamp: 4; }
.wn-multi-img .widget-note-text { -webkit-line-clamp: 3; }

.widget-note-imgs {
  flex-shrink: 0;
  display: grid;
  gap: 5px;
}
.wn-one-img   .widget-note-imgs { grid-template-columns: 1fr; }
.wn-multi-img .widget-note-imgs { grid-template-columns: 1fr 1fr; }

.widget-note-thumb {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  object-fit: cover;
  object-position: top;
}
.wn-one-img   .widget-note-thumb { height: 120px; }
.wn-multi-img .widget-note-thumb { height: 85px; }
.wn-no-img    .widget-note-thumb { display: none; }

.wn-more-imgs-badge {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  padding-top: 1px;
}

/* ── Category badge ─────────────────────────────────────────── */
.wj-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1.5px solid transparent;
}
.wj-cat-operazioni { background: rgba(77,171,154,0.12); border-color: rgba(77,171,154,0.35); color: var(--accent); }
.wj-cat-studio     { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.35); color: #818cf8; }
.wj-cat-psicologia { background: rgba(234,179,8,0.12);  border-color: rgba(234,179,8,0.35);  color: #eab308; }
.wj-cat-altro      { background: rgba(162,162,173,0.10);border-color: rgba(162,162,173,0.25);color: var(--text-muted); }

/* ── Modal dettaglio nota widget ────────────────────────────── */
#wn-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.wn-modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.18s ease;
}
.wn-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wn-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}
.wn-modal-header-btns { display: flex; gap: 6px; flex-shrink: 0; }
.wn-modal-body {
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.wn-modal-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.wn-modal-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.wn-modal-imgs img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  object-fit: cover;
  max-height: 240px;
  transition: opacity 0.15s;
}
.wn-modal-imgs img:hover { opacity: 0.88; }

.wn-modal-edit-imgs { display: flex; flex-direction: column; gap: 6px; }
.wn-edit-img-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.wn-edit-img-preview { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.wn-edit-img-label { flex: 1; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wn-add-img-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px dashed rgba(77,171,154,0.35);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  justify-content: center;
}
.wn-add-img-btn:hover { background: rgba(77,171,154,0.18); border-color: var(--accent); }

/* ── Day Log — blocchi giornalieri ─────────────────────────── */
.widget-day-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.widget-day-block:last-child { margin-bottom: 0; }
.widget-day-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  text-transform: capitalize;
}

/* ── Widget day rating row ──────────────────────────────────── */
.widget-rating-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.widget-rating-pill {
  flex: 1;
  padding: 4px 6px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  background: var(--surface3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  text-align: center;
}
.widget-rating-pill:hover { background: var(--surface); }
.widget-rating-pill.rating-good.active    { border-color: #22c55e; background: rgba(34,197,94,0.12);  color: #22c55e; }
.widget-rating-pill.rating-neutral.active { border-color: #eab308; background: rgba(234,179,8,0.12);  color: #eab308; }
.widget-rating-pill.rating-bad.active     { border-color: #f43f5e; background: rgba(244,63,94,0.12);  color: #f43f5e; }
.widget-rating-pill.rating-good:hover    { border-color: rgba(34,197,94,0.4); }
.widget-rating-pill.rating-neutral:hover { border-color: rgba(234,179,8,0.4); }
.widget-rating-pill.rating-bad:hover     { border-color: rgba(244,63,94,0.4); }

/* ── Pre/Post sessione ──────────────────────────────────────── */
.widget-sess-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.widget-sess-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}
.widget-sess-card:hover { border-color: rgba(77,171,154,0.2); }
.widget-sess-pre  { border-top: 2px solid rgba(77,171,154,0.5); }
.widget-sess-post { border-top: 2px solid rgba(99,102,241,0.5); }
.widget-sess-label {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 4px;
}
.widget-sess-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 -4px;
}

/* ── Log list / righe ───────────────────────────────────────── */
.widget-log-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.widget-log-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.widget-log-row:hover { border-color: rgba(77,171,154,0.2); }
.widget-log-badge { font-size: 14px; flex-shrink: 0; line-height: 1; }
.widget-log-time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 34px;
}
.widget-log-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 -4px;
}
.widget-log-type-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.widget-log-done  { border-left: 2.5px solid #22c55e; }
.widget-log-issue { border-left: 2.5px solid #f43f5e; }
.widget-log-idea  { border-left: 2.5px solid #eab308; }
.widget-log-note  { border-left: 2.5px solid rgba(77,171,154,0.5); }

/* ── Widget expand button ───────────────────────────────────── */
.widget-notes-expand-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(77,171,154,0.07);
  border: 1px solid rgba(77,171,154,0.2);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s;
}
.widget-notes-expand-btn:hover { background: rgba(77,171,154,0.14); border-color: rgba(77,171,154,0.4); }

/* ── Widget delete button ───────────────────────────────────── */
.widget-del-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.widget-note-card:hover .widget-del-btn,
.widget-log-row:hover .widget-del-btn,
.widget-sess-card:hover .widget-del-btn { color: var(--text-muted); }
.widget-del-btn:hover { background: rgba(244,63,94,0.12); color: var(--red) !important; }

/* ── Widget inline edit ─────────────────────────────────────── */
.wi-editable { cursor: pointer; border-radius: 4px; transition: background 0.12s; }
.wi-editable:hover { background: rgba(77,171,154,0.08); outline: 1px dashed rgba(77,171,154,0.35); }
.wi-editing { cursor: default !important; }
.wi-wrap { display: flex; flex-direction: column; gap: 6px; }
.wi-textarea, .wi-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  resize: vertical;
  box-sizing: border-box;
}
.wi-textarea:focus, .wi-input:focus { outline: none; }
.wi-btns { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Widget categoria pill (edit mode) ──────────────────────── */
.wi-cat-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.wi-cat-pill {
  flex: 1;
  padding: 3px 8px;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
  text-align: center;
  white-space: nowrap;
}
.wi-cat-pill:hover  { background: var(--surface3); }
.wi-cat-pill.active { background: rgba(77,171,154,.15); border-color: var(--accent); color: var(--accent); }

/* ── Widget confirm modal ───────────────────────────────────── */
#widget-confirm-overlay .modal { animation: modal-in 0.18s ease; }
#widget-confirm-ok:hover { opacity: 0.88; }

/* ═══════════════════════════════════════════════════════
   AUTH OVERLAY
   ═══════════════════════════════════════════════════════ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-overlay.hidden { display: none; }

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  justify-content: center;
}
.auth-logo-icon { font-size: 26px; }
.auth-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.auth-screen { display: none; }
.auth-screen.active { display: block; }

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  text-align: center;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin: 0 0 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-field input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-field input::placeholder { color: var(--text-dim); opacity: 0.5; }

.auth-btn-primary {
  width: 100%;
  padding: 11px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
  font-family: inherit;
}
.auth-btn-primary:hover { opacity: 0.88; }
.auth-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-error {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}
.auth-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--green);
  line-height: 1.4;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:hover { opacity: 0.8; }
.auth-divider { color: var(--border); }
.auth-label-optional { color: var(--text-dim); font-size: 11px; }

.auth-verify-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 16px;
}

/* Plan badge nella sidebar */
.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.plan-badge-free    { background: rgba(255,255,255,0.07); color: var(--text-dim); }
.plan-badge-pro     { background: rgba(77,171,154,0.2);   color: var(--accent); }
.plan-badge-founder { background: rgba(234,179,8,0.2);    color: #eab308; }

/* ══════════════════════════════════════════════
   LIGHT THEME
══════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:         #eaeaef;
  --sidebar-bg: #dcdce4;
  --surface:    #f5f5f9;
  --surface2:   #e4e4eb;
  --surface3:   #d8d8e2;
  --border:     rgba(0,0,0,0.13);
  --border-med: rgba(0,0,0,0.20);
  --accent:     #1e7a6a;
  --accent-dim: rgba(30,122,106,0.12);
  --accent-text:#1e7a6a;
  --green:      #15803d;
  --green-dim:  rgba(21,128,61,0.12);
  --red:        #b91c1c;
  --red-dim:    rgba(185,28,28,0.10);
  --yellow:     #a16207;
  --text:       #111118;
  --text-dim:   rgba(30,30,50,0.60);
  --text-muted: rgba(30,30,50,0.38);
}
[data-theme="light"] body { background: var(--bg); color: var(--text); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.20); }
[data-theme="light"] .sidebar { box-shadow: 1px 0 0 rgba(0,0,0,0.10); }
[data-theme="light"] .stat-card,
[data-theme="light"] .dash-chart-card,
[data-theme="light"] .table-header,
[data-theme="light"] .trade-row,
[data-theme="light"] .setup-card,
[data-theme="light"] .note-card,
[data-theme="light"] .account-card,
[data-theme="light"] .modal-content,
[data-theme="light"] .settings-panel,
[data-theme="light"] .auth-box { box-shadow: 0 1px 4px rgba(0,0,0,0.10); }

/* ══════════════════════════════════════════════
   COMPACT DENSITY
══════════════════════════════════════════════ */
[data-density="compact"] .stat-card          { padding: 12px 14px; }
[data-density="compact"] .page-header        { margin-bottom: 16px; }
[data-density="compact"] .section-title      { margin-bottom: 10px; }
[data-density="compact"] .trade-row          { padding: 8px 12px; }
[data-density="compact"] .table-row          { min-height: 36px; }
[data-density="compact"] .settings-group     { margin-bottom: 14px; }

/* ══════════════════════════════════════════════
   SETTINGS GEAR BUTTON
══════════════════════════════════════════════ */
.settings-gear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.settings-gear-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}
[data-theme="light"] .settings-gear-btn:hover { background: rgba(0,0,0,0.06); }

/* ══════════════════════════════════════════════
   SETTINGS OVERLAY & PANEL
══════════════════════════════════════════════ */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease;
}
.settings-overlay.hidden { display: none !important; }

.settings-panel {
  width: min(680px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: slideInRight 0.22s ease;
  overflow: hidden;
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-title { font-size: 17px; font-weight: 600; color: var(--text); margin: 0; }
.settings-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  transition: background 0.15s;
}
.settings-close-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
[data-theme="light"] .settings-close-btn:hover { background: rgba(0,0,0,0.06); }

.settings-body { display: flex; flex: 1; overflow: hidden; }

/* Left nav */
.settings-nav {
  width: 155px;
  flex-shrink: 0;
  padding: 14px 8px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.settings-nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
[data-theme="light"] .settings-nav-item:hover { background: rgba(0,0,0,0.04); }
.settings-nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.settings-nav-icon { font-size: 14px; }

/* Right content */
.settings-content { flex: 1; overflow-y: auto; padding: 24px; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.settings-group { margin-bottom: 20px; }
.settings-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.settings-label-danger { color: #ef4444; }
.settings-description {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 10px;
  line-height: 1.5;
}
.settings-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-med);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.settings-input:focus { border-color: var(--accent); }
.settings-input-row { display: flex; gap: 8px; align-items: center; }
.settings-input-row .settings-input { flex: 1; }
.settings-input-suffix { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

/* Buttons */
.settings-btn-save {
  background: var(--accent-dim);
  border: 1px solid rgba(77,171,154,0.3);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}
.settings-btn-save:hover { background: rgba(77,171,154,0.22); }
.settings-btn-primary {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}
.settings-btn-primary:hover { opacity: 0.87; }
.settings-btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-med);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.settings-btn-ghost:hover { background: rgba(255,255,255,0.09); }
[data-theme="light"] .settings-btn-ghost { background: rgba(0,0,0,0.04); }
[data-theme="light"] .settings-btn-ghost:hover { background: rgba(0,0,0,0.08); }
.settings-btn-danger {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.settings-btn-danger:hover { background: rgba(239,68,68,0.16); }
.settings-btn-danger-outline {
  background: none;
  border: 1px solid var(--border-med);
  color: var(--text-dim);
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.settings-btn-danger-outline:hover { border-color: #ef4444; color: #ef4444; }

.settings-divider { height: 1px; background: var(--border); margin: 20px 0; }

.settings-msg {
  margin-top: 8px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
}
.settings-msg.success { background: rgba(77,171,154,0.10); color: var(--accent); }
.settings-msg.error   { background: rgba(239,68,68,0.10);  color: #ef4444; }
.settings-msg.hidden  { display: none; }

/* Theme selector */
.settings-theme-row { display: flex; gap: 12px; }
.settings-theme-btn {
  flex: 1;
  border: 2px solid var(--border-med);
  border-radius: 9px;
  background: var(--bg);
  cursor: pointer;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.settings-theme-btn.active  { border-color: var(--accent); color: var(--accent); }
.settings-theme-btn:hover:not(.active) { border-color: rgba(255,255,255,0.2); }
[data-theme="light"] .settings-theme-btn:hover:not(.active) { border-color: rgba(0,0,0,0.18); }

/* Language selector */
.settings-lang-btn {
  flex: 1;
  border: 2px solid var(--border-med);
  border-radius: 10px;
  padding: 10px 8px 8px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.settings-lang-flag { font-size: 22px; line-height: 1; }
.settings-lang-btn.active  { border-color: var(--accent); color: var(--accent); }
.settings-lang-btn:hover:not(.active) { border-color: rgba(255,255,255,0.2); }
.settings-theme-preview {
  width: 100%;
  height: 46px;
  border-radius: 6px;
  display: block;
}
.settings-theme-preview-dark  { background: linear-gradient(135deg, #0f0f11 40%, #1a1a1f 100%); border: 1px solid #2a2a30; }
.settings-theme-preview-light { background: linear-gradient(135deg, #f2f2f5 40%, #e8e8ed 100%); border: 1px solid #ccc; }

/* Density / radio */
.settings-density-row { display: flex; gap: 16px; flex-wrap: wrap; }
.settings-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.settings-radio-label input { accent-color: var(--accent); }

/* Cloud status */
.settings-cloud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}
.settings-cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.settings-cloud-dot.online  { background: var(--green); }
.settings-cloud-dot.offline { background: #ef4444; }

/* Plan card */
.settings-plan-card {
  background: var(--bg);
  border: 1px solid var(--border-med);
  border-radius: 10px;
  padding: 16px 20px;
}
.settings-plan-name {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.settings-plan-name.free    { color: var(--text-dim); }
.settings-plan-name.pro     { color: var(--accent); }
.settings-plan-name.founder { color: #eab308; }
.settings-plan-desc { font-size: 13px; color: var(--text-dim); }

/* Usage bars */
.settings-usage-list { display: flex; flex-direction: column; gap: 12px; }
.settings-usage-item { display: flex; flex-direction: column; gap: 5px; }
.settings-usage-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}
.settings-usage-bar-bg {
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
[data-theme="light"] .settings-usage-bar-bg { background: rgba(0,0,0,0.08); }
.settings-usage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.settings-usage-bar-fill.warn { background: #f59e0b; }
.settings-usage-bar-fill.full { background: #ef4444; }

/* Upgrade CTA */
.settings-upgrade-cta {
  background: var(--accent-dim);
  border: 1px solid rgba(77,171,154,0.2);
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 20px;
}
.settings-upgrade-cta p { font-size: 13px; color: var(--text); margin: 0 0 12px; line-height: 1.5; }

/* File input hidden */
.settings-file-label { cursor: pointer; }
input.hidden { display: none; }
