/* ── ProdvoAdmin - CSS Variables & Theme ─────────────────── */
:root {
    /* Colors - Light */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-sidebar: #f7f7f8;
    --bg-hover: #f0f1f3;
    --bg-input: #ffffff;
    --bg-badge: #f0f1f3;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: #e2e8f0;
    --border-input: #cbd5e1;

    --color-primary: #0f172a;
    --color-primary-hover: #1e293b;
    --color-accent: #3b82f6;
    --color-accent-hover: #2563eb;

    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-success-text: #065f46;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #92400e;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-text: #991b1b;
    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-info-text: #1e40af;
    --color-violet: #8b5cf6;
    --color-orange: #f97316;

    /* Chart colors */
    --chart-1: #0f172a;
    --chart-2: #3b82f6;
    --chart-3: #10b981;
    --chart-4: #f59e0b;
    --chart-5: #ef4444;
    --chart-shopee: #ee4d2d;
    --chart-facebook: #1877f2;
    --chart-others: #6b7280;

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --header-height: 64px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #141416;
    --bg-sidebar: #0e0e10;
    --bg-hover: #1e1e22;
    --bg-input: #1a1a1e;
    --bg-badge: #1e1e22;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border-color: #1e293b;
    --border-input: #334155;

    --color-primary: #f1f5f9;
    --color-primary-hover: #e2e8f0;

    --color-success-bg: #052e16;
    --color-success-text: #6ee7b7;
    --color-warning-bg: #422006;
    --color-warning-text: #fcd34d;
    --color-danger-bg: #450a0a;
    --color-danger-text: #fca5a5;
    --color-info-bg: #172554;
    --color-info-text: #93c5fd;

    --chart-1: #f1f5f9;
    --chart-2: #60a5fa;
    --chart-3: #34d399;
    --chart-4: #fbbf24;
    --chart-5: #f87171;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ── Base Reset ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow: hidden;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── App Layout ─────────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: var(--bg-secondary);
}

/* ── Loading ────────────────────────────────────────────── */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    border-right: none;
}

.sidebar-brand {
    height: var(--header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.sidebar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.sidebar-link i,
.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-title p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-btn i,
.header-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.header-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 2px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Metric Card ────────────────────────────────────────── */
.metric-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon i { width: 22px; height: 22px; }

.metric-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.metric-change.up {
    color: var(--color-success-text);
    background: var(--color-success-bg);
}

.metric-change.down {
    color: var(--color-danger-text);
    background: var(--color-danger-bg);
}

/* ── Grid Layouts ───────────────────────────────────────── */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-pending { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-expired { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-business { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-enterprise { background: #f3e8ff; color: #6b21a8; }

[data-theme="dark"] .badge-enterprise { background: #2e1065; color: #c4b5fd; }

.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }

/* ── Progress Bars ──────────────────────────────────────── */
.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ── Table ──────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

/* Customers page table: prevent cramped columns and keep key actions visible. */
.customers-table {
    min-width: 1380px;
    table-layout: fixed;
}

.customers-table.dynamic-columns {
    min-width: 980px;
    table-layout: auto;
}

.customers-table.dynamic-columns th,
.customers-table.dynamic-columns td {
    width: auto !important;
}

.transactions-table {
    min-width: 860px;
    table-layout: auto;
}

.customers-table th,
.customers-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.customers-table th:first-child,
.customers-table td:first-child {
    width: 210px;
}

.customers-table th:nth-child(2),
.customers-table td:nth-child(2) {
    width: 130px;
}

.customers-table th:nth-child(3),
.customers-table td:nth-child(3) {
    width: 120px;
}

.customers-table th:nth-child(4),
.customers-table td:nth-child(4) {
    width: 100px;
}

.customers-table th:nth-child(5),
.customers-table td:nth-child(5),
.customers-table th:nth-child(6),
.customers-table td:nth-child(6) {
    width: 96px;
}

.customers-table th:nth-child(7),
.customers-table td:nth-child(7),
.customers-table th:nth-child(8),
.customers-table td:nth-child(8) {
    width: 110px;
}

.customers-table th:nth-child(9),
.customers-table td:nth-child(9),
.customers-table th:nth-child(10),
.customers-table td:nth-child(10) {
    width: 112px;
}

.customers-table th:nth-child(11),
.customers-table td:nth-child(11) {
    width: 150px;
}

.customers-table th:nth-child(12),
.customers-table td:nth-child(12) {
    width: 105px;
}

.customers-table th:nth-child(13),
.customers-table td:nth-child(13) {
    width: 90px;
}

.customers-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.customers-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.customers-table .cell-name {
    line-height: 1.25;
    margin-bottom: 2px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: var(--bg-secondary);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .cell-name {
    font-weight: 600;
}

.data-table .cell-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.data-table .cell-github {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.cell-github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.cell-github-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.detail-github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
}

.detail-github-link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.pagination-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pagination-page {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 120px;
    text-align: center;
}

.column-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 30;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 4px;
}

.column-menu.is-open {
    display: flex;
}

.column-menu-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.column-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.column-menu-item input {
    width: 14px;
    height: 14px;
}

.column-menu-item small {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-info);
    background: var(--color-info-bg);
    color: var(--color-info-text);
    font-size: 0.74rem;
    font-weight: 600;
}

.filter-count-badge.is-zero {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    white-space: nowrap;
}

.btn i { width: 16px; height: 16px; }

.btn-primary {
    background: var(--color-primary);
    color: var(--text-inverse);
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-accent {
    background: var(--color-accent);
    color: #ffffff;
}
.btn-accent:hover { background: var(--color-accent-hover); }

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
}

.btn-icon {
    padding: 6px;
    width: 32px;
    height: 32px;
    justify-content: center;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color var(--transition-fast);
    width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 36px;
}

/* ── Auth Pages ─────────────────────────────────────────── */
.auth-layout .app-content {
    padding: 0;
}

.auth-main {
    background: var(--bg-secondary);
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
}

.auth-card h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.auth-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-switch {
    margin-top: 14px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auth-switch a {
    margin-left: 4px;
    font-weight: 600;
}

.auth-links {
    margin-top: 12px;
    text-align: right;
}

.auth-link-forgot {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-link-forgot:hover {
    text-decoration: underline;
}

.auth-success-card {
    text-align: center;
}

.auth-success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-success-icon svg {
    width: 56px;
    height: 56px;
    color: var(--accent);
}

.auth-success-icon.success svg {
    color: #22c55e;
}

.auth-success-icon.error svg {
    color: #ef4444;
}

.auth-email-highlight {
    font-weight: 600;
    color: var(--accent) !important;
    font-size: 0.95rem !important;
    margin-bottom: 8px !important;
}

.auth-success-desc {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.auth-success-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    animation: fadeIn var(--transition-fast);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    max-width: 640px;
    animation: slideUp var(--transition-base);
}

.modal-content.wide { max-width: 860px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Toast ──────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    animation: slideInRight var(--transition-base);
    min-width: 280px;
}

.toast.toast-success { border-left: 3px solid var(--color-success); }
.toast.toast-error { border-left: 3px solid var(--color-danger); }
.toast.toast-warning { border-left: 3px solid var(--color-warning); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Info Banner ────────────────────────────────────────── */
.info-banner {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.info-banner.banner-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border: 1px solid var(--color-danger);
}

.info-banner.banner-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning);
}

.info-banner.banner-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid var(--color-accent);
}

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar .search-input {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.toolbar .search-input input {
    display: block;
    padding-left: 36px;
}

.toolbar .search-input i,
.toolbar .search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Renewal List ───────────────────────────────────────── */
.renewal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.renewal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.renewal-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.renewal-item-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.renewal-item-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── History Timeline ───────────────────────────────────── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 12px 0;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 16px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-dot i { width: 12px; height: 12px; }

.timeline-content {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.timeline-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.timeline-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    gap: 12px;
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* ── Stats Pills ────────────────────────────────────────── */
.stats-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-pill {
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-badge);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.stat-pill .count {
    font-weight: 700;
    font-size: 1.1rem;
    color: inherit;
}

.stat-pill-label {
    font-size: 0.72rem;
    opacity: 0.7;
}

/* ── Detail Grid ────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.detail-item .value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Source Icons ────────────────────────────────────────── */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.source-dot.shopee { background: var(--chart-shopee); }
.source-dot.facebook { background: var(--chart-facebook); }
.source-dot.others { background: var(--chart-others); }

/* ── Status Breakdown ───────────────────────────────────── */
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.status-row + .status-row {
    border-top: 1px solid var(--border-color);
}

.status-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-row-value {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Chart Containers ───────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; }
    .sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-width); }
    .grid-4 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .app-content { padding: 16px; }
    .modal-content { width: 95%; }
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ── Page Section ───────────────────────────────────────── */
.page-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* ── Circular Percentage ────────────────────────────────── */
.pct-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ── Renewal Section (New Design) ──────────────────────── */
.renewal-legend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
}

.renewal-legend-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.renewal-legend-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.renewal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.renewal-row:last-child {
    border-bottom: none;
}

.renewal-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-info-bg);
    color: var(--color-info);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Service/Status Badges with Icons ──────────────────── */
.badge-business {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.badge-enterprise {
    background: #f3e8ff;
    color: var(--color-violet);
}

[data-theme="dark"] .badge-enterprise {
    background: #2e1065;
}

/* ── History Column Dot ────────────────────────────────── */
.history-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-dot-renewal { background: #10b981; }
.history-dot-payment { background: #3b82f6; }
.history-dot-status_change { background: #8b5cf6; }
.history-dot-note { background: #94a3b8; }
.history-dot-expiry_warning { background: #f59e0b; }
.history-dot-upgrade { background: #f97316; }

/* ── Timeline Spine (View Modal) ───────────────────────── */
.timeline-spine {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-line {
    width: 2px;
    flex: 1;
    background: var(--border-color);
    min-height: 16px;
    margin: 4px 0;
}

/* ── View Modal Tab Pill Toggle ────────────────────────── */
.modal-tabs-pill {
    display: flex;
    gap: 4px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
}

.modal-tabs-pill .tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-tabs-pill .tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border-bottom-color: transparent;
}

.modal-tabs-pill .tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.history-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--color-info-bg);
    color: var(--color-info);
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
}

/* ── Detail Grid (View Modal) ──────────────────────────── */
.detail-field {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.detail-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-field-value {
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Add History Form (embedded) ───────────────────────── */
.add-history-form {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--bg-hover);
}

.add-history-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-history-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ── History Cell Button (in table) ────────────────────── */
.history-cell-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
}

.history-cell-btn:hover {
    color: var(--text-primary);
}

.history-cell-btn:hover .history-cell-text {
    text-decoration: underline;
}

.history-cell-btn:hover i {
    opacity: 1 !important;
}

.history-cell-text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Cell Link (No. Pesanan) ───────────────────────────── */
.cell-link {
    font-family: monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.cell-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ── Alternating Row ───────────────────────────────────── */
.row-alt {
    background: var(--bg-hover);
}
