/* ============================================================
   PREMIUM POLISH LAYER (2026-10-05)
   Loaded last — unifies the fragmented design system into one
   coherent premium editorial identity. Soft white, near-black ink,
   grey secondary, hairline borders, deep teal used sparingly.
   ============================================================ */

/* Astryx port (2026-11-10): --type-*/--sp-*/--r-* and premium tokens
   are one-line aliases to astryx-tokens.css. Deep teal retires. */
:root {
  /* Type scale */
  --type-display: var(--text-display-1-size);
  --type-h1: var(--text-heading-1-size);
  --type-h2: var(--text-heading-2-size);
  --type-h3: var(--text-heading-3-size);
  --type-body: var(--text-body-size);
  --type-small: var(--text-supporting-size);
  --type-caption: var(--font-size-sm);
  /* Spacing scale */
  --sp-1: var(--spacing-1); --sp-2: var(--spacing-2); --sp-3: var(--spacing-3); --sp-4: var(--spacing-4);
  --sp-5: var(--spacing-5); --sp-6: var(--spacing-6); --sp-8: var(--spacing-8); --sp-10: var(--spacing-10);
  /* Radius */
  --r-sm: var(--radius-element); --r-md: var(--radius-container); --r-lg: var(--radius-page); --r-pill: var(--radius-full);
  /* Premium tokens */
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --faint: var(--color-text-disabled);
  --line: var(--color-border);
  --line-soft: var(--color-border);
  --bg: var(--color-background-body);
  --card: var(--color-background-card);
  --teal: var(--color-accent);
  --teal-dark: var(--ax-accent-deep);
  --teal-wash: var(--color-accent-muted);
  --shadow-sm: var(--shadow-low);
  --shadow-md: var(--shadow-med);
  --shadow-lg: var(--shadow-high);
}

/* ---------- Typography: one scale, enforced ---------- */
body { font-size: var(--type-body); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, .h1 { font-family: "DM Sans", "Manrope", sans-serif; font-size: var(--type-h1); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; color: var(--ink); margin: 0 0 var(--sp-4); }
h2, .h2 { font-family: "DM Sans", "Manrope", sans-serif; font-size: var(--type-h2); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); margin: 0 0 var(--sp-3); }
h3, .h3 { font-size: var(--type-h3); font-weight: 700; line-height: 1.3; color: var(--ink); margin: 0 0 var(--sp-2); }
.section-title { font-family: "DM Sans", "Manrope", sans-serif; font-size: var(--type-h2); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 var(--sp-4); }
p { margin: 0 0 var(--sp-3); }
.muted { color: var(--muted); }
.small, small { font-size: var(--type-small); }

/* ---------- Buttons: one system ---------- */
.btn, button.btn, a.btn, input[type="submit"].btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: 0.01em;
  color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); cursor: pointer; text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.btn:hover { border-color: #d5d5d2; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-sm); }
.btn-primary, a.btn-primary, button.btn-primary {
  background: var(--ink); border-color: var(--ink); color: #fff;
}
.btn-primary:hover { background: #000; border-color: #000; color: #fff; box-shadow: var(--shadow-md); }
.btn-teal, a.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-danger, a.btn-danger { background: #fff; border-color: #e5c4c0; color: #b3261e; }
.btn-danger:hover { background: #fdf3f2; border-color: #b3261e; color: #b3261e; }
.btn-sm { min-height: 34px; padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 14px 32px; font-size: 15.5px; border-radius: 14px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Cards: one system ---------- */
.card, .pm-card, .form-card, .product-card, .supplier-card, .rfq-card, .auth-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: var(--sp-5); transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
a.card:hover, a.pm-card:hover, .product-card:hover, .supplier-card:hover {
  box-shadow: var(--shadow-md); border-color: #dcdcd9; text-decoration: none;
}
.card-title, .pm-card-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0 0 var(--sp-2); line-height: 1.35; }

/* ---------- Forms: one system ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="url"], input[type="search"], input[type="date"],
input[type="time"], input[type="datetime-local"], select, textarea {
  min-height: 44px; padding: 10px 14px; font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
/* Full-width inputs only inside form stacks, not inline toolbars/search. */
.form-stack input, .form-stack select, .form-stack textarea,
.auth-card input, .auth-card select, .form-card input, .form-card select, .form-card textarea {
  width: 100%;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,124,116,.12);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
label, .form-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 0 0 6px; }
.form-error { background: #fdf3f2; border: 1px solid #f0d5d2; color: #b3261e; border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin: 0 0 var(--sp-4); }
.form-ok { background: var(--teal-wash); border: 1px solid #d3e7e4; color: var(--teal-dark); border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin: 0 0 var(--sp-4); }

/* ---------- Tables: clean premium ---------- */
.table, table.table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; font-size: 14px; }
.table thead th { background: var(--bg); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfcfa; }

/* ---------- Badges: one system ---------- */
.badge, .badge-verified, .badge-urgent, .badge-nda, .pill, .tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 10px; border-radius: var(--r-pill); line-height: 1.5; vertical-align: middle;
}
.badge-verified { background: var(--teal-wash); color: var(--teal-dark); border: 1px solid #d3e7e4; }
.badge-urgent { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.badge-nda { background: #fff; color: var(--ink); border: 1px solid var(--ink); }

/* ---------- Layout: consistent containers ---------- */
.container { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.page { padding-top: 8px; padding-bottom: 48px; min-height: 62vh; }
.page-narrow { max-width: 720px; margin: 0 auto; }
.page-head { margin: 0 0 var(--sp-5); }
.page-head h1, .page-head h2 { margin-bottom: 6px; }
.page-head .muted, .page-head p.muted { margin: 0; font-size: 14.5px; }

/* ---------- Links: restrained teal ---------- */
a { color: var(--teal-dark); }
a:hover { color: var(--teal); }

/* ---------- Empty states: one system ---------- */
.empty-state, .no-results, .empty-box {
  text-align: center; padding: 56px 24px; background: #fff;
  border: 1px dashed #d8d8d5; border-radius: var(--r-lg); color: var(--muted);
}
.empty-state h3, .no-results h3 { font-family: "DM Sans", "Manrope", sans-serif; font-size: 19px; color: var(--ink); margin: 0 0 8px; }
.empty-state p, .no-results p { font-size: 14px; margin: 0 0 16px; }

/* ---------- Header polish ---------- */
/* Anchor jumps (2026-10-15): the targeted element keeps clear of the
   sticky header instead of sliding under it. :target-only, so nothing
   else is affected. */
:target{scroll-margin-top:100px}
/* Sticky-header stacking (2026-10-15): the header must always paint above
   scrolled page content. 900 beats any in-flow content; true overlays stay
   above it (mobile drawer 950, NDA modal 1500, geo modal 2000, to-top 1100,
   bottom nav 1200, cookie/PWA banners 9999). Dropdowns inside the header
   (mega menu, search suggest, lang menu) live in the header's own stacking
   context and are unaffected. */
.site-header { background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 900; }

/* ---------- Footer polish ---------- */
.site-footer, .pm-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 0; }
.site-footer a, .pm-footer a { color: var(--muted); font-size: 13.5px; }
.site-footer a:hover, .pm-footer a:hover { color: var(--ink); }

/* ---------- Dividers & section rhythm ---------- */
hr, .divider { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }
.section { margin: 0 0 var(--sp-8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 var(--sp-4); }
.section-head h2 { margin: 0; }

/* ---------- Breadcrumbs: quiet ---------- */
.crumbs, .breadcrumb { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.crumbs a, .breadcrumb a { color: var(--muted); }
.crumbs a:hover, .breadcrumb a:hover { color: var(--ink); }

/* ---------- Flash messages: premium ---------- */
.flash, .alert, .notice { border-radius: var(--r-md); padding: 13px 18px; font-size: 14px; margin: 0 0 var(--sp-4); border: 1px solid; }
.flash-success, .alert-success { background: var(--teal-wash); border-color: #d3e7e4; color: var(--teal-dark); }
.flash-error, .alert-error, .alert-danger { background: #fdf3f2; border-color: #f0d5d2; color: #b3261e; }
.flash-info, .alert-info { background: #f4f6f8; border-color: #e2e6ea; color: var(--ink-soft); }

/* ---------- Mobile: hold the polish at 390px ---------- */
@media (max-width: 640px) {
  :root { --type-h1: 26px; --type-h2: 20px; }
  .container { padding-left: 16px; padding-right: 16px; }
  .page { padding-bottom: 40px; }
  .btn { min-height: 46px; }
  .card, .pm-card, .form-card, .product-card, .supplier-card, .rfq-card { padding: var(--sp-4); border-radius: 14px; }
  .table thead th, .table tbody td { padding: 10px 12px; font-size: 13px; }
  .back-link { margin: 12px 0 2px; }
}
