:root {
    --bg-dark: #0a0e14;
    --bg-subtle: #151921;
    --bg-panel: #1e2531;
    --border: #2d3748;
    --border-active: #a0aec0;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-tertiary: #718096;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    --accent-pink: #f472b6;
    --accent-cyan: #22d3ee;
    --accent-gold: #fbbf24;
    --accent-emerald: #10b981;
    --accent-gray: #9ca3af;
    --sidebar-width: 200px;
    --header-height: 48px;
    --content-max-width: 1000px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    display: flex;
    overflow: hidden;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

a {
    text-decoration: none;
    color: inherit;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-subtle);
    border-right: 1px solid var(--border);
    padding: 18px 10px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.brand {
    margin-bottom: 28px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand h2 {
    font-size: 0.9rem;
    font-weight: 600;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav a:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.06);
}

.nav a:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

.nav a.active {
    background-color: rgba(56, 139, 253, 0.18);
    color: var(--accent-blue);
    font-weight: 600;
    border-left: 2px solid var(--accent-blue);
    padding-left: 10px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.sidebar-footer .status-text {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-align: center;
    display: block;
    padding: 8px 0;
}

main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
}

.top-bar {
    height: var(--header-height);
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: var(--bg-subtle);
    flex-shrink: 0;
}

.page-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-mark {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.system-status {
    font-size: 0.6rem;
    color: var(--accent-green);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    background-color: var(--accent-green);
    border-radius: 50%;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    background-color: var(--bg-dark);
}

.content-wrapper {
    width: 100%;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.metric-card {
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    min-height: 105px;
}

.metric-card:hover {
    border-color: var(--border-active);
}

.metric-card .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 10px;
}

.metric-card .value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.metric-card .sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.metric-card.system {
    border-top: 2px solid var(--accent-cyan);
}

.metric-card.products {
    border-top: 2px solid var(--accent-blue);
}

.metric-card.listings {
    border-top: 2px solid var(--accent-purple);
}

.metric-card.fulfillment {
    border-top: 2px solid var(--accent-orange);
}

.metric-card.orders {
    border-top: 2px solid var(--accent-emerald);
}

.metric-card.gold {
    border-top: 2px solid var(--accent-gold);
}

.placeholder-block {
    height: 200px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    background-color: var(--bg-subtle);
}

/* Empty State - Consistent theme styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.empty-state-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.view-header {
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.view-header .view-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.data-table thead {
    background-color: var(--bg-panel);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.8rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.status-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 4px;
}

.status-tag.active {
    background-color: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.status-tag.draft {
    background-color: rgba(139, 148, 158, 0.15);
    color: var(--text-secondary);
}

.status-tag.error {
    background-color: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pagination button {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--bg-subtle);
    border-color: var(--border-active);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination select {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: auto;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-primary);
}

.btn.primary {
    background: var(--accent-blue);
    border: none;
    color: #fff;
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--border-active);
}

.btn.small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.modal-chapter {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-chapter h3 {
    color: var(--accent-blue);
    margin-bottom: 8px;
}