/* ============================================================================
   Bizmitra Customer Portal — storefront design system (Phase 2.1)
   A consumer-commerce look inspired by Shopify (clean cards), Amazon (clear
   pricing + warm CTA accents) and Apple (whitespace, system typography, soft
   depth). Deliberately DIFFERENT from the partner/admin console: no dark
   sidebar, light top-nav storefront, warm accent, Apple system font.
   One cached stylesheet for the app shell AND the auth screens. Pair with FA 6.
   ============================================================================ */

:root {
    /* Apple-ish neutral ink + warm commerce accent (not the partner indigo) */
    --ink:        #1d1d1f;
    --ink-2:      #3a3a3c;
    --muted:      #6e6e73;
    --accent:     #ff6a1f;   /* warm commerce orange — energetic, distinct */
    --accent-2:   #e85c12;
    --accent-soft:#fff1e8;
    --surface:    #ffffff;
    --bg:         #fafafa;    /* Apple off-white, warm-neutral (not blue-tinted) */
    --line:       #e7e7ea;    /* hairline gray */
    --line-2:     #d2d2d7;
    --ok:         #0a7d33;
    --ok-soft:    #e8f6ec;
    --warn:       #9a5b00;
    --warn-soft:  #fff4e0;
    --danger:     #c11414;
    --danger-soft:#fdecec;
    --radius:     18px;
    --radius-sm:  12px;
    --pill:       999px;
    --shadow-sm:  0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.05);
    --shadow:     0 4px 12px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.06);
    --shadow-lg:  0 20px 48px rgba(0,0,0,.12);
    --nav-h:      66px;
    --focus:      0 0 0 3px rgba(255,106,31,.30);
    --maxw:       1160px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
            "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
    font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em;
}
h1, h2, h3 { letter-spacing: -0.02em; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ===========================  AUTH (centered card)  ====================== */
.cp-auth {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background:
        radial-gradient(900px 500px at 12% -10%, #fff1e8 0%, transparent 55%),
        radial-gradient(900px 500px at 108% 8%, #f3f3f5 0%, transparent 55%), var(--bg);
}
.cp-auth-card {
    width: 100%; max-width: 430px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
    padding: 36px 32px; animation: cp-rise .35s ease;
}
@keyframes cp-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===========================  STOREFRONT TOP NAV  ======================= */
.cp-nav {
    position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.cp-nav-inner {
    max-width: var(--maxw); margin: 0 auto; height: var(--nav-h);
    display: flex; align-items: center; gap: 20px; padding: 0 22px;
}
.cp-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--ink); white-space: nowrap; }
.cp-brand:hover { color: var(--ink); }
.cp-brand .mk {
    width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.cp-nav-links { display: flex; align-items: center; gap: 4px; margin-left: 10px; }
.cp-navlink {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--pill);
    color: var(--ink-2); font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.cp-navlink i { font-size: 14px; opacity: .8; }
.cp-navlink:hover { background: #f2f2f4; color: var(--ink); }
.cp-navlink.active { background: var(--ink); color: #fff; }
.cp-navlink.active i { opacity: 1; }
.cp-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.cp-cart {
    position: relative; width: 42px; height: 42px; border-radius: var(--pill);
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink); font-size: 17px;
    transition: background .15s;
}
.cp-cart:hover { background: #f2f2f4; color: var(--ink); }
.cp-badge-count {
    position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--accent); color: #fff; border-radius: var(--pill); font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff;
}
.cp-account { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.cp-avatar {
    width: 34px; height: 34px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent-2);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.cp-account .meta { line-height: 1.15; }
.cp-account .meta .n { font-weight: 600; font-size: 13.5px; }
.cp-account .meta .c { font-size: 11.5px; color: var(--muted); }
.cp-signout { width: 38px; height: 38px; border-radius: var(--pill); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.cp-signout:hover { background: #f2f2f4; color: var(--danger); }

.cp-hamburger { display: none; background: none; border: none; width: 40px; height: 40px; border-radius: var(--pill); cursor: pointer; color: var(--ink); font-size: 18px; }
.cp-hamburger:hover { background: #f2f2f4; }

/* Mobile slide-down menu */
.cp-mobilenav { display: none; border-bottom: 1px solid var(--line); background: #fff; padding: 8px 14px 14px; }
.cp-mobilenav.open { display: block; }
.cp-mobilenav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 12px;
    color: var(--ink); font-weight: 500; font-size: 15px;
}
.cp-mobilenav a i { width: 20px; text-align: center; color: var(--muted); }
.cp-mobilenav a.active { background: var(--ink); color: #fff; }
.cp-mobilenav a.active i { color: #fff; }
.cp-mobilenav .sep { height: 1px; background: var(--line); margin: 6px 8px; }

@media (max-width: 820px) {
    .cp-nav-links, .cp-account .meta { display: none; }
    .cp-hamburger { display: inline-flex; align-items: center; justify-content: center; }
}

/* ===========================  CONTENT  ================================= */
.cp-content { max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 60px; }
@media (max-width: 820px) { .cp-content { padding: 20px 15px 44px; } }
.cp-page-head { margin: 0 0 24px; }
.cp-page-head h1 { font-size: 30px; font-weight: 700; margin: 0 0 6px; }
.cp-page-head p { margin: 0; color: var(--muted); font-size: 15.5px; }
@media (max-width: 820px) { .cp-page-head h1 { font-size: 24px; } }

/* ===========================  COMPONENTS  ============================== */
.cp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.cp-card-title { font-weight: 600; font-size: 16px; margin: 0 0 16px; display: flex; align-items: center; gap: 9px; }
.cp-card-title .cp-link { margin-left: auto; font-size: 13.5px; font-weight: 500; color: var(--accent); }
.cp-link { color: var(--accent); }

.cp-grid { display: grid; gap: 18px; }
.cp-grid-kpi { grid-template-columns: repeat(4, 1fr); }
.cp-grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .cp-grid-kpi { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px)  { .cp-grid-kpi, .cp-grid-2 { grid-template-columns: 1fr; } }

.cp-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; display: flex; gap: 15px; align-items: flex-start; transition: box-shadow .2s, transform .2s; }
.cp-kpi:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cp-kpi .ic { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; background: var(--accent-soft); color: var(--accent-2); }
.cp-kpi .ic.g { background: var(--ok-soft); color: var(--ok); }
.cp-kpi .ic.a { background: var(--warn-soft); color: var(--warn); }
.cp-kpi .ic.r { background: #f0f0f3; color: var(--ink); }
.cp-kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.cp-kpi .val { font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 3px; letter-spacing: -0.02em; }
.cp-kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* Tables */
.cp-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.cp-table { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--surface); }
.cp-table th, .cp-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.cp-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; background: #fafafa; }
.cp-table tbody tr { transition: background .12s; }
.cp-table tbody tr:hover { background: #fafafa; }
.cp-table tbody tr:last-child td { border-bottom: none; }
.cp-table td.num, .cp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cp-table .muted { color: var(--muted); }

/* Buttons — ink-black primary (Apple/Shopify), pill, with a warm accent variant */
.cp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: var(--pill); border: 1px solid var(--ink);
    background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: transform .06s, background .15s, box-shadow .15s; text-decoration: none;
}
.cp-btn:hover { background: #000; color: #fff; }
.cp-btn:active { transform: scale(.98); }
.cp-btn.sm { padding: 8px 15px; font-size: 13px; }
.cp-btn.accent { background: var(--accent); border-color: var(--accent); }
.cp-btn.accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.cp-btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.cp-btn.ghost:hover { background: #f7f7f8; color: var(--ink); border-color: var(--ink-2); }
.cp-btn.ok { background: var(--ok); border-color: var(--ok); }
.cp-btn.ok:hover { background: #096a2b; }
.cp-btn.block { width: 100%; }
.cp-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Badges */
.cp-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: var(--pill); font-size: 12px; font-weight: 600; background: #f0f0f3; color: var(--ink-2); }
.cp-badge.ok    { background: var(--ok-soft);     color: var(--ok); }
.cp-badge.due   { background: var(--warn-soft);   color: var(--warn); }
.cp-badge.danger{ background: var(--danger-soft); color: var(--danger); }
.cp-badge.info  { background: var(--accent-soft); color: var(--accent-2); }

/* Forms */
.cp-field { margin-bottom: 16px; }
.cp-label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 7px; color: var(--ink-2); }
.cp-input, .cp-select, .cp-textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.cp-input:focus, .cp-select:focus, .cp-textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
.cp-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Quantity stepper */
.cp-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--pill); overflow: hidden; }
.cp-stepper button { width: 36px; border: none; background: #fff; color: var(--ink); font-size: 17px; cursor: pointer; transition: background .12s; }
.cp-stepper button:hover { background: #f2f2f4; }
.cp-stepper input { width: 52px; border: none; text-align: center; font-size: 15px; outline: none; font-variant-numeric: tabular-nums; background: #fff; }

/* Alerts */
.cp-alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; display: flex; gap: 9px; align-items: center; }
.cp-alert.ok     { background: var(--ok-soft);     color: var(--ok);     border-color: #bfe6c9; }
.cp-alert.error  { background: var(--danger-soft); color: var(--danger); border-color: #f4c7c7; }
.cp-alert.info   { background: var(--accent-soft); color: var(--accent-2); border-color: #ffd8c2; }
.cp-alert ul { margin: 0; padding-left: 18px; }

/* Empty state */
.cp-empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.cp-empty i { font-size: 38px; color: var(--line-2); margin-bottom: 14px; display: block; }
.cp-empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 17px; font-weight: 600; }

/* Sticky action bar (shop) */
.cp-actionbar {
    position: sticky; bottom: 0; z-index: 20; background: rgba(255,255,255,.9);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line); border-radius: var(--pill); box-shadow: var(--shadow);
    padding: 12px 12px 12px 22px; margin: 22px 0 0; display: flex; align-items: center; gap: 14px;
}
.cp-actionbar .info { font-size: 14.5px; color: var(--muted); }
.cp-actionbar .info b { color: var(--ink); }
.cp-actionbar .cp-spacer { flex: 1; }

/* Product cards (shop) — Shopify-style grid */
.cp-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.cp-product { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 7px; transition: box-shadow .2s, transform .2s, border-color .2s; }
.cp-product:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.cp-product.selected { border-color: var(--accent); box-shadow: var(--focus); }
.cp-product .cp-thumb {
    width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; margin-bottom: 4px;
    background: linear-gradient(135deg,#f3f3f5,#eef2ff); display: flex; align-items: center; justify-content: center;
}
.cp-product .cp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cp-product .cp-thumb i { font-size: 34px; color: var(--line-2); }
.cp-product--compact .cp-thumb { aspect-ratio: 4 / 3; }
.cp-product .pname { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.cp-product .pmeta { font-size: 12.5px; color: var(--muted); }
.cp-product .pprice { font-size: 21px; font-weight: 700; margin-top: auto; letter-spacing: -0.02em; }
.cp-product .prow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

.cp-toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 22px; }
.cp-toolbar .grow { flex: 1; min-width: 220px; }

.cp-spacer { flex: 1; }
