/* B2B Portal — GANG BRANDS
   Design system: monochrome ink on warm paper, single blue accent. */

:root {
    --ink: #12141a;
    --ink-2: #1b1e26;
    --ink-3: #2a2e38;
    --paper: #f6f5f2;
    --card: #ffffff;
    --line: #e4e1da;
    --line-strong: #d3cfc6;
    --muted: #74787f;
    --accent: #1346af;
    --accent-dark: #0f3788;
    --accent-soft: #e9eefb;
    --ok: #1f7a4d;
    --warn: #a35c00;
    --danger: #a52626;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(18, 20, 26, .06), 0 1px 3px rgba(18, 20, 26, .04);
    --shadow-md: 0 8px 24px rgba(18, 20, 26, .08);
    --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */

.p-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.p-header__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 28px;
    height: 66px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.p-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    font-size: 13px;
    text-transform: uppercase;
}

.p-logo img { height: 26px; width: auto; display: block; }

.p-logo__tag {
    font-weight: 400;
    letter-spacing: .18em;
    color: var(--muted);
    border-left: 1px solid var(--line-strong);
    padding-left: 10px;
    font-size: 10px;
}

.p-nav { display: flex; gap: 4px; margin-left: 8px; }

.p-nav a {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--ink-3);
    transition: background .15s ease, color .15s ease;
}

.p-nav a:hover { background: #f1efe9; }
.p-nav a.is-active { background: var(--ink); color: #fff; }

.p-header__spacer { flex: 1; }

.p-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.p-user strong { color: var(--ink); font-weight: 500; }

/* ---------- Layout ---------- */

.p-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px;
}

.p-page-head { margin-bottom: 22px; }

.p-eyebrow {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
}

.p-title {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -.01em;
    margin: 6px 0 0;
}

.p-subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ---------- Buttons ---------- */

.p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    background: var(--ink);
    color: #fff;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}

.p-btn:hover { background: #000; }
.p-btn:active { transform: translateY(1px); }
.p-btn:disabled { opacity: .5; cursor: not-allowed; }

.p-btn--accent { background: var(--accent); }
.p-btn--accent:hover { background: var(--accent-dark); }

.p-btn--ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-strong);
}
.p-btn--ghost:hover { background: #fff; border-color: var(--ink); }

.p-btn--sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.p-btn--block { width: 100%; }

/* ---------- Hero / dashboard ---------- */

.p-hero {
    background: radial-gradient(120% 140% at 100% 0%, #23304d 0%, var(--ink) 55%);
    color: #fff;
    border-radius: var(--radius);
    padding: 34px 36px;
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-end;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
}

.p-hero h1 {
    font-size: 30px;
    font-weight: 500;
    margin: 10px 0 8px;
    letter-spacing: -.015em;
}

.p-hero p { color: rgba(255, 255, 255, .72); margin: 0; font-size: 14px; }

.p-hero .p-eyebrow { color: rgba(255, 255, 255, .55); }

.p-hero__stats { display: flex; gap: 34px; }

.p-stat__value { font-size: 22px; font-weight: 500; }
.p-stat__label { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.55); }

.p-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.p-tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.p-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.p-tile__label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.p-tile__value { font-size: 24px; font-weight: 500; }
.p-tile__hint { color: var(--muted); font-size: 13px; }

/* ---------- Search ---------- */

.p-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.p-search {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.p-search input {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 12px;
    padding: 13px 16px 13px 42px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.p-search input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18,20,26,.06); }

.p-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 1.8;
}

.p-hint { font-size: 12.5px; color: var(--muted); }

/* ---------- Product grid ---------- */

.p-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

.p-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 18px;
}

.p-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.p-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--line-strong); }

.p-card__media {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f0eee8;
    display: block;
}

.p-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.p-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b9b4a8;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.p-card__body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }

.p-card__code { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.p-card__name {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.p-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; }

.p-card__price { font-size: 15px; font-weight: 600; }
.p-card__price small { font-size: 10px; color: var(--muted); font-weight: 400; display: block; }

.p-card__add {
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fff;
    border-radius: 9px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background .15s ease, transform .12s ease;
}

.p-card__add:hover { background: var(--accent); border-color: var(--accent); }
.p-card__add:active { transform: scale(.96); }

/* ---------- Cart ---------- */

.p-cart {
    position: sticky;
    top: 86px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 110px);
}

.p-cart__head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.p-cart__title { font-size: 14px; font-weight: 500; letter-spacing: .02em; }
.p-cart__count { font-size: 11.5px; color: var(--muted); }

.p-cart__lines { overflow-y: auto; padding: 6px 8px; flex: 1; }

.p-line {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    align-items: center;
}

.p-line:hover { background: #faf9f6; }

.p-line__thumb {
    width: 52px;
    height: 66px;
    border-radius: 7px;
    overflow: hidden;
    background: #f0eee8;
}

.p-line__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.p-line__name { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.p-line__meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.p-line__sum { font-size: 13px; font-weight: 600; text-align: right; }

.p-line__controls { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

.p-qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }

.p-qty button {
    width: 24px;
    height: 26px;
    border: 0;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: var(--ink-3);
}

.p-qty button:hover { background: #f1efe9; }

.p-qty input {
    width: 38px;
    height: 26px;
    border: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    text-align: center;
    font-family: inherit;
    font-size: 12.5px;
    outline: none;
}

.p-line__remove {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.p-line__remove:hover { color: var(--danger); }

.p-cart__foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; }

.p-cart__row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.p-cart__row strong { color: var(--ink); font-size: 15px; }

.p-cart__note { font-size: 11.5px; color: var(--muted); margin: 10px 0 14px; }

/* ---------- Filters ---------- */

.p-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.p-filters__group { display: flex; flex-wrap: wrap; gap: 4px; }

.p-filter {
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--ink-3);
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
}

.p-filter:hover { background: #f1efe9; }
.p-filter.is-active { background: var(--ink); color: #fff; }

.p-filters__group--sub {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    gap: 0;
}

.p-sublink {
    font-size: 12px;
    color: var(--muted);
    padding: 4px 0;
    margin-right: 18px;
    border-bottom: 1px solid transparent;
    transition: color .15s ease, border-color .15s ease;
    white-space: nowrap;
}

.p-sublink:hover { color: var(--ink); }
.p-sublink.is-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ---------- Empty / alerts ---------- */

.p-empty {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 46px 24px;
    text-align: center;
    color: var(--muted);
    background: #fbfaf7;
}

.p-empty__title { color: var(--ink); font-size: 15px; font-weight: 500; margin-bottom: 6px; }

.p-alert {
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}

.p-alert--ok { background: #eef7f1; border-color: #cfe7d8; color: var(--ok); }
.p-alert--err { background: #fdf0f0; border-color: #f3d2d2; color: var(--danger); }
.p-alert--info { background: var(--accent-soft); border-color: #d4ddf4; color: var(--accent-dark); }

/* ---------- Tables ---------- */

.p-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.p-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.p-table th {
    text-align: left;
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #fbfaf7;
}

.p-table td { padding: 14px 16px; border-bottom: 1px solid #f0eee8; vertical-align: middle; }
.p-table tr:last-child td { border-bottom: 0; }
.p-table td.num, .p-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.p-table tbody tr:hover { background: #fbfaf7; }

.p-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    letter-spacing: .04em;
    background: #f0eee8;
    color: var(--ink-3);
    white-space: nowrap;
}
.p-badge--ok { background: #eaf4ee; color: var(--ok); }
.p-badge--warn { background: #fdf3e3; color: var(--warn); }

.p-mono { font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */

.p-field { display: flex; flex-direction: column; gap: 6px; }
.p-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.p-input, .p-select, .p-textarea {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13.5px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.p-input:focus, .p-select:focus, .p-textarea:focus { border-color: var(--ink); }

.p-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }

/* ---------- Auth ---------- */

.auth { background: var(--ink); }

.auth__shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.auth__brand {
    position: relative;
    overflow: hidden;
    background: radial-gradient(120% 90% at 10% 0%, #2a3552 0%, var(--ink) 55%), var(--ink);
    color: #fff;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth__brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px);
    background-size: 18px 18px;
    pointer-events: none;
}

.auth__brand > * { position: relative; z-index: 1; }

.auth__brand-top { display: flex; align-items: center; gap: 14px; }

.auth__brand-top img {
    height: 32px;
    width: auto;
    filter: invert(1) grayscale(1) brightness(1.8);
}

.auth__badge {
    border: 1px solid rgba(255, 255, 255, .25);
    color: rgba(255, 255, 255, .8);
    font-size: 10px;
    letter-spacing: .2em;
    padding: 4px 8px;
    border-radius: 6px;
}

.auth__brand-copy h1 {
    font-size: clamp(30px, 3.4vw, 46px);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -.02em;
    margin: 18px 0 14px;
}

.auth__brand-copy p { color: rgba(255, 255, 255, .62); max-width: 34ch; font-size: 14.5px; margin: 0; }

.auth__eyebrow {
    text-transform: uppercase;
    letter-spacing: .22em;
    font-size: 10.5px;
    color: rgba(255, 255, 255, .55);
}

.auth__brands {
    font-size: 10.5px;
    letter-spacing: .18em;
    color: rgba(255, 255, 255, .45);
    text-transform: uppercase;
}

.auth__panel {
    background: var(--paper);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth__box { width: 100%; max-width: 380px; }

.auth__head h2 {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -.01em;
    margin: 8px 0 6px;
}

.auth__sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

.auth__password { position: relative; }

.auth__password .p-input { width: 100%; padding-right: 44px; }

.auth__toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    padding: 6px;
    display: flex;
}

.auth__toggle:hover { color: var(--ink); }

.auth__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 18px;
    font-size: 12.5px;
}

.auth__check { display: flex; align-items: center; gap: 8px; color: var(--ink-3); cursor: pointer; }
.auth__check input { accent-color: var(--ink); width: 15px; height: 15px; }

.auth__link { color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.auth__link:hover { color: var(--ink); border-bottom-color: var(--ink); }

.auth__submit { padding: 12px 16px; font-size: 14px; margin-top: 4px; }
.auth__submit.is-loading { opacity: .7; pointer-events: none; }

.auth__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.auth__divider::before, .auth__divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.auth__foot { margin-top: 24px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
.auth__legal { margin-top: 28px; font-size: 11px; color: var(--muted); }
.auth__error { margin-bottom: 14px; }

.auth__field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

@media (max-width: 900px) {
    .auth__shell { grid-template-columns: 1fr; }
    .auth__brand { padding: 26px 24px; }
    .auth__brand-copy h1 { font-size: 25px; margin: 10px 0 6px; }
    .auth__brand-copy p { display: none; }
    .auth__brands { display: none; }
    .auth__panel { padding: 28px 20px 40px; }
}

/* ---------- Admin ---------- */

.a-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }

.a-thumb {
    width: 46px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #f0eee8;
    display: block;
}

.a-thumb--lg {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    background: #faf9f6;
}

.a-meta { font-size: 12px; color: var(--muted); line-height: 1.45; }

.a-dl {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 6px 10px;
    margin: 18px 0 10px;
    font-size: 12px;
}

.a-dl dt { color: var(--muted); }
.a-dl dd { margin: 0; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

.a-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    cursor: pointer;
}

.a-check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--ink); }

.a-pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 16px; font-size: 13px; }
.a-pager a, .a-pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.a-pager a:hover { border-color: var(--ink); }
.a-pager .is-disabled { color: #c4c0b8; }

@media (max-width: 900px) {
    .a-grid { grid-template-columns: 1fr; }
}

/* ---------- Mobile ---------- */

.p-cart-mobile { display: none; }

@media (max-width: 1100px) {
    .p-layout { grid-template-columns: minmax(0, 1fr); }
    .p-cart { position: static; max-height: none; }
}

@media (max-width: 720px) {
    .p-header__inner { padding: 0 16px; height: 58px; gap: 14px; }
    .p-nav { display: none; }
    .p-container { padding: 16px; }
    .p-title { font-size: 21px; }
    .p-hero { padding: 22px; }
    .p-hero h1 { font-size: 23px; }
    .p-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .p-card__name { font-size: 12.5px; min-height: 34px; }
    .p-cart { display: none; }
    .p-cart-mobile {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        background: #fff;
        border-top: 1px solid var(--line);
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        z-index: 50;
        box-shadow: 0 -6px 20px rgba(18,20,26,.08);
    }
    .p-table { font-size: 12px; }
    .p-table th, .p-table td { padding: 10px; }

    .p-filters__group { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
    .p-filters__group::-webkit-scrollbar { display: none; }
}

@media print {
    .p-header, .p-cart, .p-cart-mobile { display: none !important; }
}
