/* ============================================================
   System Admin — /admin landing + /admin/orders (Phase 1a)
   ============================================================ */

/* All admin views share this class. Push content down from the sticky
   header so the 管理後台 title doesn't crash into the nav bar. */
.admin-section {
    padding-top: 2rem;
}

.admin-landing-intro {
    color: #94a3b8;
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.admin-section-subtitle {
    margin: 2.5rem 0 1rem;
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Quick-stat cards on /admin landing */
.admin-home-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.admin-home-stat {
    position: relative;
    display: block;
    background: var(--bg-card, rgba(30, 41, 59, 0.55));
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 14px;
    padding: 1.25rem 1.35rem;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
a.admin-home-stat:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(30, 41, 59, 0.75);
}
a.admin-home-stat:hover .stat-arrow {
    opacity: 1;
    transform: translateX(2px);
}
.admin-home-stat .stat-arrow {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    color: #22d3ee;
    font-size: 1.05rem;
    opacity: 0.45;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.admin-home-stat .stat-label {
    margin: 0 0 0.4rem;
    color: #94a3b8;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}
.admin-home-stat h3 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}
.admin-home-stat .stat-hint {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: #22d3ee;
}

/* Inline section header used inside admin list containers (e.g., 聯盟夥伴管理) */
.admin-section-inline-header {
    margin-top: 3.5rem;
    margin-bottom: 2.25rem;
}
/* First header in the list container still needs breathing room from the chips above */
.admin-list-container > .admin-section-inline-header:first-child {
    margin-top: 1.5rem;
}

/* Clickable partner-name cell in the affiliate section — opens full member
   detail page in a new tab (via ?focus=<id> deep-link). */
.admin-member-name-link {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.12s ease;
}
.admin-member-name-link:hover .admin-member-name {
    color: #60a5fa;
    text-decoration: underline;
}
.admin-member-name-wrap {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.35;
}
/* 詳情 button cell is its own narrow column on the far right */
.admin-member-detail-cell {
    text-align: right;
    white-space: nowrap;
}
.admin-section-inline-header h3 {
    margin: 0 0 0.3rem;
    color: #e2e8f0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.admin-section-count {
    display: inline-block;
    min-width: 1.8em;
    padding: 0.1rem 0.55rem;
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
}

/* Gap between the affiliate section and the regular-members section */
.admin-affiliate-section {
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.18);
}
.admin-regular-section {
    /* inherits default spacing */
}
.admin-section-hint {
    margin: 0;
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.55;
}

/* Clip-job preview modal — wide panel so video fits comfortably */
.admin-clip-preview-panel {
    max-width: 960px;
    width: 90vw;
}
.admin-clip-preview-body {
    padding: 0.5rem 0.25rem;
}
.admin-clip-preview-body video {
    width: 100%;
    max-height: 70vh;
    background: #000;
    border-radius: 8px;
    display: block;
}
.admin-clip-preview-body a {
    color: #60a5fa;
    font-size: 0.78rem;
}

/* Seat assignment list in the seat-assignment modal */
.admin-seat-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.25rem;
}
.admin-seat-option {
    position: relative;
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    text-align: left;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    color: #e2e8f0;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.admin-seat-option:hover:not([disabled]):not(.current) {
    transform: translateY(-1px);
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(139, 92, 246, 0.12);
}
.admin-seat-option.current {
    border-color: rgba(34, 211, 238, 0.6);
    background: rgba(34, 211, 238, 0.08);
    cursor: default;
}
.admin-seat-option.disabled,
.admin-seat-option[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.admin-seat-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.admin-seat-tier {
    color: #fff;
    letter-spacing: 0.03em;
}
.admin-seat-tier-id {
    margin-left: 0.4rem;
    font-size: 0.66rem;
    color: #64748b;
    font-weight: 400;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.admin-seat-rate {
    color: #22d3ee;
    font-size: 1.05rem;
}
.admin-seat-row2 {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #94a3b8;
}
.admin-seat-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.7rem;
    font-size: 0.66rem;
    padding: 0.1rem 0.5rem;
    background: rgba(34, 211, 238, 0.22);
    color: #22d3ee;
    border-radius: 999px;
    letter-spacing: 0.04em;
}
.admin-seat-members {
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.admin-seat-member-chip {
    display: inline-flex;
    flex-direction: column;
    padding: 0.25rem 0.55rem;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #e2e8f0;
}
.admin-seat-member-chip small {
    color: #64748b;
    font-size: 0.68rem;
}

/* Commission-rate badge in affiliate admin list */
.admin-rate-cell {
    white-space: nowrap;
}
.admin-rate-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #c4b5fd;
    font-weight: 600;
    font-size: 0.88rem;
}
.admin-rate-badge.admin-rate-override {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fcd34d;
}
.admin-rate-source {
    margin-left: 0.4rem;
    font-size: 0.7rem;
    color: #64748b;
}

/* Always-visible overview section above the affiliate admin tabs.
   Acts like a dashboard header; tabs below it switch the workflow pane. */
.admin-overview-section {
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem;
}
.admin-overview-section-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.02em;
}

/* Region badge next to the "Admin: 聯盟後台" title (TW / INTL scope). */
.admin-region-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.22rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    vertical-align: middle;
    border-radius: 999px;
    letter-spacing: 0.4px;
}
.admin-region-badge.region-tw {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.admin-region-badge.region-intl {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

/* "← 回管理後台" button on /admin/affiliate header */
.btn-back-admin {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    margin-right: 1rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn-back-admin:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.6);
    color: #fff;
    transform: translateX(-2px);
}

/* Finance overview on /admin home */
.admin-finance-region-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
}
.finance-region-tab {
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s;
}
.finance-region-tab:hover { color: rgba(255, 255, 255, 0.85); }
.finance-region-tab.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
}

.admin-finance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}
.admin-finance-kpi {
    padding: 1rem 1.15rem;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.admin-finance-kpi .label {
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
}
.admin-finance-kpi strong {
    font-size: 1.45rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}
.admin-finance-kpi .sub {
    /* Bumped from 0.72rem so the breakdown text ("真人 X · 機器人 Y") is
       actually readable next to the big stat number above. */
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}
.admin-finance-kpi.danger strong { color: #f87171; }
.admin-finance-kpi.warning strong { color: #fbbf24; }
.admin-finance-kpi.highlight {
    background: linear-gradient(135deg, rgba(34,211,238,0.12), rgba(139,92,246,0.14));
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12) inset;
}
.admin-finance-kpi.highlight strong {
    color: #22d3ee;
    font-size: 1.65rem;
}
.admin-finance-monthly-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}
.admin-finance-monthly th,
.admin-finance-monthly td {
    white-space: nowrap;
}
/* Columns 2 (訂單) and 3+ (營收/佣金/撥款/手續費/淨值) are numeric — align both
   header and cell right so they line up. */
.admin-finance-monthly th:nth-child(n+2),
.admin-finance-monthly td:nth-child(n+2) {
    text-align: right;
}
.admin-finance-monthly td:nth-child(n+2) {
    font-variant-numeric: tabular-nums;
}
.admin-finance-monthly tr.month-net-positive td:last-child { color: #22d3ee; font-weight: 600; }
.admin-finance-monthly tr.month-net-negative td:last-child { color: #f87171; font-weight: 600; }

/* Sitemap (collapsible, bottom of /admin home) */
.admin-sitemap {
    margin-top: 2.5rem;
    padding: 0.9rem 1.1rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
}
.admin-sitemap-summary {
    cursor: pointer;
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    list-style: none;
    user-select: none;
    padding: 0.25rem 0;
}
.admin-sitemap-summary::-webkit-details-marker { display: none; }
.admin-sitemap-summary::before {
    content: "▸ ";
    display: inline-block;
    margin-right: 0.25rem;
    transition: transform 0.15s ease;
}
.admin-sitemap[open] .admin-sitemap-summary::before {
    transform: rotate(90deg);
}
.admin-sitemap-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.18);
}
.admin-sitemap-group h4 {
    margin: 0 0 0.6rem;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
}
.admin-sitemap-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.admin-sitemap-group a {
    display: block;
    padding: 0.3rem 0.55rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.78rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    border-radius: 5px;
    transition: background 0.12s ease, color 0.12s ease;
}
.admin-sitemap-group a:hover {
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
}

/* Module nav cards (訂單 / 會員 / 錢包 / …) */
.admin-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.admin-module-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.4rem 1.3rem;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.18s, background 0.18s, box-shadow 0.2s;
}
.admin-module-card:hover {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -12px rgba(139, 92, 246, 0.35);
}
.admin-module-icon {
    font-size: 1.75rem;
    line-height: 1;
}
.admin-module-name {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.admin-module-desc {
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.4;
}
.admin-module-card-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.admin-module-card-disabled:hover {
    transform: none;
    box-shadow: none;
    background: rgba(30, 41, 59, 0.55);
    border-color: rgba(148, 163, 184, 0.15);
}

/* Orders table */
.admin-orders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.88rem;
    margin-top: 1rem;
}
.admin-orders-table thead th {
    text-align: left;
    padding: 0.8rem 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    white-space: nowrap;
}
.admin-orders-table tbody td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-orders-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.04);
}
.admin-order-num {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.78rem;
    color: #cbd5e1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-order-title {
    color: #94a3b8;
    font-size: 0.75rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-order-buyer {
    color: #e2e8f0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-order-buyer-email {
    color: #64748b;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Order number button → inline popup with payment_transactions detail */
.admin-order-num-btn {
    display: block;
    padding: 0;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
.admin-order-num-btn:hover .admin-order-num {
    color: #60a5fa;
    text-decoration: underline;
}

/* Raw JSON preview (used in order-payment modal) */
.admin-raw-json-body {
    margin: 0;
    padding: 0.9rem 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    max-height: 360px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Buyer link → member detail page */
.admin-buyer-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 2px 0;
    transition: opacity 0.12s ease;
}
.admin-buyer-link:hover .admin-order-buyer {
    color: #60a5fa;
    text-decoration: underline;
}
.admin-buyer-link:hover .admin-order-buyer-email {
    color: #94a3b8;
}
.admin-amt {
    color: #22d3ee;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.admin-time {
    color: #cbd5e1;
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}
.admin-order-commission-amt {
    color: #22d3ee;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 4px;
}

/* Type / status pill tags */
.admin-type-tag,
.admin-status-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.admin-type-topup  { background: rgba(139, 92, 246, 0.14); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.admin-type-buyout { background: rgba(236, 72, 153, 0.14); color: #f9a8d4; border: 1px solid rgba(236, 72, 153, 0.3); }
.admin-type-trial  { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

.admin-status-paid    { background: rgba(34, 197, 94, 0.14);  color: #86efac; border: 1px solid rgba(34, 197, 94, 0.3); }
.admin-status-pending { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.32); }
.admin-status-failed  { background: rgba(239, 68, 68, 0.12);  color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.28); }
.admin-status-refunded{ background: rgba(100, 116, 139, 0.18); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.3); }

.admin-list-loading,
.admin-list-empty {
    padding: 2rem;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* ============================================================
   Members management (/admin/members — Phase 1b)
   ============================================================ */

.admin-members-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.88rem;
    margin-top: 1rem;
}
.admin-members-table thead th {
    text-align: left;
    padding: 0.8rem 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    white-space: nowrap;
}
.admin-members-table tbody td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-members-table tr.member-main-row:hover {
    background: rgba(139, 92, 246, 0.04);
}
.admin-member-name-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.admin-member-name-cell .partner-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 999px;
    object-fit: cover;
    background: rgba(139, 92, 246, 0.2);
}
.admin-member-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-member-id {
    color: #64748b;
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.72rem;
    margin-top: 1px;
}
.admin-member-email {
    color: #cbd5e1;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-member-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.admin-member-actions-cell {
    text-align: right;
    white-space: nowrap;
}
.admin-mini-btn {
    padding: 5px 12px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 6px;
    color: #c4b5fd;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.admin-mini-btn:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.55);
    color: #fff;
}
.admin-mini-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
.admin-mini-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}
.admin-mini-btn-danger:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
    color: #fff;
}
.admin-mini-btn-ok {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}
.admin-mini-btn-ok:hover {
    background: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.55);
    color: #fff;
}

/* Role tags */
.admin-role-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.admin-role-user  { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.admin-role-admin { background: rgba(34, 211, 238, 0.14); color: #67e8f9; border: 1px solid rgba(34, 211, 238, 0.3); }
.admin-role-super { background: rgba(236, 72, 153, 0.14); color: #f9a8d4; border: 1px solid rgba(236, 72, 153, 0.3); }

/* Member-category pill tags (affiliate / buyout / plain) */
.admin-tag-affiliate { background: rgba(139, 92, 246, 0.14); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.admin-tag-buyout    { background: rgba(236, 72, 153, 0.14); color: #f9a8d4; border: 1px solid rgba(236, 72, 153, 0.3); }
.admin-tag-plain     { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Expanded member detail (below row) */
.member-detail-cell {
    padding: 1.5rem !important;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12) !important;
}
.member-detail-content {
    color: #e2e8f0;
    font-size: 0.85rem;
}
.member-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.member-detail-block {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.member-detail-block-wide {
    grid-column: 1 / -1;
}
.member-detail-block h5 {
    margin: 0 0 0.75rem;
    color: #a5b4fc;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.member-detail-kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.1);
    gap: 1rem;
}
.member-detail-kv-row:last-child {
    border-bottom: 0;
}
.member-detail-kv-label {
    color: #94a3b8;
    font-size: 0.75rem;
    white-space: nowrap;
}
.member-detail-kv-value {
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}
.member-detail-empty {
    color: #64748b;
    font-size: 0.8rem;
    margin: 0;
}

.member-recent-orders {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.member-recent-orders th {
    text-align: left;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.member-recent-orders td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}
.member-recent-orders code {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.75rem;
    color: #a5b4fc;
}

.member-detail-actions {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.member-action-status {
    font-size: 0.85rem;
}

/* ============================================================
   Wallets / Plans / Clip Jobs (Phase 2)
   ============================================================ */

/* Wallet balance tiers */
.wallet-bal-ok   { color: #22d3ee; }
.wallet-bal-low  { color: #fcd34d; }
.wallet-bal-zero { color: #f87171; }

/* Plans stack */
.plan-cards-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.plan-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 1.25rem 1.35rem;
}
.plan-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.plan-card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1 1 auto;
    min-width: 200px;
}
.plan-card-code {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.82rem;
    color: #a5b4fc;
    background: rgba(139, 92, 246, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
}
.plan-card-name {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}
.plan-card-tags {
    display: flex;
    gap: 4px;
}
.plan-card-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    color: #94a3b8;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
.plan-card-meta strong {
    color: #e2e8f0;
    font-weight: 600;
}
.plan-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.plan-price-table th {
    text-align: left;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.plan-price-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}
.plan-price-table code {
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.75rem;
    color: #a5b4fc;
}

/* Clip jobs error cell */
.clip-job-error {
    color: #fca5a5;
    font-size: 0.75rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Logs raw-JSON viewer modal (Phase 3)
   ============================================================ */
.admin-raw-json {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    font-family: 'SF Mono', Consolas, Menlo, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #cbd5e1;
    max-height: 65vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* Daily row clickable: clicking jumps to the visit detail filtered to that
   date. Hint with a hover background. */
#adminFlowView tr.flow-daily-row:hover {
    background: rgba(124, 77, 255, 0.12);
}

/* The shared .btn-text class injects a ← arrow via ::before for "back" /
   navigation buttons. Several buttons inside the flow view reuse .btn-text
   purely for visual style but aren't "back" affordances — suppress the
   arrow so labels like 回放 / 第一頁 / 上一頁 / 下一頁 / 末頁 read cleanly. */
#adminFlowView .js-flow-track::before,
#adminFlowView .js-flow-pager-btn::before {
    content: none;
}

/* Flow / traffic admin — link colors. Default browser blue is unreadable on
   the dark admin background; override only inside the flow view's tables so
   we don't disturb other admin pages. */
#adminFlowView .admin-data-table a,
#adminFlowView .admin-list-container a {
    color: #93c5fd;
    text-decoration: none;
}
#adminFlowView .admin-data-table a:hover,
#adminFlowView .admin-list-container a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}
#adminFlowView .admin-data-table a:visited,
#adminFlowView .admin-list-container a:visited {
    color: #a5b4fc;
}
