/* ============================================================
   Vestinit — Components  (ITP-03B Visual Refresh)
   Reskin of the existing Claret component classes to the
   oxblood / Playfair reference. Requires design-tokens.css.
   No markup changes: selectors match portal.css v13.
   ============================================================ */

/* ── Reset + base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }
ul, ol { list-style: none; }

/* ── Typography — serif display voice ──
   Headings + display numerals use Playfair; body stays Hanken. */
h1, h2, h3, h4, h5 { line-height: 1.2; color: var(--text-primary); }
h1 { font-family: var(--font-display); font-size: 1.75rem;  font-weight: 600; letter-spacing: 0; }
h2 { font-family: var(--font-display); font-size: 1.3rem;   font-weight: 600; letter-spacing: 0; }
h3 { font-family: var(--font-display); font-size: 1.1rem;   font-weight: 600; }
h4 { font-family: var(--font-body);    font-size: 0.9375rem; font-weight: 600; }
p  { line-height: 1.6; color: var(--text-secondary); text-wrap: pretty; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--text-primary); }
.card-action { font-size: 0.8125rem; color: var(--accent); font-weight: 600; transition: color var(--transition); }
.card-action:hover { color: var(--accent-hover); }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}
.stat-label {
  font-size: 0.656rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 9px;
}
.stat-value {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
  line-height: 1.1; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.stat-change { font-size: 0.75rem; font-weight: 600; margin-top: 5px; }
.stat-change.up { color: var(--ok); }
.stat-change.down { color: var(--red); }

/* ── Deal cards ── */
.deal-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.deal-card:hover { border-color: var(--accent-border); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.deal-card-header { padding: 20px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.deal-logo {
  width: 46px; height: 46px; border-radius: 12px; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
  flex-shrink: 0; color: var(--accent);
}
.deal-meta { flex: 1; min-width: 0; }
.deal-name { font-family: var(--font-display); font-size: 1.06rem; font-weight: 600; color: var(--text-primary); }
.deal-sector { font-size: 0.719rem; color: var(--text-tertiary); margin-top: 2px; }
.deal-status { font-size: 0.656rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.deal-status.open { background: var(--ok-bg); color: var(--ok); }
.deal-status.closing { background: var(--gold-bg); color: var(--gold); }
.deal-status.closed { background: var(--bg-elevated); color: var(--text-secondary); }
.deal-card-body { padding: 14px 20px 20px; }
.deal-desc { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 14px; }
.deal-progress { margin-bottom: 12px; }
.deal-progress-label { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 6px; }
.deal-progress-label span:first-child { color: var(--text-secondary); }
.deal-progress-label span:last-child { font-weight: 600; color: var(--text-primary); }
.progress-bar { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 1s ease; }
.deal-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.deal-fig-label { font-size: 0.656rem; color: var(--text-tertiary); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.deal-fig-value { font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ── WEB-02-FIX-01 — Investor opportunity-card title-row overflow at narrow widths ──
   The title row is an inline-styled flex (space-between): a text block + the LIVE
   badge (.badge = white-space:nowrap). Default min-width:auto stops the text block
   shrinking, so a long company name pushes the nowrap badge past the viewport at
   375px. Presentation-only: let the text block shrink + break, let the row wrap so
   the badge stays in-viewport, and keep the badge from being squashed. Scoped to
   .opportunity-card (investor-only class) so no other role's cards are affected.
   All three declarations are inert when the row already fits → no desktop/tablet
   regression. */
.opportunity-card > div:first-child { flex-wrap: wrap; }
.opportunity-card > div:first-child > div { min-width: 0; overflow-wrap: anywhere; }
.opportunity-card > div:first-child > .badge { flex-shrink: 0; }

/* ── Buttons — pill geometry, oxblood brand ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 22px; font-size: 0.844rem; font-weight: 600;
  border-radius: 999px; border: none; cursor: pointer;
  font-family: var(--font-body); transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--text-primary); color: var(--bg-surface); }
.btn-primary:hover { opacity: 0.88; }
.btn-brand { background: var(--accent); color: var(--on-accent); }
.btn-brand:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border: 1px solid var(--border-default); }
.btn-secondary:hover { background: var(--bg-elevated); }
.btn-outline { background: none; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-bg); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 7px 16px; font-size: 0.8125rem; }
.btn-lg { padding: 13px 30px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.813rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border-default);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text-primary);
  font-size: 0.875rem; outline: none; font-family: var(--font-body); min-height: 46px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-tertiary); }
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: var(--bg-surface); color: var(--text-primary); }
.form-textarea { resize: vertical; min-height: 96px; }
.form-hint { font-size: 0.688rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 0.688rem; color: var(--red); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-divider { text-align: center; position: relative; margin: 18px 0; color: var(--text-secondary); font-size: 0.813rem; }
.form-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border-subtle); }
.form-divider span { position: relative; background: var(--bg-surface); padding: 0 12px; }

/* ── Badges — uppercase small-caps pills ── */
.badge { display: inline-flex; align-items: center; font-size: 0.656rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-brand { background: var(--accent-bg); color: var(--accent); }
.badge-gold  { background: var(--gold-bg); color: var(--gold); }
.badge-gray  { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-red   { background: var(--red-bg); color: var(--red); }
.badge-blue  { background: var(--blue-bg); color: var(--blue); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.844rem; }
thead th {
  text-align: left; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-tertiary);
  padding: 10px 14px; border-bottom: 1px solid var(--border-subtle);
}
tbody td { padding: 14px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
tbody td.num { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-raised); }

/* ── Alerts ── */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 0.844rem; line-height: 1.5; margin-bottom: 18px; }
.alert-info    { background: var(--bg-raised); border: 1px solid var(--border-default); color: var(--text-secondary); }
.alert-success { background: var(--ok-bg);   border: 1px solid var(--ok);   color: var(--ok); }
.alert-warning { background: var(--gold-bg); border: 1px solid var(--gold); color: var(--gold); }
.alert-error   { background: var(--red-bg);  border: 1px solid var(--red);  color: var(--red); }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--border-subtle); margin-bottom: 22px; }
.tab-btn { background: none; border: none; color: var(--text-secondary); font-size: 0.844rem; font-weight: 600; padding: 9px 18px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font-family: var(--font-body); transition: all var(--transition); }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
