/* ==============================
   Ardenvale — Dashboard Styles
   Extends theme.css tokens
   ============================== */

/* NAV LINKS */
.nav-link {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--accent); background: var(--bg-alt); }
.nav-link--active { color: var(--accent); font-weight: 500; }

/* DASHBOARD HEADER */
.dash-header {
  padding: 2.5rem 3rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.dash-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.dash-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
  margin-top: 0.5rem;
}

/* NET WORTH BAND */
.net-worth-band {
  background: var(--accent);
  padding: 2rem 3rem;
}
.net-worth-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.nw-stat {
  flex: 1;
  min-width: 160px;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.nw-stat:first-child { padding-left: 0; }
.nw-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(245,241,235,0.55);
}
.nw-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: rgba(245,241,235,0.9);
  line-height: 1.1;
}
.nw-primary { color: #fff; font-size: 2.2rem; }
.nw-gain { color: #7ecba0; }
.nw-loss { color: #e07070; }
.nw-pct { font-size: 1rem; font-weight: 400; opacity: 0.75; }
.nw-divider {
  width: 1px;
  height: 40px;
  background: rgba(245,241,235,0.15);
  flex-shrink: 0;
}

/* DASH BODY */
.dash-body {
  background: var(--bg-alt);
  min-height: 60vh;
  padding: 2.5rem 3rem;
}
.dash-body-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

/* CARD */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2rem;
}
.card-header { margin-bottom: 1.5rem; }
.card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.4rem;
}

/* DONUT CHART */
.donut-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.donut-svg {
  width: 160px;
  height: 160px;
}
.donut-center-label {
  font-family: var(--font-body);
  font-size: 8px;
  fill: var(--fg-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.donut-center-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  fill: var(--accent);
}

/* ALLOCATION LEGEND */
.alloc-legend { display: flex; flex-direction: column; gap: 0.6rem; }
.alloc-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.825rem;
}
.alloc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alloc-name { color: var(--fg); }
.alloc-pct { color: var(--fg-muted); text-align: right; min-width: 36px; }
.alloc-val { color: var(--accent); font-weight: 500; text-align: right; min-width: 56px; }

/* HOLDINGS GROUPS */
.holdings-group {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.holdings-group:last-child { margin-bottom: 0; }
.holdings-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.holdings-group-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}
.holdings-group-total {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--accent-warm);
  font-weight: 600;
}

/* HOLDINGS TABLE */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.holdings-table th {
  text-align: left;
  padding: 0.65rem 1.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.holdings-table td {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.holdings-table tbody tr:last-child td { border-bottom: none; }
.holdings-table tbody tr:hover td { background: var(--bg-alt); }
.col-num { text-align: right; }
.col-ticker { color: var(--fg-muted); font-size: 0.8rem; font-weight: 500; }
.col-actions { text-align: right; white-space: nowrap; width: 64px; }
.holding-name { font-weight: 500; color: var(--accent); }
.gain-pos { color: #2a7a50; }
.gain-neg { color: #b04040; }
.gain-pct { font-size: 0.75rem; opacity: 0.8; margin-left: 3px; }

/* BUTTONS */
.btn-add {
  background: var(--accent);
  color: rgba(245,241,235,0.9);
  border: none;
  padding: 0.65rem 1.35rem;
  font-family: var(--font-body);
  font-size: 0.825rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}
.btn-add:hover { background: #234f38; }
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  width: 28px;
  height: 28px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-alt); }
.btn-icon--danger:hover { border-color: #b04040; color: #b04040; }
.btn-primary {
  background: var(--accent);
  color: rgba(245,241,235,0.95);
  border: none;
  padding: 0.65rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}
.btn-primary:hover { background: #234f38; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,24,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.modal-overlay--visible { display: flex; }
.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(26,26,24,0.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.modal-close:hover { color: var(--fg); }

/* FORM */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  padding: 1.5rem 1.75rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group--full { grid-column: 1 / -1; }
.form-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}
.form-input {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--fg);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--border); }
textarea.form-input { resize: vertical; min-height: 60px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* EMPTY STATE */
.empty-state {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.empty-state-body { color: var(--fg-muted); margin-bottom: 1.5rem; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .dash-body-inner { grid-template-columns: 1fr; }
  .dash-sidebar { order: 2; }
  .dash-main { order: 1; }
}
@media (max-width: 768px) {
  .dash-header { padding: 1.5rem 1.5rem 1rem; }
  .net-worth-band { padding: 1.5rem; }
  .net-worth-inner { flex-direction: column; gap: 1rem; }
  .nw-stat { padding: 0; }
  .nw-divider { display: none; }
  .dash-body { padding: 1.5rem; }
  .holdings-table th, .holdings-table td { padding: 0.65rem 1rem; }
  .col-ticker, .col-actions { display: none; }
  .dash-header-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
}
