/* =====================================================================
   Tally — Global Stylesheet
   Design tokens + reusable components shared across the whole portal.
   Page-specific styles (dashboard tables, product grid, etc.) should be
   added in their own files and import these tokens, not redefine them.

   Dark theme only. The --surf and --shadow tokens below exist because
   dozens of components used a literal rgba(255,255,255,0.0X) "raise the
   surface slightly" tint scattered throughout the file — naming them as
   tokens is just organization, the values are identical to before.
   ===================================================================== */

/* ---------- Design tokens (dark — default) ---------- */
:root {
    --bg-950: #0d0b14;
    --bg-900: #14111d;

    --card-border: var(--surf-08);
    --card-bg: var(--surf-045);

    --violet: #8b7fe6;
    --teal: #4fd1c5;
    --gold: #d4af6a;
    --danger: #e6879a;
    --danger-bg: rgba(224, 108, 117, 0.1);
    --danger-border: rgba(224, 108, 117, 0.32);

    --text-primary: #f2f0f7;
    --text-muted: #9691ab;
    --text-faint: #625c78;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --radius-lg: 20px;
    --radius-md: 10px;

    /* "Surface" tints — a subtle white-based raise above the dark
       background, used throughout for input fields, hover states,
       borders, etc. Light mode inverts these to black-based tints
       (see the override block below) rather than components each
       needing their own light/dark variant. */
    --surf-018: rgba(255, 255, 255, 0.018);
    --surf-02: rgba(255, 255, 255, 0.02);
    --surf-025: rgba(255, 255, 255, 0.025);
    --surf-03: rgba(255, 255, 255, 0.03);
    --surf-035: rgba(255, 255, 255, 0.035);
    --surf-04: rgba(255, 255, 255, 0.04);
    --surf-045: rgba(255, 255, 255, 0.045);
    --surf-05: rgba(255, 255, 255, 0.05);
    --surf-055: rgba(255, 255, 255, 0.055);
    --surf-06: rgba(255, 255, 255, 0.06);
    --surf-07: rgba(255, 255, 255, 0.07);
    --surf-08: rgba(255, 255, 255, 0.08);
    --surf-09: rgba(255, 255, 255, 0.09);
    --surf-16: rgba(255, 255, 255, 0.16);

    /* Shadow tints — stay black in both themes (conventional), just
       softer in light mode so elevation doesn't look like a dark-mode
       glow transplanted onto a bright UI. */
    --shadow-1: rgba(0, 0, 0, 0.35);
    --shadow-2: rgba(0, 0, 0, 0.55);
    --shadow-3: rgba(0, 0, 0, 0.6);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg-950);
    color: var(--text-primary);
    font-family: var(--font-body);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    margin: 0;
}

a { color: inherit; }

/* ---------- Page shell: centers a single card, used by auth pages ---------- */
.page-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 24px;
}

/* ---------- Living gradient mesh background (opt-in per page) ---------- */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.mesh-bg .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    mix-blend-mode: screen;
    opacity: 0.55;
    will-change: transform;
}

.mesh-bg .blob-a {
    width: 560px; height: 560px;
    top: -160px; left: -120px;
    background: radial-gradient(circle, var(--violet), transparent 70%);
    animation: drift-a 22s ease-in-out infinite;
}

.mesh-bg .blob-b {
    width: 620px; height: 620px;
    bottom: -220px; right: -160px;
    background: radial-gradient(circle, var(--teal), transparent 70%);
    animation: drift-b 26s ease-in-out infinite;
}

.mesh-bg .blob-c {
    width: 420px; height: 420px;
    top: 40%; left: 55%;
    background: radial-gradient(circle, #5b6ee6, transparent 70%);
    opacity: 0.35;
    animation: drift-c 30s ease-in-out infinite;
}

@keyframes drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(60px, 80px) scale(1.12); }
}
@keyframes drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-70px, -50px) scale(1.08); }
}
@keyframes drift-c {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-60%, -40%) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .mesh-bg .blob-a, .mesh-bg .blob-b, .mesh-bg .blob-c { animation: none; }
}

.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Card: reusable glass panel (auth card, modals, side panels) ---------- */
.card {
    position: relative;
    z-index: 2;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow:
        0 30px 60px -20px var(--shadow-2),
        0 0 0 1px var(--surf-02) inset;
}

.card--auth {
    width: 100%;
    max-width: 400px;
    padding: 44px 40px 36px;
    animation: card-in 0.7s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
    .card--auth { padding: 36px 24px 30px; border-radius: 16px; }
}

/* ---------- Login logo ---------- */
.login-logo {
    margin-bottom: 30px;
    padding: 18px 22px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    opacity: 0;
    animation: fade-up 0.6s 0.1s ease forwards;
}
.login-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 260px;
    margin: 0 auto;
}

/* ---------- Fade-up entrance utility (stagger with inline delay or fN classes) ---------- */
.fade-up {
    opacity: 0;
    animation: fade-up 0.6s ease forwards;
}
.fade-up.f1 { animation-delay: 0.35s; }
.fade-up.f2 { animation-delay: 0.42s; }
.fade-up.f3 { animation-delay: 0.48s; }
.fade-up.f4 { animation-delay: 0.54s; }
.fade-up.f5 { animation-delay: 0.60s; }
.fade-up.f6 { animation-delay: 0.66s; }
.fade-up.f7 { animation-delay: 0.70s; }
.fade-up.f8 { animation-delay: 0.74s; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Typography helpers ---------- */
.heading {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 8px;
}

.sub {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 30px;
    line-height: 1.55;
}

/* ---------- Form elements (reusable everywhere: auth, product forms, settings) ---------- */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--surf-03);
    border: 1px solid var(--surf-09);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14.5px;
    font-family: var(--font-body);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input.font-mono {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* The OPEN dropdown list for <select> is rendered by the OS/browser, not
   by our CSS — it ignores our dark background and just shows white. Our
   --text-primary is near-white too, so options were invisible against
   that white popup. Force dark text (and a light row background) on the
   options specifically so they stay readable, even though the popup
   itself can't be fully dark-themed in Chromium-based browsers. */
.field select option,
.role-select-form select option,
.filter-select option,
.access-row select option {
    color: #1a1a22;
    background: #ffffff;
}

.field input::placeholder { color: var(--text-faint); }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--violet);
    background: var(--surf-055);
    box-shadow: 0 0 0 4px rgba(139, 127, 230, 0.16);
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.checkbox-label input {
    width: 15px;
    height: 15px;
    accent-color: var(--violet);
}

.link-accent {
    font-size: 13px;
    color: var(--teal);
    text-decoration: none;
}
.link-accent:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
    width: 100%;
    padding: 13px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-position 0.5s ease, transform 0.05s ease, opacity 0.15s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.btn-primary {
    color: #0d0b14;
    background: linear-gradient(100deg, var(--teal), var(--violet) 65%, var(--teal));
    background-size: 220% 100%;
    background-position: 0% 0%;
}
.btn-primary:hover { background-position: 100% 0%; }

.btn-ghost {
    color: var(--text-primary);
    background: var(--surf-04);
    border: 1px solid var(--card-border);
}
.btn-ghost:hover { background: var(--surf-07); }

/* ---------- Misc ---------- */
.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0 20px;
    color: var(--text-faint);
    font-size: 12px;
}
.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--surf-08);
}

.form-foot {
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
}

.error-box {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    font-size: 13px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
}

/* =====================================================================
   Interior app shell (sidebar + content) — dashboard, admin, etc.
   Distinct from the auth pages: no mesh/blob background here, this is
   data-dense functional UI, so it stays quiet and gets out of the way.
   ===================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 252px;
    flex-shrink: 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(139, 127, 230, 0.06), transparent 55%),
        var(--bg-900);
    border-right: 1px solid var(--card-border);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ---------- Brand lockup ---------- */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 10px 10px 8px;
    margin-bottom: 26px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    background: var(--surf-025);
}

.brand-mark-box {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-shadow: 0 4px 14px -4px var(--shadow-1);
}
.brand-mark-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-text { min-width: 0; }
.brand-text .line1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.25;
    color: var(--text-primary);
    white-space: nowrap;
}
.brand-text .line2 {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* ---------- Nav ---------- */
.nav-section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 0 10px;
    margin: 18px 0 8px;
}
.nav-section-label:first-of-type { margin-top: 4px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px 9px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a svg {
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.15s ease;
}

.sidebar-nav a:hover {
    background: var(--surf-045);
    color: var(--text-primary);
}
.sidebar-nav a:hover svg { opacity: 1; }

.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(139, 127, 230, 0.16), rgba(79, 209, 197, 0.05));
    color: var(--text-primary);
}
.sidebar-nav a.active svg { opacity: 1; color: var(--violet); }

.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--teal), var(--violet));
}

/* ---------- Profile card ---------- */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    background: var(--surf-03);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--teal), var(--violet));
    color: #0d0b14;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user .who { min-width: 0; flex: 1; }

.sidebar-user .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.sidebar-user form { margin-top: 10px; }

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--card-border);
    border-radius: 0;
    color: var(--text-faint);
    font-size: 12.5px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: color 0.15s ease;
}
.btn-logout:hover { color: var(--danger); }

.content {
    flex: 1;
    min-width: 0;
    padding: 40px 44px;
}

.content-header { margin-bottom: 28px; }
.content-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
}
.content-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 14px 18px; }
    .sidebar-nav { flex-direction: row; }
    .sidebar-user { display: none; }
    .content { padding: 24px 20px; }
}

/* ---------- Role badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-admin { color: var(--violet); background: rgba(139, 127, 230, 0.14); }
.badge-accounts { color: var(--gold); background: rgba(212, 175, 106, 0.14); }
.badge-user { color: var(--text-muted); background: var(--surf-05); }

/* ---------- Status banners ---------- */
.status-banner {
    background: rgba(95, 217, 164, 0.1);
    border: 1px solid rgba(95, 217, 164, 0.32);
    color: var(--mint);
    font-size: 13.5px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
}

.price-sync-banner ul {
    margin: 8px 0 0;
    padding-left: 20px;
}
.price-sync-banner li {
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 3px;
}
.price-sync-banner li.price-sync-line-failed {
    color: var(--danger);
}

/* ---------- Data table ---------- */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 30px 8px 12px;
    background: var(--surf-03);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(139, 127, 230, 0.16);
}

.filter-clear {
    font-size: 12.5px;
    color: var(--text-faint);
    text-decoration: none;
    padding: 4px 6px;
}
.filter-clear:hover { color: var(--danger); text-decoration: underline; }

.search-input {
    position: relative;
    width: 280px;
}
.search-input input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    background: var(--surf-03);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: var(--font-body);
}
.search-input input:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(139, 127, 230, 0.16);
}
.search-input svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.count-pill {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-faint);
}

.table-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
}

.data-table tbody td {
    padding: 13px 20px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--surf-04);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surf-018); }

.data-table .emp-id {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 12.5px;
}

.data-table .emp-name { color: var(--text-primary); font-weight: 500; }
.data-table .emp-dept { color: var(--text-muted); }

.role-select-form select {
    padding: 7px 30px 7px 10px;
    background: var(--surf-03);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
}
.role-select-form select:focus {
    outline: none;
    border-color: var(--violet);
}
.role-select-form select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- Pagination ---------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--card-border);
}

.pagination-info {
    font-size: 12.5px;
    color: var(--text-faint);
    font-family: var(--font-mono);
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12.5px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.pagination-links a:hover {
    background: var(--surf-05);
    color: var(--text-primary);
}

.pagination-links .current {
    background: rgba(139, 127, 230, 0.16);
    color: var(--text-primary);
    font-weight: 600;
}

.pagination-links .disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-links .dots {
    color: var(--text-faint);
}

/* ---------- Attribute access matrix ---------- */
.access-grid {
    display: flex;
    flex-direction: column;
}

.access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 2px;
    border-bottom: 1px solid var(--surf-05);
}
.access-row:last-child { border-bottom: none; }

.access-locked {
    font-size: 12.5px;
    color: var(--text-faint);
    font-style: italic;
}

.dept-name {
    font-size: 13.5px;
    color: var(--text-primary);
}

.access-row select {
    padding: 7px 26px 7px 10px;
    background: var(--surf-03);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
}
.access-row select:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(139, 127, 230, 0.16);
}

.badge-cp {
    color: var(--danger);
    background: rgba(230, 135, 154, 0.12);
}

/* ---------- Product attribute display (show/edit pages) ---------- */
.attr-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--surf-05);
}
.attr-row:last-child { border-bottom: none; }

.attr-label {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 170px;
}

.attr-value {
    font-size: 13.5px;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

/* Long-form text (Short/Long Description, or any textarea-type attribute)
   reads badly squeezed into the right-aligned side-by-side layout every
   other attribute uses — stacks label above value instead, full width,
   left-aligned, with room to actually read a paragraph. */
.attr-row-stacked {
    flex-direction: column;
    align-items: stretch;
}
.attr-row-stacked .attr-value {
    text-align: left;
    white-space: pre-wrap;
    line-height: 1.6;
    margin-top: 6px;
}

.current-file {
    margin-bottom: 6px;
    font-size: 12.5px;
}

.field input[type="file"] {
    padding: 8px 10px;
    color: var(--text-muted);
    cursor: pointer;
}

/* ---------- Product form: full-width multi-column field grid ---------- */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px 28px;
}

.field-grid .field {
    margin-bottom: 18px;
}

/* Multi-line content (Short/Long Description, or any future textarea-type
   attribute) looks cramped squeezed into a single grid column — spans
   every column instead. Type-based, not name-based, so any textarea
   attribute gets this automatically, not just these two specific ones. */
.field-grid .field-full-width {
    grid-column: 1 / -1;
}
.field-grid .field-full-width textarea {
    width: 100%;
}

/* Checkbox fields sit inline (checkbox + label) rather than the
   label-above-input pattern regular fields use — a stacked layout wastes
   height and looks odd for a single tick box. */
.field-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    margin-bottom: 4px;
}

.field-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--violet);
    cursor: pointer;
}

.field-checkbox label {
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

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

/* ---------- Product show page: full-width two-column layout ---------- */
.show-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
    align-items: start;
}

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

.card-heading {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    padding: 16px 0 12px;
    margin: 0;
    border-bottom: 1px solid var(--card-border);
}

/* ---------- History timeline ---------- */
.history-item {
    padding: 13px 0;
    border-bottom: 1px solid var(--surf-05);
}
.history-item:last-child { border-bottom: none; }

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.history-field {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-time {
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.history-change {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.history-old {
    color: var(--text-faint);
    text-decoration: line-through;
    word-break: break-word;
}

.history-arrow {
    color: var(--text-faint);
    flex-shrink: 0;
}

.history-new {
    color: var(--teal);
    font-weight: 500;
    word-break: break-word;
}

.history-by {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ---------- Wide table scroll wrapper (products list has many columns) ---------- */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    min-width: 760px;
}

/* ---------- Product review status badges ---------- */
.badge-open {
    color: var(--gold);
    background: rgba(212, 175, 106, 0.14);
}

.badge-published {
    color: var(--mint);
    background: rgba(95, 217, 164, 0.12);
}

/* ---------- Sidebar nav pending-count badge ---------- */
.nav-count-badge {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(212, 175, 106, 0.18);
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
}

/* ---------- "Changed since last review" highlighting ---------- */
.badge-changed {
    color: var(--gold);
    background: rgba(212, 175, 106, 0.16);
}

.attr-row.attr-changed {
    background: rgba(212, 175, 106, 0.06);
    border-radius: 8px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
}

.field-highlight input,
.field-highlight select {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 106, 0.14) !important;
}

.field-checkbox.field-highlight {
    background: rgba(212, 175, 106, 0.06);
    border-radius: 8px;
    margin: 0 -10px 4px;
    padding-left: 10px;
    padding-right: 10px;
}

/* ---------- Topbar + notification bell ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 18px;
}

.notif-wrapper {
    position: relative;
}

.notif-bell {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--surf-03);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.notif-bell:hover {
    color: var(--text-primary);
    background: var(--surf-06);
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--bg-950);
}

.notif-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-900);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 55px -14px var(--shadow-3);
    z-index: 40;
}
.notif-dropdown.open {
    display: block;
}

.notif-dropdown-head {
    position: sticky;
    top: 0;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    background: var(--bg-900);
    border-bottom: 1px solid var(--card-border);
}

.notif-item {
    display: block;
    padding: 11px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--surf-04);
    transition: background 0.15s ease;
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item:hover {
    background: var(--surf-035);
}

.notif-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-item-meta {
    font-size: 11.5px;
    color: var(--text-faint);
}

.notif-empty {
    padding: 26px 16px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-faint);
}

/* ---------- Notification item change summary ---------- */
.notif-item-changes {
    margin: 3px 0;
    font-size: 11.5px;
    color: var(--gold);
}

/* ---------- Product show page: tabs ---------- */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 6px 20px 0;
    border-bottom: 1px solid var(--card-border);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    padding: 13px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--violet);
}

.tab-count {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-faint);
    background: var(--surf-06);
    padding: 1px 7px;
    border-radius: 999px;
}
.tab-btn.active .tab-count {
    color: var(--violet);
    background: rgba(139, 127, 230, 0.14);
}

.tab-panel {
    padding: 4px 24px 16px;
}

/* ---------- Collapsible history batches ---------- */
.history-batch {
    border-bottom: 1px solid var(--surf-05);
}
.history-batch:last-child { border-bottom: none; }

.history-batch-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: none;
    border: none;
    padding: 13px 4px;
    cursor: pointer;
    text-align: left;
}

.history-batch-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.history-batch-who {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.history-batch-what {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-batch-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.history-batch-chevron {
    color: var(--text-faint);
    transition: transform 0.15s ease;
}
.history-batch-toggle.open .history-batch-chevron {
    transform: rotate(180deg);
}

.history-batch-body {
    display: none;
    padding: 0 4px 14px 4px;
}
.history-batch-body.open {
    display: block;
}

.history-batch-body .history-item {
    padding: 8px 0 8px 16px;
    border-bottom: none;
    border-left: 2px solid var(--card-border);
    margin-left: 2px;
}
.history-batch-body .history-item .history-head { margin-bottom: 3px; }

/* ---------- Price history chart ---------- */
.price-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 12px 4px 16px;
}

.price-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-chart-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.price-chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.price-chart-wrap {
    position: relative;
}

.price-chart-hit {
    cursor: pointer;
}
.price-chart-hit:hover + .price-chart-dot-visible {
    r: 6;
}

.price-chart-tooltip {
    position: absolute;
    display: none;
    min-width: 130px;
    padding: 9px 12px;
    background: var(--bg-900);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    box-shadow: 0 16px 34px -10px var(--shadow-3);
    pointer-events: none;
    z-index: 30;
}
.price-chart-tooltip.visible {
    display: block;
}

.price-chart-tooltip-series {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.price-chart-tooltip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.price-chart-tooltip-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-chart-tooltip-date {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 2px;
}

.price-chart-axis {
    stroke: var(--card-border);
    stroke-width: 1;
}

.price-chart-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: var(--text-faint);
}

/* ---------- Inline quick-edit (CP/SP on the show page) ---------- */
.quick-edit-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quick-edit-display {
    color: var(--text-primary);
}

.quick-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.quick-edit-wrap:hover .quick-edit-btn {
    color: var(--violet);
    background: rgba(139, 127, 230, 0.1);
    border-color: var(--card-border);
}

.quick-edit-input {
    width: 120px;
    padding: 5px 8px;
    background: var(--surf-05);
    border: 1px solid var(--violet);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-mono);
}
.quick-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 127, 230, 0.16);
}

.quick-edit-save,
.quick-edit-cancel {
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
}

.quick-edit-save {
    color: #0d0b14;
    background: var(--teal);
}
.quick-edit-save:hover { background: #63dcd1; }
.quick-edit-save:disabled { opacity: 0.6; cursor: not-allowed; }

.quick-edit-cancel {
    color: var(--text-muted);
    background: var(--surf-05);
}
.quick-edit-cancel:hover { color: var(--text-primary); }
.quick-edit-cancel:disabled { opacity: 0.6; cursor: not-allowed; }

.quick-edit-error {
    font-size: 11.5px;
    color: var(--danger);
}

/* ---------- Dashboard: stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    display: block;
    padding: 20px 20px 18px;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-card:hover {
    border-color: var(--surf-16);
    transform: translateY(-1px);
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.stat-card--gold .stat-icon { color: var(--gold); background: rgba(212, 175, 106, 0.14); }
.stat-card--teal .stat-icon { color: var(--teal); background: rgba(79, 209, 197, 0.14); }
.stat-card--violet .stat-icon { color: var(--violet); background: rgba(139, 127, 230, 0.14); }
.stat-card--danger .stat-icon { color: var(--danger); background: rgba(230, 135, 154, 0.14); }

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.stat-sublabel {
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ---------- Dashboard: activity feed ---------- */
.activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--surf-05);
    text-decoration: none;
    color: inherit;
}
.activity-row:last-child { border-bottom: none; }
.activity-row:hover .activity-text { color: var(--text-primary); }

.activity-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.activity-icon--gold { color: var(--gold); background: rgba(212, 175, 106, 0.14); }
.activity-icon--teal { color: var(--teal); background: rgba(79, 209, 197, 0.14); }
.activity-icon--violet { color: var(--violet); background: rgba(139, 127, 230, 0.14); }

.activity-text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease;
}
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-product { color: var(--text-primary); }

.activity-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
}

/* ---------- Password visibility toggle ---------- */
.input-wrap {
    position: relative;
}
.input-wrap input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.password-toggle:hover {
    color: var(--text-primary);
    background: var(--surf-06);
}
.password-toggle:focus-visible {
    outline: 2px solid var(--violet);
    outline-offset: 1px;
}

/* ---------- Live CP percentage display on price fields ---------- */
.field-percent {
    margin-top: 5px;
    font-size: 11.5px;
    font-family: var(--font-mono);
    min-height: 14px;
}

/* ---------- Category filter (products list / review queue) ---------- */
.category-filter-wrapper {
    position: relative;
}

.category-filter-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--surf-03);
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.category-filter-btn:hover {
    color: var(--text-primary);
    background: var(--surf-06);
}

.category-filter-badge {
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(139, 127, 230, 0.22);
    color: var(--violet);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
}

.category-filter-dropdown {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    background: var(--bg-900);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 55px -14px var(--shadow-3);
    padding: 8px;
    z-index: 40;
}
.category-filter-dropdown.open {
    display: block;
}

.category-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 8px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}
.category-filter-option:hover {
    background: var(--surf-05);
}
.category-filter-option input {
    width: auto;
    margin: 0;
    accent-color: var(--violet);
}

.category-filter-clear {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 8px;
    border: none;
    border-top: 1px solid var(--card-border);
    border-radius: 0 0 7px 7px;
    background: transparent;
    color: var(--text-faint);
    font-size: 12px;
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
}
.category-filter-clear:hover {
    color: var(--text-primary);
}

/* ---------- Show page: grouped attribute cards (modern layout) ---------- */
.attr-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.attr-group-card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: var(--surf-018);
    overflow: hidden;
}

.attr-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--card-border);
}

.attr-group-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.attr-group-icon--identifiers { color: var(--violet); background: rgba(139, 127, 230, 0.14); }
.attr-group-icon--pricing { color: var(--gold); background: rgba(212, 175, 106, 0.14); }
.attr-group-icon--details { color: var(--teal); background: rgba(79, 209, 197, 0.14); }
.attr-group-icon--media { color: var(--violet); background: rgba(139, 127, 230, 0.14); }
.attr-group-icon--status { color: var(--mint); background: rgba(95, 217, 164, 0.12); }
.attr-group-icon--other { color: var(--text-muted); background: var(--surf-06); }

.attr-group-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.attr-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1px;
    background: var(--card-border);
}

.attr-tile {
    background: var(--bg-900);
    padding: 12px 18px;
    min-width: 0;
}
.attr-tile.attr-tile-full {
    grid-column: 1 / -1;
}
.attr-tile.attr-tile-changed {
    background: rgba(212, 175, 106, 0.07);
    box-shadow: inset 2px 0 0 var(--gold);
}

.attr-tile-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-faint);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attr-tile-value {
    font-size: 13.5px;
    color: var(--text-primary);
    word-break: break-word;
}
.attr-tile-value.attr-tile-value-empty {
    color: var(--text-faint);
}
.attr-tile-full .attr-tile-value {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ---------- Product list thumbnails ---------- */
.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    display: block;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.product-thumb:hover {
    transform: scale(1.08);
}
