/* RP55 Shopify App — Dark Admin UI */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --brand: #00a882;
    --brand-hover: #00c49a;
    --brand-dark: #7ef0d4;
    --brand-subtle: rgba(0, 168, 130, 0.14);
    --brand-ring: rgba(0, 200, 154, 0.22);

    --accent-blue: #5b9cf5;
    --accent-purple: #8b93f0;
    --accent-orange: #f5a623;

    --bg: #0d0f14;
    --bg-elevated: #12151c;
    --surface: #181c26;
    --surface-raised: #1f2430;
    --surface-hover: #252b38;
    --sidebar-bg: #10131a;
    --sidebar-border: #252a36;

    --text: #eef0f4;
    --text-secondary: #a8b0bd;
    --text-muted: #727b8a;
    --border: #2a3040;
    --border-strong: #3a4254;

    --success: #00c49a;
    --success-bg: rgba(0, 196, 154, 0.12);
    --warning: #f5a623;
    --warning-bg: rgba(245, 166, 35, 0.12);
    --danger: #ff6b5a;
    --danger-bg: rgba(255, 107, 90, 0.12);
    --info: #5b9cf5;
    --info-bg: rgba(91, 156, 245, 0.12);

    --shadow-xs: 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-w: 268px;
    --transition: 0.18s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; color-scheme: dark; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    font-size: 14px;
}

a { color: var(--brand-dark); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-hover); }

/* ─── App Shell ─── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0a0c12 100%);
    border-right: 1px solid var(--sidebar-border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 10px 20px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-brand-text {
    min-width: 0;
    flex: 1;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(145deg, var(--brand) 0%, #95bf47 100%);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 168, 130, 0.4);
}

.sidebar-brand-icon svg { width: 22px; height: 22px; }

.sidebar-brand h1 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.sidebar-nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 12px 12px 8px;
}

.sidebar-nav { flex: 1; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 2px;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    background: var(--surface-raised);
    color: var(--text);
    text-decoration: none;
}

.nav-link.active {
    background: var(--brand-subtle);
    color: var(--brand-dark);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--brand);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(0, 168, 130, 0.6);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link.active .nav-icon { opacity: 1; color: var(--brand-dark); }
.nav-link:hover .nav-icon { opacity: 1; }
.nav-icon svg { width: 18px; height: 18px; }

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.sidebar-store {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-store-avatar {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--brand-subtle);
    color: var(--brand-dark);
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(0, 168, 130, 0.25);
}

.sidebar-store-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    word-break: break-all;
}

.sidebar-store-domain {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-meta-row:last-child { margin-bottom: 0; }

.sidebar-meta-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
}

.sidebar-mode-live {
    background: var(--success-bg);
    color: #7ef0d4;
    border: 1px solid rgba(0, 196, 154, 0.35);
}

.sidebar-mode-test {
    background: var(--warning-bg);
    color: #ffc96b;
    border: 1px solid rgba(245, 166, 35, 0.35);
}

.sidebar-prefix {
    background: var(--bg-elevated);
    color: #8ef0d9;
    border: 1px solid var(--border-strong);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Mode switch (Live / Test) */
.mode-switch {
    display: flex;
    width: 100%;
    padding: 3px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    gap: 3px;
}

.mode-switch-form {
    flex: 1;
    margin: 0;
}

.mode-switch-btn {
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all var(--transition);
}

.mode-switch-btn:hover:not(.is-active) {
    color: var(--text);
    background: var(--surface-raised);
}

.mode-switch-btn.is-active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 168, 130, 0.35);
    cursor: default;
}

.mode-switch-btn.is-active[aria-current] {
    pointer-events: none;
}

.mode-switch--test-active .mode-switch-btn.is-active {
    background: var(--warning);
    box-shadow: 0 2px 10px rgba(245, 166, 35, 0.35);
    color: #1a1c1d;
}

.mode-switch-form.is-switching .mode-switch-btn {
    opacity: 0.55;
    pointer-events: none;
}

/* Global page loader */
html.app-loading {
    overflow: hidden;
}

html.app-loading .app-global-loader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-global-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 15, 20, 0.72);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.app-global-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    padding: 28px 32px;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.app-global-loader-text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.app-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: app-spin 0.65s linear infinite;
}

@keyframes app-spin {
    to { transform: rotate(360deg); }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.data-table--compact th,
.data-table--compact td {
    padding: 10px 12px;
    font-size: 13px;
}

.data-table--compact code.cell-mono {
    font-size: 12px;
}

/* ─── Main Area ─── */
.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.topbar-left { min-width: 0; }

.topbar-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.content {
    padding: 28px 32px 56px;
    max-width: 1440px;
    width: 100%;
}

/* ─── Badges & Pills ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.badge-live { background: rgba(139, 147, 240, 0.15); color: #b8bef5; border-color: rgba(139, 147, 240, 0.35); }
.badge-test { background: var(--success-bg); color: #7ef0d4; border-color: rgba(0, 196, 154, 0.3); }
.badge-success { background: var(--success-bg); color: #7ef0d4; }
.badge-warning { background: var(--warning-bg); color: #ffc96b; }
.badge-danger { background: var(--danger-bg); color: #ff9a8f; }
.badge-info { background: var(--info-bg); color: #9cc4ff; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: capitalize;
    white-space: nowrap;
    border: 1px solid transparent;
}

.pill-success { background: var(--success-bg); color: #7ef0d4; border-color: rgba(0, 196, 154, 0.25); }
.pill-warning { background: var(--warning-bg); color: #ffc96b; border-color: rgba(245, 166, 35, 0.25); }
.pill-danger { background: var(--danger-bg); color: #ff9a8f; border-color: rgba(255, 107, 90, 0.25); }
.pill-info { background: var(--info-bg); color: #9cc4ff; border-color: rgba(91, 156, 245, 0.25); }
.pill-neutral { background: var(--surface-raised); color: var(--text-secondary); border-color: var(--border); }

/* ─── Stat Cards ─── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 20px 18px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, var(--brand));
    box-shadow: 0 0 12px var(--stat-accent, var(--brand));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.stat-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stat-icon-bg, var(--brand-subtle));
    color: var(--stat-accent, var(--brand-dark));
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-card-icon svg { width: 20px; height: 20px; }

.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text);
}

.stat-card-sub {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

.stat-card--green { --stat-accent: var(--brand); --stat-icon-bg: var(--brand-subtle); }
.stat-card--blue { --stat-accent: var(--accent-blue); --stat-icon-bg: var(--info-bg); }
.stat-card--purple { --stat-accent: var(--accent-purple); --stat-icon-bg: rgba(139, 147, 240, 0.12); }
.stat-card--orange { --stat-accent: var(--accent-orange); --stat-icon-bg: var(--warning-bg); }

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.card-title svg { width: 18px; height: 18px; color: var(--text-muted); }

/* ─── Page Toolbar ─── */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.page-toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ─── Quick Actions ─── */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.quick-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.quick-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 168, 130, 0.2);
    transform: translateY(-1px);
    color: var(--text);
    text-decoration: none;
    background: var(--surface-raised);
}

.quick-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-card-icon svg { width: 22px; height: 22px; }

.quick-card-icon--green { background: var(--brand-subtle); color: var(--brand-dark); }
.quick-card-icon--blue { background: var(--info-bg); color: var(--accent-blue); }
.quick-card-icon--purple { background: rgba(139, 147, 240, 0.12); color: var(--accent-purple); }
.quick-card-icon--orange { background: var(--warning-bg); color: var(--accent-orange); }

.quick-card-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.quick-card-text span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Status Grid ─── */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.status-tile {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.status-tile-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.status-tile-dot--ok { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring), 0 0 10px rgba(0, 168, 130, 0.5); }
.status-tile-dot--warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2); }
.status-tile-dot--error { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.2); }

.status-tile-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.status-tile-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.status-tile-desc code {
    color: #8ef0d9;
    background: var(--bg-elevated);
    border-color: var(--border);
}

/* ─── Alerts ─── */
.alert {
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
    border: 1px solid;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.alert-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-icon-wrap svg { width: 18px; height: 18px; }

.alert-body h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.alert-body p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.alert-body p code { color: #8ef0d9; background: rgba(0, 0, 0, 0.25); border-color: var(--border); }
.alert-body p + p { margin-top: 6px; }

.alert-success { background: var(--success-bg); border-color: rgba(0, 196, 154, 0.25); }
.alert-success .alert-icon-wrap { background: rgba(0, 196, 154, 0.18); color: #7ef0d4; }

.alert-warning { background: var(--warning-bg); border-color: rgba(245, 166, 35, 0.25); }
.alert-warning .alert-icon-wrap { background: rgba(245, 166, 35, 0.18); color: #ffc96b; }

.alert-danger { background: var(--danger-bg); border-color: rgba(255, 107, 90, 0.25); }
.alert-danger .alert-icon-wrap { background: rgba(255, 107, 90, 0.18); color: #ff9a8f; }

.alert-info { background: var(--info-bg); border-color: rgba(91, 156, 245, 0.25); }
.alert-info .alert-icon-wrap { background: rgba(91, 156, 245, 0.18); color: #9cc4ff; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 168, 130, 0.35);
}

.btn-primary:hover {
    background: var(--brand-hover);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 196, 154, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-raised);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-danger {
    background: rgba(255, 107, 90, 0.15);
    color: #ff9a8f;
    border-color: rgba(255, 107, 90, 0.45);
}

.btn-danger:hover {
    background: rgba(255, 107, 90, 0.28);
    color: #ffb8b0;
    border-color: #ff6b5a;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover { background: var(--surface-raised); color: var(--text); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-group--flush { margin-top: 0; }

.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-pill {
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.filter-pill:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    text-decoration: none;
    background: var(--brand-subtle);
}

.filter-pill.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 168, 130, 0.35);
}

/* ─── Code ─── */
code, .code-block {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12.5px;
    color: #8ef0d9;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 5px;
    word-break: break-all;
}

.sidebar code.sidebar-prefix {
    color: #8ef0d9;
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.code-block {
    display: block;
    padding: 14px 16px;
    margin: 10px 0;
}

/* ─── Tables ─── */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
    box-shadow: var(--shadow-sm);
}

.table-wrap--wide {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.data-table--products { min-width: 960px; }
.data-table--orders { min-width: 1040px; }

.data-table th {
    background: var(--bg-elevated);
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    white-space: nowrap;
    z-index: 1;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
    overflow: hidden;
}

.data-table .col-num { width: 44px; text-align: center; }
.data-table .col-img { width: 68px; }
.data-table .col-product { width: 22%; min-width: 180px; }
.data-table .col-status { width: 96px; }
.data-table .col-vendor { width: 90px; }
.data-table .col-type { width: 100px; }
.data-table .col-variants { width: 108px; text-align: center; }
.data-table .col-price { width: 110px; white-space: nowrap; }
.data-table .col-date { width: 104px; white-space: nowrap; }
.data-table .col-order { width: 120px; }
.data-table .col-customer { width: 18%; min-width: 160px; }
.data-table .col-items { width: 64px; text-align: center; }
.data-table .col-total { width: 110px; white-space: nowrap; }
.data-table .col-tags { width: 14%; min-width: 120px; }

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr.data-row-clickable { cursor: pointer; }
.data-table tbody tr.data-row-clickable:hover { background: var(--surface-raised); }
.data-table tbody tr.data-row-clickable.is-expanded {
    background: var(--brand-subtle);
    box-shadow: inset 3px 0 0 var(--brand);
}
.data-table tbody tr.data-row-expand { display: none; }
.data-table tbody tr.data-row-expand.is-open { display: table-row; }
.data-table tbody tr.data-row-expand td {
    padding: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table td strong { font-weight: 700; }
.data-table td small { color: var(--text-muted); font-size: 11.5px; display: block; margin-top: 3px; }

.cell-meta {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.cell-mono {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11.5px;
    color: #8ef0d9;
    white-space: nowrap;
    word-break: normal;
}

.cell-title {
    display: block;
    font-weight: 700;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-tags {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-secondary);
}

.expand-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    color: var(--brand-dark);
    white-space: nowrap;
}

.data-row-clickable.is-expanded .expand-badge {
    background: rgba(0, 168, 130, 0.2);
    border-color: rgba(0, 168, 130, 0.35);
    color: #7ef0d4;
}

.expand-panel {
    padding: 16px 18px 18px;
    border-top: 1px dashed var(--border);
}

.expand-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.expand-panel-head strong {
    font-size: 13px;
    color: var(--text);
}

.expand-panel-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.expand-panel-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}

.sub-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 720px;
}

.sub-table th {
    background: var(--bg-elevated);
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.sub-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text);
}

.sub-table tbody tr:last-child td { border-bottom: none; }
.sub-table tbody tr:hover { background: var(--surface-raised); }
.sub-table .col-num { width: 40px; text-align: center; white-space: nowrap; }
.sub-table .col-sku { min-width: 140px; max-width: 220px; }
.sub-table .col-sku .cell-mono { white-space: normal; word-break: break-all; }
.sub-table .col-price { white-space: nowrap; width: 90px; }
.sub-table .col-mono { font-family: 'Consolas', monospace; font-size: 11.5px; color: var(--text-secondary); }

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.pagination-summary {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-summary strong {
    color: var(--text);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-status {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    padding: 0 6px;
    white-space: nowrap;
}

.pagination-btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

.product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}

.product-thumb--empty {
    display: block;
    background: var(--bg-elevated);
}

.data-table td code {
    font-size: 11.5px;
    color: #8ef0d9;
    background: var(--bg-elevated);
}

.status-active, .status-paid, .status-fulfilled { color: #7ef0d4; font-weight: 700; }
.status-draft, .status-pending, .status-unfulfilled, .status-partial, .status-open { color: var(--text-secondary); font-weight: 700; }
.status-archived, .status-refunded, .status-voided, .status-closed { color: #ffc96b; font-weight: 700; }
.status-cancelled, .status-void, .status-expired { color: #ff9a8f; font-weight: 700; }
.status-authorized, .status-partially-paid, .status-partially-refunded { color: #9cc4ff; font-weight: 700; }

/* ─── Info List ─── */
.info-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), background var(--transition);
}

.info-item:hover {
    border-color: var(--border-strong);
    background: var(--surface-raised);
}

.info-item-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.info-item-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}

/* ─── Logs ─── */
.log-viewer {
    background: #0a0c10;
    color: #d4d8e0;
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.75;
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4);
}

.log-line-error { color: #ff8fa3; }
.log-line-warning { color: #ffc285; }
.log-line-info { color: #9cc4ff; }
.log-line-debug { color: #8b93a8; }

/* ─── Forms ─── */
.form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.form-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row select,
.form-row input[type="date"] {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-row select option {
    background: var(--surface);
    color: var(--text);
}

.form-row select:focus,
.form-row input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 56px 32px;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state-icon svg { width: 28px; height: 28px; }

.empty-state p {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ─── Standalone Pages ─── */
.page-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 168, 130, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 147, 240, 0.1) 0%, transparent 45%),
        linear-gradient(160deg, #0d0f14 0%, #10131a 50%, #0a0c12 100%);
}

.page-standalone .card {
    max-width: 640px;
    width: 100%;
    margin: 0;
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.page-standalone .sidebar-brand {
    padding: 0 0 20px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.page-standalone .sidebar-brand h1 { color: var(--text); }
.page-standalone .sidebar-brand small { color: var(--text-muted); }

ol.steps { padding-left: 20px; }
ol.steps li { margin-bottom: 10px; font-size: 14px; color: var(--text-secondary); }
ol.steps a { color: var(--brand-dark); }

/* ─── Scrollbar (dark) ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─── */
@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .sidebar-nav-label { grid-column: 1 / -1; }
    .content { padding: 20px 16px 40px; }
    .topbar { padding: 14px 16px; }
}
