/* Esango Eco Market — theme
   Palette: forest greens (growth), banana-fibre sand (craft), ocean teal (water), clay (earth) */
:root {
    --eco-900: #0f3a28;
    --eco-800: #14503a;
    --eco-700: #1c6b46;
    --eco-600: #26835a;
    --eco-500: #3f9a64;
    --eco-200: #cfe6d6;
    --eco-100: #e6f2e9;
    --eco-50:  #f3f9f5;
    --sand-50:  #fbf8f0;
    --sand-100: #f6efdd;
    --sand-300: #e3d2a6;
    --sand-500: #c9ae6d;
    --clay:  #b8723a;
    --ocean: #1c7c86;
    --ink:   #1d2a23;
    --muted: #5f6f66;
    --line:  #e4e9e3;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(15,58,40,.06), 0 1px 3px rgba(15,58,40,.08);
    --shadow-md: 0 8px 24px rgba(15,58,40,.10);
    --shadow-lg: 0 18px 44px rgba(15,58,40,.16);

    --bs-primary: var(--eco-700);
    --bs-primary-rgb: 28, 107, 70;
    --bs-link-color: var(--eco-700);
    --bs-link-hover-color: var(--eco-900);
    --bs-body-font-family: var(--font-body);
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--sand-50);
    --bs-border-radius: 12px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--sand-50); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .display-font { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; color: var(--eco-900); }
a { text-underline-offset: 3px; }
.text-eco { color: var(--eco-700) !important; }
.text-muted-eco { color: var(--muted) !important; }
.bg-eco-50 { background: var(--eco-50); }
.bg-sand { background: var(--sand-100); }
::selection { background: var(--eco-200); }
:focus-visible { outline: 3px solid rgba(63,154,100,.45); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 999px; padding: .6rem 1.25rem; transition: transform .15s ease, box-shadow .15s ease, background-color .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { --bs-btn-bg: var(--eco-700); --bs-btn-border-color: var(--eco-700); --bs-btn-hover-bg: var(--eco-800); --bs-btn-hover-border-color: var(--eco-800); --bs-btn-active-bg: var(--eco-900); --bs-btn-active-border-color: var(--eco-900); --bs-btn-disabled-bg: var(--eco-500); --bs-btn-disabled-border-color: var(--eco-500); box-shadow: 0 4px 14px rgba(28,107,70,.25); }
.btn-outline-primary { --bs-btn-color: var(--eco-700); --bs-btn-border-color: var(--eco-700); --bs-btn-hover-bg: var(--eco-700); --bs-btn-hover-border-color: var(--eco-700); --bs-btn-active-bg: var(--eco-800); }
.btn-clay { --bs-btn-bg: var(--clay); --bs-btn-border-color: var(--clay); --bs-btn-color: #fff; --bs-btn-hover-bg: #9f5f2c; --bs-btn-hover-border-color: #9f5f2c; --bs-btn-hover-color: #fff; }
.btn-light-eco { background: #fff; color: var(--eco-800); border: 1px solid var(--line); }
.btn-light-eco:hover { background: var(--eco-50); color: var(--eco-900); }
.btn-mpesa { background: #4cae3d; color: #fff; border: 0; box-shadow: 0 6px 18px rgba(76,174,61,.3); }
.btn-mpesa:hover { background: #3f9a32; color: #fff; }
.btn-lg { padding: .8rem 1.6rem; }

.form-control, .form-select { border-radius: 12px; border-color: #d5ddd6; padding: .65rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--eco-500); box-shadow: 0 0 0 .22rem rgba(63,154,100,.2); }
.form-label { font-weight: 600; font-size: .9rem; }
.form-check-input:checked { background-color: var(--eco-700); border-color: var(--eco-700); }

/* ---------- Top strip & navbar ---------- */
.topstrip { background: var(--eco-900); color: #d9eadf; font-size: .82rem; }
.topstrip a { color: #fff; text-decoration: none; }
/* NB: no backdrop-filter here — it would trap the fixed-position mobile menu (offcanvas) inside the header */
.site-nav { background: rgba(251,248,240,.98); border-bottom: 1px solid var(--line); z-index: 1030; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--eco-900); line-height: 1; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--clay); margin-top: 3px; }
.site-nav .nav-link { font-weight: 600; color: var(--ink); padding: .5rem .85rem; border-radius: 999px; }
.site-nav .nav-link:hover, .site-nav .nav-link.active { color: var(--eco-700); background: var(--eco-100); }
.nav-icon-btn { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--eco-900); font-size: 1.25rem; text-decoration: none; transition: background .15s; }
.nav-icon-btn:hover { background: var(--eco-100); color: var(--eco-700); }
.count-badge { position: absolute; top: 2px; right: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--clay); color: #fff; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--sand-50); }
.count-badge:empty, .count-badge[data-count="0"] { display: none; }

.search-wrap { position: relative; }
.search-input { border-radius: 999px; padding-left: 2.6rem; background: #fff; }
.search-wrap .bi-search { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.suggest-box { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 1050; display: none; }
.suggest-box a { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; color: var(--ink); text-decoration: none; }
.suggest-box a:hover, .suggest-box a:focus { background: var(--eco-50); }
.suggest-box img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; background: var(--sand-100); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background:
    radial-gradient(1000px 500px at 85% -10%, rgba(63,154,100,.35), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(28,124,134,.28), transparent 60%),
    linear-gradient(135deg, var(--eco-900), var(--eco-700)); color: #fff; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 5.2vw, 3.8rem); line-height: 1.08; }
.hero h1 em { font-style: italic; color: var(--sand-300); }
.hero .lead { color: #d6eadc; max-width: 34rem; }
.hero-pill { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); padding: .35rem .85rem; border-radius: 99px; font-size: .85rem; }
.hero-art { position: relative; aspect-ratio: 1 / 1; max-width: 440px; margin-inline: auto; }
.hero-art .blob { position: absolute; inset: 6%; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; background: linear-gradient(145deg, var(--sand-300), var(--sand-100)); box-shadow: var(--shadow-lg); animation: morph 14s ease-in-out infinite; }
.hero-art .leaf { position: absolute; color: var(--eco-500); animation: float 7s ease-in-out infinite; }
.hero-art .leaf.l1 { width: 46%; left: 6%; top: 8%; }
.hero-art .leaf.l2 { width: 32%; right: 4%; bottom: 10%; color: var(--ocean); animation-delay: -3s; }
.hero-art .chip { position: absolute; background: #fff; color: var(--eco-900); border-radius: 14px; padding: .55rem .8rem; box-shadow: var(--shadow-md); font-size: .8rem; font-weight: 600; display: flex; gap: .5rem; align-items: center; }
.hero-art .chip i { color: var(--eco-600); font-size: 1.1rem; }
.hero-art .chip.c1 { left: -2%; bottom: 20%; }
.hero-art .chip.c2 { right: 0; top: 14%; }
@keyframes morph { 0%,100% { border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; } 50% { border-radius: 58% 42% 45% 55% / 52% 58% 42% 48%; } }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .hero-art .blob, .hero-art .leaf { animation: none; } html { scroll-behavior: auto; } }

.trust-row { background: #fff; border-bottom: 1px solid var(--line); }
.trust-item { display: flex; align-items: center; gap: .75rem; padding: .9rem 0; font-size: .9rem; }
.trust-item i { font-size: 1.5rem; color: var(--eco-600); }
.trust-item strong { display: block; color: var(--eco-900); }

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--clay); }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }

.cat-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 1.2rem .8rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .2s, box-shadow .2s, border-color .2s; height: 100%; }
.cat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--eco-200); color: var(--ink); }
.cat-tile .ico { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--eco-100); color: var(--eco-700); font-size: 1.6rem; }
.cat-tile:nth-child(even) .ico { background: var(--sand-100); color: var(--clay); }
.cat-tile strong { font-size: .95rem; }
.cat-tile small { color: var(--muted); }

/* ---------- Product card ---------- */
.p-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 100%; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.p-media { position: relative; aspect-ratio: 1 / 1; background: var(--sand-100); overflow: hidden; display: block; }
.p-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.p-card:hover .p-media img { transform: scale(1.05); }
.p-badges { position: absolute; left: .6rem; top: .6rem; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.eco-badge { display: inline-flex; align-items: center; gap: .3rem; background: rgba(255,255,255,.95); color: var(--eco-800); font-size: .7rem; font-weight: 700; padding: .25rem .6rem; border-radius: 99px; box-shadow: var(--shadow-sm); }
.eco-badge i { color: var(--eco-500); }
.sale-badge { background: var(--clay); color: #fff; font-size: .7rem; font-weight: 700; padding: .25rem .6rem; border-radius: 99px; }
.p-actions { position: absolute; right: .6rem; top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.icon-toggle { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); color: var(--eco-900); display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: transform .15s, background .15s, color .15s; font-size: 1.05rem; }
.icon-toggle:hover { transform: scale(1.1); }
.icon-toggle .on { display: none; }
.icon-toggle.is-saved .on { display: inline; }
.icon-toggle.is-saved .off { display: none; }
.icon-toggle[data-type="wishlist"].is-saved { color: #d64560; }
.icon-toggle[data-type="bookmark"].is-saved { color: var(--ocean); }
.p-body { padding: .9rem 1rem 1.05rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.p-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.p-title { font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1.3; margin: 0; }
.p-title a { color: var(--ink); text-decoration: none; }
.p-title a::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.p-impact { font-size: .78rem; color: var(--eco-700); display: flex; gap: .35rem; align-items: flex-start; }
.price { font-weight: 700; color: var(--eco-900); font-size: 1.05rem; }
.price del { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: .35rem; }
.p-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .5rem; }
.p-foot .btn, .p-actions { position: relative; z-index: 2; }
.btn-add { padding: .45rem .9rem; font-size: .85rem; }
.stock-low { font-size: .75rem; color: var(--clay); font-weight: 600; }

/* ---------- Impact band ---------- */
.impact-band { background: linear-gradient(120deg, var(--sand-100), #fff); border: 1px solid var(--sand-300); border-radius: 24px; }
.impact-num { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); color: var(--eco-700); line-height: 1; }
.impact-chip { display: inline-flex; align-items: center; gap: .5rem; background: var(--eco-100); color: var(--eco-800); border-radius: 99px; padding: .35rem .8rem; font-size: .85rem; font-weight: 600; }

/* ---------- Shop ---------- */
.page-head { background: linear-gradient(135deg, var(--eco-50), var(--sand-100)); border-bottom: 1px solid var(--line); padding: 2rem 0; }
.filter-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.filter-card h6 { font-family: var(--font-body); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cat-link { display: flex; justify-content: space-between; padding: .4rem .65rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.cat-link:hover { background: var(--eco-50); }
.cat-link.active { background: var(--eco-100); color: var(--eco-800); font-weight: 700; }
.pagination .page-link { border-radius: 10px !important; margin: 0 .15rem; color: var(--eco-800); border-color: var(--line); }
.pagination .active .page-link { background: var(--eco-700); border-color: var(--eco-700); color: #fff; }

/* ---------- Product page ---------- */
.gallery-main { border-radius: 22px; overflow: hidden; background: var(--sand-100); aspect-ratio: 1/1; border: 1px solid var(--line); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.impact-card { background: var(--eco-50); border: 1px solid var(--eco-200); border-radius: var(--radius); padding: 1rem 1.1rem; }
.qty-input { display: inline-flex; align-items: center; border: 1px solid #d5ddd6; border-radius: 999px; background: #fff; overflow: hidden; }
.qty-input button { border: 0; background: transparent; width: 38px; height: 40px; font-size: 1.1rem; color: var(--eco-800); }
.qty-input button:hover { background: var(--eco-50); }
.qty-input input { width: 46px; border: 0; text-align: center; font-weight: 600; background: transparent; -moz-appearance: textfield; }
.qty-input input::-webkit-outer-spin-button, .qty-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.spec-list li { display: flex; gap: .6rem; padding: .35rem 0; }
.spec-list i { color: var(--eco-600); }

/* ---------- Cart / checkout ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; background: var(--sand-100); }
.summary-row { display: flex; justify-content: space-between; padding: .3rem 0; }
.summary-total { border-top: 2px dashed var(--line); margin-top: .5rem; padding-top: .8rem; font-size: 1.15rem; font-weight: 700; color: var(--eco-900); }
.steps { display: flex; gap: .5rem; align-items: center; font-size: .85rem; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: .4rem; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: .78rem; }
.steps .step.active { color: var(--eco-800); }
.steps .step.active .dot, .steps .step.done .dot { background: var(--eco-700); color: #fff; }
.steps .bar { width: 28px; height: 2px; background: var(--line); }
.zone-option { display: block; border: 2px solid var(--line); border-radius: 14px; padding: .8rem 1rem; cursor: pointer; transition: border-color .15s, background .15s; background: #fff; }
.zone-option:hover { border-color: var(--eco-200); }
.zone-option:has(input:checked) { border-color: var(--eco-600); background: var(--eco-50); }
.zone-option input { accent-color: var(--eco-700); }

.pay-card { max-width: 560px; margin-inline: auto; }
.mpesa-logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; color: #3f9a32; font-size: 1.1rem; }
.pulse-ring { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--eco-100); color: var(--eco-700); font-size: 2.2rem; position: relative; }
.pulse-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--eco-500); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.success-check { width: 88px; height: 88px; border-radius: 50%; background: var(--eco-700); color: #fff; display: grid; place-items: center; font-size: 2.6rem; margin: 0 auto; box-shadow: 0 0 0 10px var(--eco-100); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 70vh; display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: clamp(1.4rem, 4vw, 2.2rem); box-shadow: var(--shadow-md); }

/* ---------- Footer ---------- */
.site-footer { background: var(--eco-900); color: #cfe0d5; }
.site-footer a { color: #cfe0d5; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer h6 { color: #fff; font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.pay-pill { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.1); border-radius: 99px; padding: .3rem .75rem; font-size: .82rem; color: #fff; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; z-index: 2000; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: calc(100vw - 2rem); }
.eco-toast { background: var(--eco-900); color: #fff; padding: .75rem 1rem; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; gap: .6rem; align-items: center; font-size: .92rem; animation: toast-in .25s ease; }
.eco-toast.error { background: #8f2d3b; }
.eco-toast i { font-size: 1.1rem; }
.eco-toast a { color: var(--sand-300); font-weight: 600; margin-left: .25rem; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state i { font-size: 3rem; color: var(--eco-500); }

/* ---------- Admin ---------- */
.admin-body { background: #f1f4f1; }
.admin-side { width: 250px; background: var(--eco-900); color: #cfe0d5; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; flex: 0 0 250px; }
.admin-side .nav-link { color: #cfe0d5; border-radius: 10px; padding: .6rem .85rem; display: flex; align-items: center; gap: .65rem; font-weight: 500; }
.admin-side .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-side .nav-link.active { background: var(--eco-600); color: #fff; }
.admin-main { flex: 1; min-width: 0; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.1rem 1.2rem; border: 1px solid var(--line); height: 100%; }
.stat-card .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--eco-100); color: var(--eco-700); font-size: 1.2rem; }
.stat-card .num { font-family: var(--font-display); font-size: 1.7rem; color: var(--eco-900); line-height: 1.1; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bar-chart .bar { width: 100%; background: linear-gradient(180deg, var(--eco-500), var(--eco-700)); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bar-chart small { font-size: .6rem; color: var(--muted); white-space: nowrap; }
.table > :not(caption) > * > * { padding: .75rem .9rem; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; border-bottom-width: 1px; background: #fafbfa; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: var(--sand-100); }

@media (max-width: 991.98px) {
    .admin-side { position: fixed; left: -260px; top: 0; z-index: 1045; transition: left .25s; }
    .admin-side.open { left: 0; box-shadow: var(--shadow-lg); }
    .hero-art { max-width: 320px; margin-top: 1.5rem; }
}
@media (max-width: 575.98px) {
    .cart-line { grid-template-columns: 70px 1fr; }
    .cart-line .line-total { grid-column: 2; }
    .cart-line img { width: 70px; height: 70px; }
    .p-body { padding: .7rem .75rem .85rem; }
    .btn-add span { display: none; }
    .hero-art .chip { font-size: .7rem; padding: .4rem .6rem; }
}


/* ======================================================================
   Responsive tables — no horizontal scrolling.
   Wide screens: normal table. Small screens: every row becomes a card and
   each cell shows its own label (data-label). Class .table-stack-lg stacks
   below 992px (admin, because of the sidebar); .table-stack below 768px.
   ====================================================================== */
.table { width: 100%; table-layout: auto; --bs-table-bg: transparent; }
.table td, .table th { overflow-wrap: anywhere; word-break: normal; }
.table td > .d-flex { min-width: 0; }

/* Clickable (sortable) headers */
.table thead th.sort-th { padding: 0; }
.sort-th a, .table thead th[data-sort] { display: flex; align-items: center; gap: .35rem; padding: .75rem .9rem; color: inherit; text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap; }
.table thead th[data-sort] { display: table-cell; }
.sort-th a:hover, .table thead th[data-sort]:hover { color: var(--eco-800); background: var(--eco-50); }
.sort-th i, .sort-th.active { color: var(--eco-800); background: var(--eco-50); }
.sort-th.active i { opacity: 1; color: var(--eco-700); }
.table thead th[data-sort][aria-sort="ascending"], .table thead th[data-sort][aria-sort="descending"] { color: var(--eco-800); background: var(--eco-50); }
.table thead th.text-end a { justify-content: flex-end; }

/* Mobile sort control (replaces the hidden table header) */
.sort-bar { display: none; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.sort-bar select { flex: 1 1 auto; min-width: 0; }

@media (max-width: 991.98px) {
    .sort-bar-lg { display: flex; }

    /* .table-stack-lg: stacked "card" layout */
    .table-stack-lg { display:block; width:100%; }
    .table-stack-lg > thead { display:none; }
    .table-stack-lg > tbody { display:block; width:100%; padding:.6rem; }
    .table-stack-lg > tbody > tr { display:block; background:#fff; border:1px solid var(--line); border-radius:12px; margin-bottom:.6rem; padding:.35rem .9rem; box-shadow:var(--shadow-sm); }
    .table-stack-lg > tbody > tr:last-child { margin-bottom:0; }
    .table-stack-lg > tbody > tr > td { display:flex; justify-content:space-between; align-items:center; gap:1rem; width:100%; padding:.45rem 0; border:0; text-align:right; background:transparent; box-shadow:none; }
    .table-stack-lg > tbody > tr > td + td { border-top:1px dashed var(--line); }
    .table-stack-lg > tbody > tr > td::before { content:attr(data-label); flex:0 0 34%; max-width:42%; text-align:left; font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; font-weight:700; color:var(--muted); }
    .table-stack-lg > tbody > tr > td:not([data-label])::before, .table-stack-lg > tbody > tr > td[data-label=""]::before { display:none; }
    .table-stack-lg > tbody > tr > td.cell-primary { justify-content:flex-start; text-align:left; font-size:1.02rem; }
    .table-stack-lg > tbody > tr > td.cell-actions { justify-content:flex-end; flex-wrap:wrap; }
    .table-stack-lg > tbody > tr > td.cell-wide { display:block; text-align:left; }
    .table-stack-lg > tbody > tr > td.cell-wide::before { display:block; max-width:none; margin-bottom:.15rem; }
    .table-stack-lg > tbody > tr > td[colspan] { justify-content:center; text-align:center; }
}

@media (max-width: 767.98px) {
    .sort-bar-md { display: flex; }

    /* .table-stack: stacked "card" layout */
    .table-stack { display:block; width:100%; }
    .table-stack > thead { display:none; }
    .table-stack > tbody { display:block; width:100%; padding:.6rem; }
    .table-stack > tbody > tr { display:block; background:#fff; border:1px solid var(--line); border-radius:12px; margin-bottom:.6rem; padding:.35rem .9rem; box-shadow:var(--shadow-sm); }
    .table-stack > tbody > tr:last-child { margin-bottom:0; }
    .table-stack > tbody > tr > td { display:flex; justify-content:space-between; align-items:center; gap:1rem; width:100%; padding:.45rem 0; border:0; text-align:right; background:transparent; box-shadow:none; }
    .table-stack > tbody > tr > td + td { border-top:1px dashed var(--line); }
    .table-stack > tbody > tr > td::before { content:attr(data-label); flex:0 0 34%; max-width:42%; text-align:left; font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; font-weight:700; color:var(--muted); }
    .table-stack > tbody > tr > td:not([data-label])::before, .table-stack > tbody > tr > td[data-label=""]::before { display:none; }
    .table-stack > tbody > tr > td.cell-primary { justify-content:flex-start; text-align:left; font-size:1.02rem; }
    .table-stack > tbody > tr > td.cell-actions { justify-content:flex-end; flex-wrap:wrap; }
    .table-stack > tbody > tr > td.cell-wide { display:block; text-align:left; }
    .table-stack > tbody > tr > td.cell-wide::before { display:block; max-width:none; margin-bottom:.15rem; }
    .table-stack > tbody > tr > td[colspan] { justify-content:center; text-align:center; }
}

/* Settings page */
.settings-tabs .nav-link { border-radius: 999px; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.settings-tabs .nav-link.active { background: var(--eco-700); color: #fff; border-color: var(--eco-700); }
.settings-tabs { gap: .5rem; flex-wrap: wrap; }
.secret-set { color: var(--eco-700); font-size: .78rem; font-weight: 600; }
.check-row { display: flex; gap: .75rem; align-items: flex-start; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row i { font-size: 1.15rem; margin-top: .1rem; }
.pw-reveal { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: .06em; background: #fff; border: 2px dashed var(--eco-600); border-radius: 12px; padding: .6rem 1rem; word-break: break-all; }
