:root {
  --red: #e32130;
  --red-dark: #b91e2a;
  --yellow: #fdc60d;
  --ink: #202124;
  --muted: #6c7077;
  --line: #e4e7ea;
  --soft: #f5f7f8;
  --teal: #3fb4a4;
  --white: #fff;
  --shadow: 0 14px 40px rgba(32, 33, 36, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--soft); color: var(--ink); font-family: "Nunito Sans", Arial, sans-serif; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.portal-header { align-items: center; background: rgba(255,255,255,0.97); border-bottom: 1px solid var(--line); display: flex; gap: 30px; min-height: 76px; padding: 0 max(24px, 5vw); position: sticky; top: 0; z-index: 10; }
.portal-brand { align-items: center; display: flex; flex: 0 0 auto; }
.portal-logo { height: 54px; object-fit: contain; width: 105px; }
.portal-nav { align-items: center; display: flex; gap: 20px; margin-right: auto; }
.portal-nav a { color: #50545a; font-size: 13px; font-weight: 800; }
.portal-nav a:hover, .portal-nav a.is-active { color: var(--red); }
.portal-actions { align-items: center; display: flex; gap: 12px; }
.portal-session { color: var(--muted); font-size: 11px; font-weight: 800; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-button { align-items: center; border: 0; border-radius: 4px; display: inline-flex; font-size: 12px; font-weight: 900; gap: 7px; justify-content: center; min-height: 40px; padding: 0 14px; }
.portal-button-primary { background: var(--red); color: #fff; }
.portal-button-primary:hover { background: var(--red-dark); }
.portal-button-dark { background: var(--ink); color: #fff; }
.portal-button-dark:hover { background: #000; }
.portal-button-outline { background: transparent; border: 1px solid var(--ink); color: var(--ink); }
.portal-button-outline:hover { background: var(--ink); color: #fff; }
.portal-button-quiet { background: transparent; color: var(--ink); }
.portal-button-quiet:hover { background: var(--soft); }

.portal-main { margin: 0 auto; max-width: 1240px; padding: 54px max(24px, 5vw) 90px; }
.portal-page-head { align-items: end; border-bottom: 1px solid var(--line); display: flex; gap: 30px; justify-content: space-between; margin-bottom: 38px; padding-bottom: 28px; }
.portal-kicker { color: var(--red); display: block; font-size: 10px; font-weight: 900; letter-spacing: 0.13em; margin-bottom: 12px; text-transform: uppercase; }
.portal-page-head h1 { font-size: clamp(34px, 5vw, 62px); letter-spacing: 0; line-height: 0.98; margin: 0; max-width: 720px; }
.portal-page-head h1 em { color: var(--red); font-style: normal; }
.portal-page-head p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 15px 0 0; max-width: 570px; }
.portal-page-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: end; }
.portal-section { margin-top: 50px; }
.portal-section-head { align-items: end; display: flex; gap: 20px; justify-content: space-between; margin-bottom: 18px; }
.portal-section-head h2 { font-size: 28px; line-height: 1.05; margin: 0; }
.portal-section-note { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; max-width: 420px; text-align: right; }
.portal-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-panel { background: var(--white); border: 1px solid var(--line); padding: 22px; }
.portal-panel h3 { font-size: 19px; line-height: 1.1; margin: 0 0 10px; }
.portal-panel p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; }
.portal-panel-top { align-items: start; display: flex; gap: 12px; justify-content: space-between; }
.portal-panel-tag { background: #fff7d4; color: #76620c; font-size: 9px; font-weight: 900; letter-spacing: 0.07em; padding: 6px 8px; text-transform: uppercase; }
.portal-panel-tag.is-green { background: #e8f6f3; color: #237b70; }
.portal-panel-tag.is-red { background: #fde4e6; color: var(--red-dark); }
.portal-actions-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.portal-actions-row .portal-button { min-height: 37px; }

.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--white); border-top: 4px solid var(--red); padding: 17px; }
.kpi:nth-child(2) { border-color: var(--yellow); }
.kpi:nth-child(3) { border-color: var(--teal); }
.kpi:nth-child(4) { border-color: #3d2453; }
.kpi strong { display: block; font-size: 31px; line-height: 1; }
.kpi span { color: var(--muted); display: block; font-size: 10px; line-height: 1.35; margin-top: 7px; }

.table-wrap { background: var(--white); border: 1px solid var(--line); overflow-x: auto; }
.portal-table { border-collapse: collapse; min-width: 650px; width: 100%; }
.portal-table th { background: var(--soft); color: var(--muted); font-size: 9px; letter-spacing: 0.1em; padding: 12px 15px; text-align: left; text-transform: uppercase; }
.portal-table td { border-top: 1px solid var(--line); font-size: 12px; padding: 14px 15px; vertical-align: middle; }
.portal-table td small { color: var(--muted); display: block; font-size: 10px; margin-top: 3px; }
.status { display: inline-flex; font-size: 10px; font-weight: 900; padding: 6px 8px; white-space: nowrap; }
.status-pending { background: #fff7d4; color: #76620c; }
.status-ready { background: #e8f6f3; color: #237b70; }
.status-alert { background: #fde4e6; color: var(--red-dark); }
.status-neutral { background: var(--soft); color: var(--muted); }

.auth-page { align-items: center; display: flex; min-height: calc(100vh - 76px); }
.auth-layout { display: grid; gap: 42px; grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr); margin: 0 auto; max-width: 1100px; width: 100%; }
.auth-copy { align-self: center; }
.auth-copy h1 { font-size: clamp(42px, 6vw, 74px); line-height: 0.95; margin: 0; max-width: 500px; }
.auth-copy h1 em { color: var(--red); font-style: normal; }
.auth-copy p { color: var(--muted); font-size: 15px; line-height: 1.65; margin: 23px 0 0; max-width: 450px; }
.auth-note { border-left: 4px solid var(--yellow); margin-top: 28px; padding-left: 15px; }
.auth-note strong { display: block; font-size: 13px; }
.auth-note span { color: var(--muted); display: block; font-size: 11px; line-height: 1.45; margin-top: 4px; }
.auth-box { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 30px; }
.auth-box h2 { font-size: 28px; margin: 0; }
.auth-box > p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 20px; }
.role-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.role-option { background: var(--soft); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 145px; padding: 15px; position: relative; text-align: left; }
.role-option:hover, .role-option.is-selected { background: #fff7d4; border-color: var(--yellow); }
.role-option-icon { align-items: center; background: #fff; border-radius: 50%; color: var(--red); display: flex; font-size: 21px; height: 38px; justify-content: center; margin-bottom: 18px; width: 38px; }
.role-option strong { font-size: 15px; }
.role-option small { color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 5px; }
.role-option-arrow { bottom: 12px; color: var(--red); font-size: 18px; position: absolute; right: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; margin-top: 20px; }
.auth-form label, .portal-form label { color: #555a60; display: flex; flex-direction: column; font-size: 10px; font-weight: 900; gap: 6px; letter-spacing: 0.04em; }
.auth-form input, .portal-form input, .portal-form select, .portal-form textarea { background: #fff; border: 1px solid #dfe2e5; border-radius: 3px; color: var(--ink); font-size: 13px; min-height: 42px; outline: 0; padding: 9px 11px; resize: vertical; }
.auth-form input:focus, .portal-form input:focus, .portal-form select:focus, .portal-form textarea:focus { border-color: var(--red); }
.auth-form .portal-button { margin-top: 5px; }
.auth-switch { border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 9px 14px; justify-content: space-between; margin-top: 20px; padding-top: 15px; }
.auth-switch span, .auth-footnote { color: var(--muted); font-size: 10px; line-height: 1.45; }
.link-button { background: transparent; border: 0; color: var(--red); font-size: 11px; font-weight: 900; padding: 0; }
.link-button:hover { color: var(--red-dark); }
.admin-access { border-top: 1px solid var(--line); margin-top: 21px; padding-top: 15px; text-align: right; }
.admin-access button { color: var(--muted); }
.admin-access small { color: #9a9da2; display: block; font-size: 9px; margin-top: 5px; }

.profile-strip { align-items: center; background: var(--ink); color: #fff; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 38px; padding: 19px 22px; }
.profile-strip strong { color: var(--yellow); display: block; font-size: 15px; }
.profile-strip span { color: rgba(255,255,255,0.72); display: block; font-size: 11px; margin-top: 3px; }
.profile-strip .portal-button { background: #fff; color: var(--ink); }
.profile-strip .portal-button:hover { background: var(--yellow); }
.payment-card { border-left: 4px solid var(--teal); }
.payment-card strong { display: block; font-size: 20px; margin: 15px 0 4px; }
.payment-card span { color: var(--muted); font-size: 11px; }
.favorites-list { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.favorite-item { align-items: center; background: var(--white); border: 1px solid var(--line); display: flex; gap: 12px; padding: 10px; }
.favorite-item img { height: 54px; object-fit: cover; width: 54px; }
.favorite-item strong { display: block; font-size: 12px; line-height: 1.2; }
.favorite-item small { color: var(--muted); display: block; font-size: 10px; margin-top: 4px; }
.empty-state { background: var(--white); border: 1px dashed #cfd3d7; color: var(--muted); font-size: 12px; padding: 22px; }
.empty-state a { color: var(--red); font-weight: 900; }
.product-mini-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.product-mini { background: var(--white); border: 1px solid var(--line); min-width: 0; }
.product-mini img { height: 130px; object-fit: cover; width: 100%; }
.product-mini-copy { padding: 12px; }
.product-mini-copy strong { display: block; font-size: 13px; line-height: 1.2; }
.product-mini-copy span { color: var(--red); display: block; font-size: 11px; font-weight: 900; margin-top: 6px; }
.product-mini-copy small { color: var(--muted); display: block; font-size: 10px; margin-top: 3px; }

.company-hero { background: var(--yellow); display: grid; gap: 30px; grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 38px; padding: 30px; }
.company-hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 0.96; margin: 0; }
.company-hero p { color: #76620c; font-size: 13px; line-height: 1.5; margin: 13px 0 0; max-width: 560px; }
.company-hero-status { align-self: start; background: var(--ink); color: #fff; font-size: 10px; font-weight: 900; padding: 9px 11px; text-transform: uppercase; }
.company-workspace-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
.company-workspace-grid .portal-panel:first-child { grid-row: span 2; }
.portal-form { display: flex; flex-direction: column; gap: 13px; margin-top: 17px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.portal-form small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.checkline { align-items: center; color: var(--ink) !important; flex-direction: row !important; font-size: 11px !important; font-weight: 700 !important; gap: 8px !important; letter-spacing: 0 !important; }
.checkline input { accent-color: var(--red); min-height: auto; }
.storefront-preview { border-top: 4px solid var(--red); margin-top: 18px; padding-top: 17px; }
.storefront-preview strong { display: block; font-size: 20px; }
.storefront-preview p { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 8px; }
.company-product-list { border-top: 1px solid var(--line); margin-top: 18px; }
.company-product-row { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 12px 0; }
.company-product-row strong { font-size: 12px; }
.company-product-row small { color: var(--muted); display: block; font-size: 10px; margin-top: 3px; }

.admin-layout { display: grid; gap: 32px; grid-template-columns: 205px minmax(0, 1fr); }
.admin-sidebar { align-self: start; background: var(--ink); color: #fff; padding: 20px; position: sticky; top: 100px; }
.admin-sidebar strong { color: var(--yellow); display: block; font-size: 17px; }
.admin-sidebar span { color: rgba(255,255,255,0.6); display: block; font-size: 10px; line-height: 1.4; margin-top: 4px; }
.admin-sidebar nav { border-top: 1px solid #414347; display: flex; flex-direction: column; gap: 3px; margin-top: 24px; padding-top: 14px; }
.admin-sidebar nav a { color: #d7d9dc; font-size: 11px; padding: 9px 0; }
.admin-sidebar nav a:hover { color: var(--yellow); }
.admin-content { min-width: 0; }
.admin-section { scroll-margin-top: 100px; }
.admin-section + .admin-section { margin-top: 42px; }
.admin-section h2 { font-size: 27px; margin: 0 0 16px; }
.admin-split { display: grid; gap: 18px; grid-template-columns: 1.1fr 0.9fr; }
.activity-list { border-top: 1px solid var(--line); }
.activity-row { border-bottom: 1px solid var(--line); display: flex; gap: 13px; justify-content: space-between; padding: 13px 0; }
.activity-row strong { display: block; font-size: 12px; }
.activity-row span { color: var(--muted); display: block; font-size: 10px; margin-top: 3px; }
.activity-row time { color: var(--muted); font-size: 10px; white-space: nowrap; }

.portal-toast { background: var(--ink); bottom: 22px; color: #fff; font-size: 12px; left: 50%; max-width: calc(100% - 32px); opacity: 0; padding: 12px 16px; pointer-events: none; position: fixed; transform: translate(-50%, 15px); transition: opacity 180ms ease, transform 180ms ease; z-index: 30; }
.portal-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.portal-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; padding: 18px max(24px, 5vw) 26px; }
.portal-footer-inner { align-items: center; display: flex; gap: 20px; justify-content: space-between; margin: 0 auto; max-width: 1240px; }

@media (max-width: 900px) {
  .portal-nav { gap: 12px; }
  .portal-session { display: none; }
  .auth-layout, .company-workspace-grid, .admin-split { grid-template-columns: 1fr; }
  .auth-page { align-items: start; }
  .auth-copy { padding-top: 20px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 15px; }
  .admin-sidebar nav a { padding: 4px 0; }
}

@media (max-width: 620px) {
  .portal-header { gap: 12px; min-height: 66px; padding: 0 16px; }
  .portal-logo { height: 46px; width: 88px; }
  .portal-nav { display: none; }
  .portal-actions { margin-left: auto; }
  .portal-actions .portal-button-quiet { display: none; }
  .portal-main { padding: 34px 17px 65px; }
  .portal-page-head { align-items: start; flex-direction: column; gap: 18px; }
  .portal-page-actions { justify-content: start; }
  .portal-section-head { align-items: start; flex-direction: column; }
  .portal-section-note { text-align: left; }
  .portal-grid, .kpi-grid, .product-mini-grid, .favorites-list, .role-grid { grid-template-columns: 1fr; }
  .auth-box { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .profile-strip, .company-hero { align-items: start; display: flex; flex-direction: column; }
  .profile-strip .portal-button { width: 100%; }
  .portal-footer-inner { align-items: start; flex-direction: column; }
}
