/* ═══════════════════════════════════════════════════════════════
   TradeMesh — Page-content components (forms, tables, grids, lists)
   Ported from the old build's style.css. Shared by every app page
   beyond the dashboard chrome (which lives in app-shell.css).
   ═══════════════════════════════════════════════════════════════ */

.sec-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.sec-hdr h3 { font-size: 0.92rem; color: var(--text-1); }
.sec-hdr .sec-actions { display: flex; gap: 0.4rem; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-surface);
  cursor: pointer; color: var(--text-2); transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--border-2); color: var(--text-1); }
.btn-icon.danger:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }

/* ── FORMS ───────────────────────────────────────── */
.form-page { padding: 2.5rem 1.75rem; max-width: 680px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-1); }
.form-label .req { color: var(--orange); }
.form-input, .form-select, .form-textarea {
  padding: 0.65rem 0.9rem; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 0.875rem; font-family: var(--font); color: var(--text-1); background: var(--bg);
  outline: none; transition: border-color 0.15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-dim); }
.form-input.mono { font-family: var(--mono); font-size: 0.95rem; font-weight: 700; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.74rem; color: var(--text-3); }
.form-section-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
  margin: 1.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.proof-upload { border: 2px dashed var(--border-2); border-radius: var(--r); padding: 2rem; text-align: center; cursor: pointer; transition: all 0.2s; }
.proof-upload:hover { border-color: var(--orange-bd); background: var(--orange-dim); }
.proof-upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.proof-upload p { font-size: 0.84rem; color: var(--text-3); }
.proof-upload strong { color: var(--orange-2); }
.form-note { background: var(--blue-dim); border: 1px solid var(--blue-bd); border-radius: var(--r-sm); padding: 0.9rem 1rem; font-size: 0.8rem; color: var(--blue-dk); line-height: 1.6; }

/* ── SUPPLIER CARDS ──────────────────────────────── */
.supplier-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.supplier-card { padding: 1.4rem; transition: all 0.2s; }
.supplier-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); border-color: var(--border-2); }
.supplier-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.9rem; }
.supplier-name { font-size: 0.92rem; font-weight: 700; color: var(--text-1); margin-bottom: 0.15rem; }
.supplier-location { font-size: 0.76rem; color: var(--text-3); display: flex; align-items: center; gap: 0.3rem; }
.supplier-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.member-contact-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.75rem;
  border-radius: 100px; font-size: 0.76rem; font-weight: 600;
  background: var(--bg-surface); color: var(--text-2); border: 1px solid var(--border);
}
.member-contact-btn:hover { border-color: var(--border-2); color: var(--text-1); }
.member-contact-btn.wa { background: var(--green-dim); color: var(--green); border-color: rgba(22,163,74,0.25); }
@media (max-width: 1100px) { .supplier-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .supplier-grid { grid-template-columns: 1fr; } }

/* ── ANALYTICS ───────────────────────────────────── */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 1100px) { .analytics-grid { grid-template-columns: 1fr; } }
.hbar-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.hbar-label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); min-width: 90px; }
.hbar-track { flex: 1; height: 8px; background: var(--bg-surface); border-radius: 100px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 100px; background: var(--orange); transition: width 1s ease; }
.hbar-val { font-size: 0.76rem; font-weight: 700; font-family: var(--mono); color: var(--text-1); min-width: 56px; text-align: right; }

/* ── GENERIC DATA TABLE ──────────────────────────── */
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.data-table thead th {
  padding: 0.7rem 1rem; text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3); background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-alt); }
.data-table tbody td { padding: 0.8rem 1rem; font-size: 0.84rem; vertical-align: middle; }

/* ── NOTIFICATIONS LIST ──────────────────────────── */
.notif-item { display: flex; gap: 0.85rem; align-items: flex-start; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); transition: background 0.15s; cursor: pointer; }
.notif-item:hover { background: var(--bg-alt); }
.notif-item.unread { background: var(--orange-dim); }
.notif-item:last-child { border-bottom: none; }
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; background: var(--bg-surface); border: 1px solid var(--border); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.84rem; font-weight: 600; color: var(--text-1); }
.notif-sub { font-size: 0.76rem; color: var(--text-3); margin-top: 0.15rem; line-height: 1.4; }
.notif-time { font-size: 0.7rem; color: var(--text-3); margin-top: 0.25rem; white-space: nowrap; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0; margin-top: 0.4rem; }

/* ── TWO-COLUMN PAGE (cart / order) ──────────────── */
.page-2col { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.page-summary-panel { position: sticky; top: 80px; }
@media (max-width: 1024px) { .page-2col { grid-template-columns: 1fr 280px; } }
@media (max-width: 900px) { .page-2col { grid-template-columns: 1fr; } .page-summary-panel { position: static; } }

.summary-card { padding: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; }
.summary-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.summary-label { font-size: 0.84rem; color: var(--text-2); }
.summary-value { font-size: 0.9rem; font-weight: 700; font-family: var(--mono); color: var(--text-1); }
.summary-total { font-size: 1.1rem; font-weight: 800; color: var(--orange); }

/* ── SIDE PANEL / DRAWER (order detail) ──────────── */
.side-panel {
  position: fixed; top: 0; right: -420px; bottom: 0; width: 420px; max-width: 100vw;
  background: var(--bg); border-left: 1px solid var(--border-2);
  box-shadow: var(--sh-lg); z-index: 500;
  display: flex; flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1); overflow: hidden;
}
.side-panel.open { right: 0; }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.side-panel-title { font-size: 0.92rem; font-weight: 700; color: var(--text-1); }
.side-panel-close {
  width: 28px; height: 28px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg-surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 1rem; transition: all 0.15s;
}
.side-panel-close:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.side-panel-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.panel-backdrop { display: none; position: fixed; inset: 0; z-index: 499; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }
.panel-backdrop.show { display: block; }

/* ── PROFILE PAGE ─────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.75rem; align-items: start; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } }
.profile-avatar-wrap { position: relative; width: 100%; max-width: 240px; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 1px solid var(--border); cursor: pointer; }
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-wrap .avatar-edit-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 0.75rem; font-weight: 700; opacity: 0; transition: opacity 0.15s;
}
.profile-avatar-wrap:hover .avatar-edit-hint { opacity: 1; }
.profile-name { font-size: 1.25rem; font-weight: 800; color: var(--text-1); margin-top: 1rem; }
.profile-handle { font-size: 0.88rem; color: var(--text-3); margin-top: 0.1rem; }
.profile-bio { font-size: 0.84rem; line-height: 1.6; color: var(--text-2); margin-top: 0.85rem; }
.profile-stats { display: flex; gap: 1rem; margin-top: 1.1rem; font-size: 0.84rem; color: var(--text-2); }
.profile-stats b { color: var(--text-1); }
.profile-contact-row { display: flex; align-items: center; gap: 0.55rem; font-size: 0.84rem; color: var(--text-2); padding: 0.4rem 0; }

.profile-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.profile-tab {
  padding: 0.7rem 1rem; font-size: 0.84rem; font-weight: 700; color: var(--text-3);
  border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
  display: flex; align-items: center; gap: 0.4rem;
}
.profile-tab.active { color: var(--text-1); border-bottom-color: var(--orange); }
.profile-tab:hover:not(.active) { color: var(--text-2); }

/* ── ORG CARDS (Supabase project-picker style: centered logo, name below) ── */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.org-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.65rem;
  padding: 1.5rem 1rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); transition: all 0.15s;
}
.org-card:hover { border-color: var(--border-2); box-shadow: var(--sh-md); transform: translateY(-2px); }
.org-card-logo {
  width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; overflow: hidden;
}
.org-card-logo img { width: 100%; height: 100%; object-fit: cover; }
.org-card-name { font-size: 0.86rem; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.org-card-role { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; color: var(--text-3); }
.org-card-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.org-section-empty { font-size: 0.82rem; color: var(--text-3); padding: 0.5rem 0 1rem; }

.apply-banner {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: var(--orange-dim); border: 1px solid var(--orange-bd);
  border-radius: var(--r-lg); padding: 1.5rem 1.75rem;
}

.contrib-wrap { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; overflow-x: auto; }
.contrib-table { border-collapse: separate; border-spacing: 3px; }
.contrib-month-th { font-size: 0.66rem; font-weight: 700; color: var(--text-3); text-align: left; padding: 0 0 4px 0; height: 14px; }
.contrib-day-th { font-size: 0.62rem; font-weight: 500; color: var(--text-3); text-align: right; padding-right: 6px; white-space: nowrap; }
.contrib-cell { width: 11px; height: 11px; border-radius: 2px; padding: 0; cursor: default; }

.activity-row { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.activity-row:first-child { border-top: none; }
.activity-text { font-size: 0.82rem; color: var(--text-1); }
.activity-time { font-size: 0.72rem; color: var(--text-3); margin-top: 0.15rem; }
