/* ============================================================
   app-redesign.css — terminal-energy redesign for all pages
   + modals. Loaded AFTER style.css on every page (and after
   deals-view.css on the All Deals page). Additive: scoped to
   page wrapper classes so it never fights existing styles.
   Shares the language established in deals-view.css.
   ============================================================ */

/* ---- shared primitives ---- */
.rd-eyebrow {
  font-size: 0.69rem; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: #a39b8b; margin-bottom: 0.35rem;
}
.rd-mono { font-family: 'IBM Plex Mono', monospace; font-feature-settings: "tnum"; }

body.rd { background: #f3f0e9; }
.rd main { max-width: 1320px; padding: 1.6rem 1.75rem 3rem; }
.rd main h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.6px; color: var(--strong); line-height: 1; margin: 0; }
.rd .rd-head { margin-bottom: 1.4rem; }
.rd .subtitle { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-kpis { display: grid; grid-template-columns: 1.1fr 1.1fr; gap: 0.9rem; margin-bottom: 0.9rem; }
.dash-types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 1.6rem; }

.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.15rem 1.3rem; position: relative; overflow: hidden;
}
.kpi-card .label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: #a39b8b; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 7px;
}
.kpi-card .value { font-family: 'IBM Plex Mono', monospace; font-size: 2.1rem; font-weight: 600; color: var(--strong); line-height: 1; }
.kpi-card .value.accent { color: var(--accent); }
.kpi-card .value.green  { color: var(--green); }
.kpi-card .sub { font-size: 0.74rem; color: var(--muted); margin-top: 0.55rem; }

.type-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.95rem 1.05rem; border-top: 3px solid var(--accent); position: relative;
}
.type-card .tc-dot { width: 9px; height: 9px; border-radius: 2px; }
.type-card .tc-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: #8c8576; display: flex; align-items: center; gap: 7px; margin-bottom: 0.6rem; }
.type-card .tc-count { font-family: 'IBM Plex Mono', monospace; font-size: 1.7rem; font-weight: 600; color: var(--strong); line-height: 1; }
.type-card .tc-bar { height: 4px; border-radius: 3px; background: #ece7dd; margin-top: 0.7rem; overflow: hidden; }
.type-card .tc-bar > span { display: block; height: 100%; border-radius: 3px; }
.type-card .tc-share { font-size: 0.7rem; color: var(--muted); margin-top: 0.45rem; }

/* recent deals panel (dashboard + my deals share the dense list) */
.rd-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rd-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--border);
}
.rd-panel-head h2 { font-size: 0.95rem; font-weight: 700; color: var(--strong); margin: 0; }
.rd-panel-head .panel-link { font-size: 0.78rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.rd-panel-head .panel-link:hover { text-decoration: underline; }

/* dense list rows reused across dashboard recent + my-deals */
.rd-list { width: 100%; border-collapse: collapse; }
.rd-list thead th {
  background: var(--light); text-align: left; padding: 0.65rem 1rem;
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1px; color: #a39b8b;
  border-bottom: 1px solid var(--border); cursor: default; white-space: nowrap; font-weight: 600;
}
.rd-list thead th.num { text-align: right; }
.rd-list tbody td { padding: 0.7rem 1rem; border-bottom: 1px solid #f1ede4; vertical-align: middle; font-size: 0.85rem; }
.rd-list tbody tr:last-child td { border-bottom: none; }
.rd-list tbody tr:hover { background: #f7f9ff; }
.rd-list tbody tr.deal-died { opacity: 0.6; }
.rd-name { font-size: 0.86rem; font-weight: 600; color: var(--strong); }
.rd-list tr.deal-died .rd-name { text-decoration: line-through; text-decoration-color: rgba(217,69,53,0.5); color: #9a917f; }
.rd-cp { font-size: 0.72rem; color: #9a917f; }
.rd-num { text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 0.84rem; font-weight: 600; color: var(--strong); }
.rd-date { font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.rd-namecell { display: flex; align-items: center; gap: 10px; }
.rd-statusdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* squared badges (consistent with deals-view) */
.rd .badge { border-radius: 6px; padding: 3px 10px; font-size: 0.69rem; font-weight: 700; letter-spacing: 0.3px; }
.rd .badge.ma  { background: rgba(58,86,192,0.12);  color: var(--accent); }
.rd .badge.vc  { background: rgba(46,145,88,0.14);  color: var(--green); }
.rd .badge.jv  { background: rgba(232,146,12,0.16); color: #c2780a; }
.rd .badge.spv { background: rgba(124,58,237,0.13); color: #6d28d9; }
.rd .badge.eer { background: rgba(236,72,153,0.13); color: #db2777; }

/* avatar stack */
.rd-team-stack { display: flex; align-items: center; padding-left: 7px; }
.rd-av {
  width: 25px; height: 25px; border-radius: 50%; margin-left: -7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 8.5px; font-weight: 700; border: 2px solid var(--card);
}
.rd-av-more { background: #e8e2d6; color: #7a7a8c; }

/* ============================================================
   ADD DEAL — sectioned form + sticky summary
   ============================================================ */
.add-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.4rem; align-items: start; }
.add-sections { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.form-section {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.form-section > .fs-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.2rem; border-bottom: 1px solid #ece7dd; background: var(--light);
}
.fs-num {
  width: 22px; height: 22px; border-radius: 6px; background: rgba(58,86,192,0.12);
  color: var(--accent); font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fs-title { font-size: 0.85rem; font-weight: 700; color: var(--strong); }
.fs-hint { margin-left: auto; font-size: 0.72rem; color: var(--muted); }
.form-section > .fs-body { padding: 1.2rem; }
.form-section .form-grid { gap: 1rem 1.1rem; }

/* sticky save rail */
.add-rail { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 0.8rem; }
.save-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem; }
.save-card .sc-label { font-size: 0.69rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #a39b8b; margin-bottom: 0.55rem; }
.save-card .sc-deal { font-size: 1rem; font-weight: 700; color: var(--strong); line-height: 1.25; word-break: break-word; }
.save-card .sc-deal.empty { color: #bbb3a4; font-weight: 500; font-style: italic; }
.save-card .sc-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.save-card .sc-row { display: flex; justify-content: space-between; font-size: 0.8rem; padding: 0.4rem 0; border-top: 1px solid #f1ede4; }
.save-card .sc-row .k { color: var(--muted); }
.save-card .sc-row .v { font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: var(--strong); }
.save-card .btn { width: 100%; justify-content: center; display: flex; margin-top: 0.3rem; }
.save-actions { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.9rem; }
.save-actions .btn { width: 100%; }

.rd .form-group label { font-size: 0.7rem; letter-spacing: 0.8px; color: #8c8576; font-weight: 600; }
.rd .form-group input, .rd .form-group select, .rd .form-group textarea { background: var(--light); border-radius: 8px; }
.rd .form-card { max-width: none; padding: 0; border: none; background: none; }

/* ============================================================
   MY DEALS — personal stat band
   ============================================================ */
.me-band { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 0.9rem; margin-bottom: 1.4rem; }
.me-id-card {
  background: var(--accent); color: #fff; border-radius: 12px; padding: 1.15rem 1.3rem;
  display: flex; align-items: center; gap: 0.9rem;
}
.me-id-card .me-av {
  width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem; font-weight: 700;
  border: 2px solid rgba(255,255,255,0.35); flex-shrink: 0;
}
.me-id-card .me-name { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.me-id-card .me-sub { font-size: 0.76rem; opacity: 0.8; margin-top: 2px; }
.me-stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; }
.me-stat .label { font-size: 0.68rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #a39b8b; margin-bottom: 0.5rem; }
.me-stat .value { font-family: 'IBM Plex Mono', monospace; font-size: 1.5rem; font-weight: 600; color: var(--strong); line-height: 1; }
.me-stat .value.accent { color: var(--accent); }

/* ============================================================
   TEAM
   ============================================================ */
.team-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.4rem; align-items: start; }
@media (max-width: 880px) { .team-layout { grid-template-columns: 1fr; } }

.rd-roster { width: 100%; border-collapse: collapse; }
.rd-roster thead th {
  background: var(--light); text-align: left; padding: 0.6rem 1rem; font-size: 0.66rem;
  text-transform: uppercase; letter-spacing: 1px; color: #a39b8b; border-bottom: 1px solid var(--border); font-weight: 600;
}
.rd-roster tbody td { padding: 0.7rem 1rem; border-bottom: 1px solid #f1ede4; vertical-align: middle; font-size: 0.86rem; }
.rd-roster tbody tr:last-child td { border-bottom: none; }
.rd-roster tbody tr:hover { background: #f7f9ff; }
.roster-person { display: flex; align-items: center; gap: 10px; }
.roster-av { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.roster-name { font-weight: 600; color: var(--strong); }
.roster-email { font-size: 0.78rem; color: var(--muted); }
.seat-badge { border-radius: 6px; padding: 2px 9px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px; }
.seat-badge.admin  { background: rgba(58,86,192,0.12); color: var(--accent); }
.seat-badge.member { background: rgba(46,145,88,0.14); color: var(--green); }

.seat-meter-wrap { padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.seat-meter-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.55rem; }
.seat-meter-top .big { font-family: 'IBM Plex Mono', monospace; font-size: 1.3rem; font-weight: 600; color: var(--strong); }
.seat-meter-top .lbl { font-size: 0.72rem; color: var(--muted); }
.seat-meter { height: 7px; border-radius: 4px; background: #ece7dd; overflow: hidden; }
.seat-meter > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.firm-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; }
.firm-panel h2 { font-size: 0.95rem; font-weight: 700; color: var(--strong); margin: 0 0 0.2rem; }
.firm-panel .card-sub { font-size: 0.78rem; color: var(--muted); margin-bottom: 1rem; }
.firm-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; padding: 0.5rem 0; border-top: 1px solid #f1ede4; }
.firm-row:first-of-type { border-top: none; }
.firm-row .label { color: var(--muted); }
.firm-row .value { font-weight: 600; color: var(--strong); }
.firm-plan-pill { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); background: rgba(58,86,192,0.12); padding: 2px 8px; border-radius: 6px; }

/* ============================================================
   MODALS (profile + export) — refresh
   ============================================================ */
.profile-overlay, .export-overlay { background: rgba(30,30,40,0.5); backdrop-filter: blur(2px); }
.profile-modal, .export-modal {
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  border: 1px solid var(--border);
}
.profile-modal { width: min(440px, 92vw); padding: 0; gap: 0; overflow: hidden; max-height: 92vh; }
.profile-modal .rd-modal-body { overflow-y: auto; }

.rd-modal-head {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1.2rem 1.4rem; border-bottom: 1px solid #ece7dd; background: var(--light);
}
.rd-modal-head .mh-av {
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem; font-weight: 700; flex-shrink: 0;
}
.rd-modal-head .mh-title { font-size: 1.05rem; font-weight: 700; color: var(--strong); line-height: 1.2; }
.rd-modal-head .mh-sub { font-size: 0.76rem; color: var(--muted); margin-top: 1px; }
.rd-modal-head .mh-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: all 0.12s;
}
.rd-modal-head .mh-close:hover { color: var(--red); border-color: var(--red); }
.rd-modal-body { padding: 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.rd-modal-body .profile-section-title { margin-top: 0.3rem; }
.profile-modal .profile-field input { border-radius: 8px; }
.profile-modal .profile-field label { color: #8c8576; }

.export-modal { width: min(640px, 92vw); border-radius: 16px; }
.export-modal h2 { color: var(--strong); }
.export-modal textarea { background: var(--light); border-radius: 10px; font-family: 'IBM Plex Mono', monospace; }

@media (max-width: 900px) {
  .add-layout, .team-layout { grid-template-columns: 1fr; }
  .add-rail { position: static; }
  .dash-kpis { grid-template-columns: 1fr 1fr; }
  .dash-types { grid-template-columns: repeat(2,1fr); }
  .me-band { grid-template-columns: 1fr 1fr; }
}
