/* ── RESET & BASE ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: #ffffff;
  color: #37352f;
  font-size: 14px;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  position: fixed;
  width: 100%;
  max-width: 100vw;
}

/* ── HEADER ── */
header {
  height: 52px;
  background: #fff;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
}

.header-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #0F4C8A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-title {
  font-size: 15px;
  font-weight: 500;
  color: #111;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.header-account-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.header-acc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #888;
  flex-shrink: 0;
}

.header-acc-arrow {
  font-size: 8px;
  color: #aaa;
  pointer-events: none;
}

#accountSelect {
  background: transparent;
  border: none;
  font-size: 11px;
  color: #888;
  outline: none;
  cursor: pointer;
  padding: 0;
  max-width: 140px;
  appearance: none;
  -webkit-appearance: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 0.5px solid rgba(0,0,0,0.1);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  position: relative;
  flex-shrink: 0;
  font-family: inherit;
}
.icon-btn:hover { background: #f5f5f5; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.has-notif::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #E24B4A;
  border: 1.5px solid #fff;
}

/* ── NOTIFICATION PANEL ── */
.notif-panel {
  position: fixed;
  top: 60px;
  right: 12px;
  width: 280px;
  background: white;
  border-radius: 14px;
  border: 0.5px solid rgba(0,0,0,0.1);
  padding: 14px;
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.notif-panel-title { font-size: 13px; font-weight: 500; color: #111; margin-bottom: 12px; }
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 0.5px solid rgba(0,0,0,0.06); }
.notif-row-info { flex: 1; }
.notif-row-label { font-size: 13px; color: #111; display: block; }
.notif-row-sub { font-size: 11px; color: #aaa; display: block; margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ddd; border-radius: 13px; cursor: pointer; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: #0F4C8A; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.notif-hint { font-size: 11px; color: #aaa; text-align: center; margin-top: 10px; padding-top: 10px; border-top: 0.5px solid rgba(0,0,0,0.06); }

/* ── CONNECT ACCOUNT MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #37352f;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.modal-field label {
  font-size: 12px;
  color: #9b9a97;
  font-weight: 500;
}

.modal-field input[type="text"],
.modal-field input[type="password"] {
  padding: 8px 10px;
  border: 1px solid #e9e9e7;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: #37352f;
  outline: none;
  background: #f7f6f3;
}
.modal-field input:focus { border-color: #2383e2; background: #ffffff; }

.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #37352f;
  cursor: pointer;
}
.modal-checkbox input { cursor: pointer; }

.modal-error {
  font-size: 12px;
  color: #ef4444;
  min-height: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-primary {
  padding: 0 18px;
  height: 34px;
  background: #2383e2;
  color: #ffffff;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: #1a6fc4; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 0 18px;
  height: 34px;
  background: #f1f1ef;
  color: #37352f;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.btn-secondary:hover { background: #e9e9e7; }

.modal-loader {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100dvh - 52px);
  overflow: hidden;
}

.empty {
  padding: 24px;
  color: #9b9a97;
  text-align: center;
  font-size: 13px;
}

/* ── STATS MODAL ── */
.stats-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
}
.stats-modal-overlay.open { display: flex; }

.stats-modal {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14);
  padding: 24px;
  margin: auto;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.stats-title {
  font-size: 17px;
  font-weight: 700;
  color: #37352f;
}
.stats-close {
  width: 30px; height: 30px;
  border: 0; background: transparent;
  font-size: 22px; cursor: pointer;
  color: #9b9a97; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.stats-close:hover { background: #f1f1ef; }

.stats-section {
  margin-bottom: 20px;
}
.stats-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #9b9a97;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.stats-card {
  background: #f7f6f3;
  border-radius: 10px;
  padding: 12px 14px;
}
.stats-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #37352f;
  line-height: 1.1;
}
.stats-card-label {
  font-size: 11px;
  color: #9b9a97;
  margin-top: 4px;
}
.stats-card.blue .stats-card-value  { color: #2383e2; }
.stats-card.green .stats-card-value { color: #15803d; }
.stats-card.amber .stats-card-value { color: #92400e; }
.stats-card.red .stats-card-value   { color: #dc2626; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.stats-table td {
  padding: 6px 0;
  border-bottom: 1px solid #f1f1ef;
  color: #37352f;
}
.stats-table td:last-child {
  text-align: right;
  font-weight: 600;
}
.stats-table tr:last-child td { border-bottom: 0; }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.stats-loading {
  text-align: center;
  padding: 40px 0;
  color: #9b9a97;
  font-size: 13px;
}
