/* ===== 管理後台 (admin.html) 專屬樣式 ===== */

body {
    font-family: 'Inter', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    background: var(--light-gray);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--dark-green) 100%);
    box-shadow: 4px 0 20px rgba(16, 185, 129, 0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
}

.sidebar-brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.sidebar-brand-text p {
    font-size: 11px;
    margin: 0;
    opacity: 0.8;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 25px;
}

.menu-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}
.menu-section-toggle {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.menu-section-toggle:hover { color: rgba(255, 255, 255, 0.8); }
.menu-sub-label {
    padding: 6px 20px 2px 28px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

.menu-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.menu-item span {
    font-size: 14px;
}

.badge-warn {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.user-role {
    font-size: 11px;
    opacity: 0.7;
    margin: 0;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

.topbar {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-toggle-sidebar {
    background: var(--bg-green);
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: var(--primary-green);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.btn-toggle-sidebar:hover {
    background: var(--light-green);
    color: white;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.content-area {
    padding: 30px;
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray);
    margin: 0;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-green);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    font-size: 20px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.stat-card-change {
    font-size: 12px;
    color: var(--success);
}

/* 修正表格內下拉選單被遮擋的問題 */
.table-responsive {
    overflow: visible !important;
}

.content-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    /* 移除 overflow: hidden 以便下拉選單能溢出顯示 */
    overflow: visible !important;
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-gray);
}

.content-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-card-title i {
    color: var(--primary-green);
}

/* Buttons */
.btn-primary {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--dark-green);
    border-color: var(--dark-green);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: var(--light-gray);
    border-color: var(--light-gray);
    color: var(--text-primary);
    font-weight: 500;
}

.btn-danger {
    background: var(--error);
    border-color: var(--error);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

/* Table */
.table {
    margin: 0;
}

.table thead th {
    background: var(--bg-green);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr {
    border-bottom: 1px solid var(--light-gray);
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-green);
}

/* Badge */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: #d1fae5; color: var(--dark-green); }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* Form */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control, .form-select {
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.15);
}

.form-check-input:checked {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

/* Login Page */
#loginPage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-green) 0%, #ffffff 100%);
    padding: 20px;
    z-index: 100;
}

#loginPage.hidden {
    display: none !important;
}

.login-container {
    max-width: 450px;
    width: 100%;
    margin: auto;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--gray);
}

.login-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
    line-height: 1.4;
}

.login-forgot-link {
    font-size: 13px;
    color: var(--primary-green);
    text-decoration: none;
}

.login-forgot-link:hover {
    text-decoration: underline;
}

.login-footer-links {
    font-size: 14px;
}

#loginAlert {
    margin-bottom: 16px;
}

/* Alert */
.alert {
    border-radius: 8px;
    border: none;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid transparent;
}

.alert-danger {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border-left-color: #ef4444 !important;
}

.alert-success {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    border-left-color: #22c55e !important;
}

.alert-warning {
    background-color: #fffbeb !important;
    color: #92400e !important;
    border-left-color: #f59e0b !important;
}

.alert-info {
    background-color: #eff6ff !important;
    color: #1e40af !important;
    border-left-color: #3b82f6 !important;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
}

/* Page Sections */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* Search Bar */
.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 40px;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* Action Buttons */
.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn-view    { background: #dbeafe; color: #1e40af; }
.action-btn-edit    { background: #fef3c7; color: #92400e; }
.action-btn-delete  { background: #fee2e2; color: #991b1b; }
.action-btn-restore { background: #d1fae5; color: var(--dark-green); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 20px; }
    .stat-card { margin-bottom: 15px; }
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

.loading i {
    font-size: 48px;
    color: var(--primary-green);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 64px;
    color: var(--light-gray);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* Notification Tabs */
#notificationTabs .nav-link {
    color: #333;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 20px;
}

#notificationTabs .nav-link:hover {
    color: #0d6efd;
}

/* Toast - Center Style */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.custom-toast {
    pointer-events: auto;
    background: white;
    border-radius: 16px;
    padding: 20px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    animation: toastPopCenter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 6px solid var(--primary-green);
    min-width: 320px;
    max-width: 90vw;
    transition: all 0.3s ease;
}

.custom-toast i    { font-size: 24px; }
.custom-toast span { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.custom-toast.success { border-left-color: #10b981; }
.custom-toast.success i { color: #10b981; }
.custom-toast.danger  { border-left-color: #ef4444; }
.custom-toast.danger i  { color: #ef4444; }
.custom-toast.warning { border-left-color: #f59e0b; }
.custom-toast.warning i { color: #f59e0b; }
.custom-toast.info    { border-left-color: #3b82f6; }
.custom-toast.info i    { color: #3b82f6; }

@keyframes toastPopCenter {
    from { opacity: 0; transform: scale(0.8) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== URL List: Filter Bar ===== */
.url-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.url-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.url-filter-search {
    flex: 1;
    min-width: 200px;
}

.url-filter-select {
    width: auto;
    min-width: 120px;
}

.url-filter-limit {
    min-width: 90px;
}

/* ===== Active Filter Chips ===== */
.url-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0 2px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #166534;
}

.filter-chip.domain-chip {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.filter-chip.tag-chip {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #6d28d9;
}

.filter-chip button {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    opacity: 0.6;
    line-height: 1;
    color: inherit;
    transition: opacity 0.15s;
}

.filter-chip button:hover { opacity: 1; }

.filter-clear-all {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--gray);
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    border-radius: 4px;
    transition: color 0.15s;
}

.filter-clear-all:hover { color: var(--error); }

/* ===== Stats Bar ===== */
.url-stats-bar {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 12px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 4px;
}

.url-stats-bar strong {
    color: var(--text-primary);
}

/* ===== URL Table ===== */
.url-table .short-code-link {
    text-decoration: none;
    color: var(--primary-green);
    font-weight: 500;
    transition: color 0.2s;
}

.url-table .short-code-link:hover { color: var(--dark-green); }

.url-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.fw-600 { font-weight: 600; }

/* ===== Source Badges ===== */
.src-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: fit-content;
}

.src-api    { background: #dbeafe; color: #1e40af; }
.src-admin  { background: #f3e8ff; color: #6d28d9; }
.src-web    { background: #f3f4f6; color: #4b5563; }

/* ===== Domain Button ===== */
.domain-btn {
    display: inline-block;
    background: none;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: #6b7280;
    cursor: pointer;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s;
    text-align: left;
}

.domain-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: var(--bg-green);
}

/* ===== Tag Pills ===== */
.tags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 140px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #6d28d9;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tag-pill:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    transform: translateY(-1px);
}

.tag-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: none;
    border: 1px dashed #d1d5db;
    border-radius: 50%;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    padding: 0;
}

.tag-add-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: var(--bg-green);
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-active  { background: #d1fae5; color: #065f46; }
.status-invalid { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.status-expired { background: #fef3c7; color: #92400e; }
.status-deleted { background: #fee2e2; color: #991b1b; }

/* ===== Pagination ===== */
.url-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 20px 0 4px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    background: white;
    border: 1.5px solid var(--light-gray);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: var(--bg-green);
}

.page-btn.active {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--gray);
    padding: 0 4px;
    line-height: 36px;
    font-size: 13px;
}

/* ===== Catalog: Tab Bar ===== */
.catalog-tabs {
    display: flex;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    width: fit-content;
}

.catalog-tab {
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.catalog-tab:hover {
    background: var(--bg-green);
    color: var(--primary-green);
}

.catalog-tab.active {
    background: var(--primary-green);
    color: white;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(16,185,129,0.3);
}

/* ===== Catalog: Tab Pane ===== */
.catalog-pane { display: none; }
.catalog-pane.active { display: block; }

/* ===== Catalog: Modal ===== */
.catalog-modal-content {
    border-radius: 20px !important;
    border: none !important;
}

.catalog-modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 24px 28px 20px;
}

.catalog-modal-body { padding: 20px 28px; }

.catalog-modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 16px 28px 24px;
}

/* ===== Catalog: Avatar ===== */
.catalog-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.catalog-avatar-supplier { background: linear-gradient(135deg, #10b981, #059669); }
.catalog-avatar-product  { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.catalog-avatar-project  { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* ===== Default Badge ===== */
.default-badge {
    display: inline-block;
    padding: 2px 7px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #92400e;
    white-space: nowrap;
}

/* ===== Category Chip ===== */
.cat-chip {
    display: inline-block;
    padding: 3px 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #166534;
}

/* ===== URL cell in catalog ===== */
.catalog-url-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-url-link {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
}

.catalog-url-link:hover { color: var(--primary-green); text-decoration: underline; }

/* ===== Project Cards Grid ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 4px 0 8px;
}

.project-card {
    background: white;
    border: 1.5px solid rgba(16,185,129,0.12);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-card:hover {
    border-color: var(--primary-green);
    box-shadow: 0 6px 20px rgba(16,185,129,0.12);
    transform: translateY(-2px);
}

.project-card-inactive {
    opacity: 0.65;
    border-color: #e5e7eb;
}

.project-card-inactive:hover {
    opacity: 0.9;
    border-color: #9ca3af;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.project-card-header { flex: 1; }

.project-card-stats {
    display: flex;
    gap: 0;
    background: var(--bg-green);
    border-radius: 10px;
    overflow: hidden;
}

.project-stat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px;
    border-right: 1px solid rgba(16,185,129,0.1);
    gap: 2px;
    overflow: hidden;
}

.project-stat:last-child { border-right: none; }

.project-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.project-stat-label {
    font-size: 10px;
    color: var(--gray);
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-align: center;
}

/* UTM 徽章在 stats 內限制寬度 */
.project-stat .utm-badge {
    font-size: 10px;
    padding: 2px 6px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px solid var(--light-gray);
}

/* ===== Product filter chip ===== */
.filter-chip.product-chip {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

/* ===== Project assign box (URL create modal) ===== */
.project-assign-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 4px;
}

/* ===== Product filter button (URL table row badge) ===== */
.product-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #1e40af;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.product-filter-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* ===== Catalog Filter Bar ===== */
.catalog-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.catalog-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
}

.catalog-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 14px;
    pointer-events: none;
}

.catalog-search-input {
    padding-left: 34px;
}

.catalog-filter-select {
    width: auto;
    min-width: 130px;
    flex-shrink: 0;
}

/* ===== Catalog Offcanvas ===== */
.catalog-offcanvas {
    width: 420px !important;
}

.catalog-offcanvas-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.catalog-offcanvas-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafafa;
}

/* ===== Project Detail ===== */
.project-detail-head {
    padding: 4px 0;
}

.project-detail-stats {
    display: flex;
    gap: 24px;
    padding: 12px 0 0;
    border-top: 1px solid var(--light-gray);
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.project-detail-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-detail-stat-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.project-detail-stat-pending {
    color: #d97706;
}

/* ===== Project Add Slot Bar ===== */
.project-add-slot-bar {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 20px;
}

.project-add-slot-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.project-add-slot-field {
    flex: 1;
    min-width: 120px;
}

.project-add-slot-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ===== Slot status pending badge ===== */
.status-badge.status-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ===== Misc ===== */
.fw-500 { font-weight: 500; }

/* ===== Phase 2: Promoter avatar ===== */
.catalog-avatar-promoter {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; flex-shrink: 0;
}

/* ===== Phase 2: Project freeze badge ===== */
.status-badge.status-frozen {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ===== Phase 2: Project card frozen state ===== */
.project-card-frozen {
    border: 2px solid #bfdbfe !important;
    background: #f8faff;
}

.freeze-banner-mini {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px 6px 0 0;
    margin: -12px -12px 10px -12px;
}

/* ===== Phase 2: Freeze banner in project detail ===== */
.freeze-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 0;
    color: #1d4ed8;
    font-size: 13px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.freeze-banner a {
    color: #1d4ed8;
    word-break: break-all;
    font-weight: 500;
}

/* ===== Phase 2: Catalog modal styles ===== */
.catalog-modal-content {
    border: none;
    border-radius: 24px;
    overflow: hidden;
}

.catalog-modal-header {
    background: var(--bg-green);
    border-bottom: 1px solid rgba(16,185,129,0.15);
    padding: 20px 24px;
}

.catalog-modal-body {
    padding: 24px;
}

.catalog-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f3f4f6;
    gap: 8px;
}

/* ===== Pagination Bar ===== */
.catalog-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 4px;
    gap: 8px;
}

/* ===== TagInput Component ===== */
.tag-input-wrap {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 4px 10px 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tag-input-wrap:focus-within {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.tag-input-chips {
    display: contents;
}
.tag-input-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px 2px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    background: color-mix(in srgb, var(--chip-color) 15%, #fff);
    color: var(--chip-color);
    border: 1px solid color-mix(in srgb, var(--chip-color) 35%, transparent);
}
.tag-input-new {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: var(--chip-color);
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 2px;
    opacity: 0.85;
}
.tag-input-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.55;
    font-size: 12px;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tag-input-chip-x:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--chip-color) 25%, transparent);
}
.tag-input-field {
    flex: 1;
    min-width: 80px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1.6;
}
.tag-input-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    z-index: 1060;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.tag-input-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s;
    color: var(--text-primary);
}
.tag-input-option:hover {
    background: #f9fafb;
}
.tag-input-option-create {
    color: var(--primary-green);
    border-top: 1px solid #f3f4f6;
    margin-top: 2px;
    padding-top: 8px;
    font-style: normal;
}
.tag-input-option-create:hover {
    background: var(--bg-green);
}
.tag-input-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
}

/* URL Detail Offcanvas */
#urlDetailOffcanvas {
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
}

#urlDetailOffcanvas .offcanvas-header {
    padding: 20px 24px;
    background: #f9fafb;
}

#urlDetailOffcanvas .nav-tabs {
    gap: 0;
}

#urlDetailOffcanvas .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    font-size: 13px;
    transition: all 0.2s;
}

#urlDetailOffcanvas .nav-link:hover {
    color: var(--primary-green);
    border-bottom-color: #d1fae5;
}

#urlDetailOffcanvas .nav-link.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
    background: transparent;
}

#urlDetailOffcanvas .offcanvas-body {
    padding: 20px 24px;
}

#urlDetailOffcanvas .tab-pane {
    min-height: 300px;
}

/* Offcanvas Scrollable Content */
#urlDetailOffcanvas .offcanvas-body {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 180px);
}

#urlDetailOffcanvas .tab-pane {
    min-height: auto;
}


/* ── Share Button & Modal ──────────────────────────────────────────────────── */

.action-btn-share {
    background: #f0fdf4;
    color: #10b981;
}

.action-btn-share:hover {
    background: #dcfce7;
    transform: translateY(-2px);
}

.share-social-btn {
    width: 100%;
    padding: 10px 4px;
    border-radius: 12px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-social-btn i {
    font-size: 20px;
}

.share-social-btn.facebook {
    background: #e7f0fd;
    color: #1877f2;
}

.share-social-btn.twitter {
    background: #f0f8ff;
    color: #000;
}

.share-social-btn.whatsapp {
    background: #e6f9f0;
    color: #25d366;
}

.share-social-btn.telegram {
    background: #e8f4fd;
    color: #0088cc;
}

.share-social-btn.line {
    background: #e8f9e8;
    color: #00c300;
}

.share-social-btn:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}


/* ========== UTM 參數橫式顯示 ========== */
.utm-params-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}

.utm-param {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #065f46;
}

.utm-param strong {
    font-weight: 600;
}

.utm-param code {
    background: rgba(6, 95, 70, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

/* UTM 狀態橫式排列 (標題 + ON/OFF + 參數) */
.utm-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* 移除舊的縱式邊距，避免換行 */
.utm-status-row .utm-params-inline {
    margin-top: 0 !important;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========== 短網址列表 UTM 徽章 ========== */
.utm-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    cursor: help;
    width: fit-content;
}

.utm-badge.utm-on {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.utm-badge.utm-off {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.utm-badge.utm-proj {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ========== 必填 Pill 標籤 ========== */
.required-pill {
    display: inline-block;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    vertical-align: middle;
    line-height: 1.4;
}

/* ========== UTM 雙語標題：英文副標 ========== */
.en-label {
    display: inline-block;
    font-size: 10px;
    color: #94a3b8 !important;
    margin-left: 4px;
    letter-spacing: 0.2px;
    font-style: italic;
    vertical-align: middle;
}

/* ========== 用戶方案標籤（Plan Badge） ========== */
.plan-badge {
    display: inline-block;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(16,185,129,0.3);
}

.plan-badge.plan-starter {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 4px rgba(59,130,246,0.3);
}

.plan-badge.plan-business {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 4px rgba(245,158,11,0.3);
}

.plan-badge.plan-enterprise {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 2px 4px rgba(139,92,246,0.3);
}

/* ========== UTM 快選 Combobox ========== */
.utm-combobox-wrap {
    position: relative;
}

.utm-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    max-height: 240px;
    overflow-y: auto;
    z-index: 1100; /* 高於 Bootstrap modal */
    padding: 4px 0;
    animation: utmDropdownIn 0.12s ease-out;
}

@keyframes utmDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.utm-option {
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background 0.1s ease, color 0.1s ease;
    user-select: none;
    line-height: 1.4;
}

.utm-option:hover,
.utm-option.highlighted {
    background: #ecfdf5;
    color: #047857;
}

.utm-option mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

.utm-option.highlighted mark {
    background: #fde68a;
}

.utm-option-empty {
    padding: 8px 14px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    background: #f9fafb;
    border-top: 1px dashed #e5e7eb;
    margin-top: 4px;
}

/* ========== 配額橫條（Phase 2） ========== */
.quota-bar-container {
    width: 100%;
}

.quota-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.quota-bar.quota-warn {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #fcd34d;
}

.quota-bar.quota-full {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #fca5a5;
}

.quota-bar-icon {
    font-size: 18px;
    color: #10b981;
}
.quota-bar.quota-warn .quota-bar-icon { color: #d97706; }
.quota-bar.quota-full .quota-bar-icon { color: #dc2626; }

.quota-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    font-size: 13px;
    color: #374151;
}

.quota-bar-label {
    font-weight: 600;
    color: #1f2937;
}

.quota-bar-text {
    color: #374151;
}

.quota-bar-text strong {
    color: #047857;
    font-size: 15px;
    font-weight: 700;
}

.quota-bar.quota-warn .quota-bar-text strong { color: #b45309; }
.quota-bar.quota-full .quota-bar-text strong { color: #b91c1c; }

.quota-bar-progress {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
}

.quota-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #34d399, #10b981);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.quota-bar.quota-warn .quota-bar-fill {
    background: linear-gradient(90deg, #fbbf24, #d97706);
}

.quota-bar.quota-full .quota-bar-fill {
    background: linear-gradient(90deg, #f87171, #dc2626);
}

.quota-bar-actions {
    flex-shrink: 0;
}

.quota-bar-upgrade {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(16,185,129,0.25);
}

.quota-bar-upgrade:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16,185,129,0.35);
}

.quota-bar-pct {
    font-size: 13px;
    font-weight: 700;
    color: #047857;
}

@media (max-width: 768px) {
    .quota-bar {
        flex-wrap: wrap;
    }
    .quota-bar-progress {
        order: 99;
        width: 100%;
        flex-basis: 100%;
    }
}

/* ========== 用戶管理：方案 Select 顏色 ========== */
.plan-select {
    font-weight: 600;
    border-width: 2px;
    transition: all 0.2s ease;
}
.plan-select.plan-free       { color: #047857; border-color: #a7f3d0; background-color: #ecfdf5; }
.plan-select.plan-starter    { color: #1d4ed8; border-color: #bfdbfe; background-color: #eff6ff; }
.plan-select.plan-business   { color: #b45309; border-color: #fcd34d; background-color: #fffbeb; }
.plan-select.plan-enterprise { color: #6d28d9; border-color: #c4b5fd; background-color: #f5f3ff; }

/* ========== 方案配額管理：方案標籤 ========== */
.plan-tag-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}
.plan-tag-pill.plan-free       { background: linear-gradient(135deg, #10b981, #059669); }
.plan-tag-pill.plan-starter    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.plan-tag-pill.plan-business   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.plan-tag-pill.plan-enterprise { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.plan-tag-pill.plan-gold       { background: linear-gradient(135deg, #facc15, #eab308); color: #78350f; }

/* 用戶選單 plan badge 加 gold */
.plan-badge.plan-gold {
    background: linear-gradient(135deg, #facc15, #eab308);
    color: #78350f;
    box-shadow: 0 2px 4px rgba(250,204,21,0.4);
}

/* 用戶管理：plan select gold */
.plan-select.plan-gold { color: #78350f; border-color: #fde68a; background-color: #fef9c3; }

/* ========== 配額橫條 Gold/Unlimited 樣式 ========== */
.quota-bar.quota-unlimited {
    background: linear-gradient(135deg, #fefce8, #fef9c3, #fde68a);
    border-color: #fde68a;
}
.quota-bar.quota-unlimited .quota-bar-icon { color: #d97706; font-size: 22px; }
.quota-bar.quota-unlimited .quota-bar-text strong { color: #b45309; }

.quota-infinity {
    font-size: 22px;
    font-weight: 800;
    color: #d97706;
    vertical-align: middle;
    margin-left: 2px;
}

.quota-bar-progress-unlimited .quota-bar-fill {
    background: linear-gradient(90deg, #facc15, #eab308, #facc15);
    background-size: 200% 100%;
    animation: goldFlow 3s linear infinite;
}
@keyframes goldFlow {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.quota-bar-unlimited-label {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #facc15, #eab308);
    color: #78350f !important;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(250,204,21,0.4);
}

/* ========== Dashboard 歡迎卡（Phase 3） ========== */
.welcome-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    color: white;
    border-radius: 20px;
    padding: 28px 32px;
    box-shadow: 0 12px 30px rgba(16,185,129,0.25);
    position: relative;
    overflow: hidden;
}
.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.welcome-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    position: relative;
}

.welcome-card-greet h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: white;
}
.welcome-card-greet p {
    color: white;
    font-size: 14px;
    margin: 4px 0 0;
}

.welcome-card-quick {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.quick-icon {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    min-width: 64px;
    backdrop-filter: blur(8px);
}
.quick-icon:hover {
    background: white;
    color: #047857;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.quick-icon i { font-size: 20px; }
.quick-icon span { font-size: 11px; font-weight: 600; }

/* Welcome quota row */
.welcome-quota {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    padding: 12px 18px;
    backdrop-filter: blur(8px);
    position: relative;
    flex-wrap: wrap;
}

.wq-text {
    font-size: 14px;
    color: white;
    white-space: nowrap;
}
.wq-text strong {
    font-size: 18px;
    font-weight: 800;
    color: white;
}

.wq-progress {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
    min-width: 120px;
}

.wq-fill {
    height: 100%;
    background: rgba(255,255,255,0.85);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.welcome-quota.wq-bar-warn .wq-fill { background: #fde68a; }
.welcome-quota.wq-bar-full .wq-fill { background: #fca5a5; }
.welcome-quota.wq-bar-unlimited .wq-fill {
    background: linear-gradient(90deg, #fde68a, #fcd34d, #fde68a);
    background-size: 200% 100%;
    animation: goldFlow 3s linear infinite;
}

.wq-infinity {
    font-size: 22px;
    font-weight: 800;
    color: #fde68a;
    margin: 0 2px;
    vertical-align: middle;
}

.wq-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.wq-upgrade {
    display: inline-flex;
    align-items: center;
    background: white;
    color: #047857 !important;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.wq-upgrade:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

/* welcome card plan-badge 反白色處理 */
.welcome-quota .plan-badge {
    background: rgba(255,255,255,0.9);
    color: #047857;
}
.welcome-quota .plan-badge.plan-gold {
    background: linear-gradient(135deg, #facc15, #eab308);
    color: #78350f;
}

@media (max-width: 768px) {
    .welcome-card-top { flex-direction: column; align-items: stretch; }
    .welcome-card-quick { justify-content: center; }
}

/* ========== UTM 範本管理（Phase 3） ========== */
.utm-tag-list {
    min-height: 80px;
    padding: 12px;
    border: 1px dashed var(--gray-200);
    border-radius: 8px;
    background: #f9fafb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

.utm-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: white;
    color: #047857;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 4px 4px 4px 10px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.utm-tag-item:hover {
    background: #ecfdf5;
    border-color: #10b981;
}

.utm-tag-remove {
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 0 4px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
}

.utm-tag-remove:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* ========== 分析報表：UTM 維度卡（Phase 3） ========== */
.utm-dim-card {
    background: #fafafa;
    border: 1px solid var(--gray-100, #f3f4f6);
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.utm-dim-header {
    background: white;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.utm-dim-header h5 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.utm-dim-body {
    padding: 14px 16px;
    flex: 1;
}

.utm-dim-row {
    display: grid;
    grid-template-columns: 110px 1fr 110px;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.utm-dim-name {
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.utm-dim-bar-wrap {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.utm-dim-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.utm-dim-stats {
    text-align: right;
    font-size: 12px;
}

.utm-dim-visits {
    font-weight: 700;
    color: #1f2937;
}

.utm-dim-urls {
    color: #94a3b8;
    margin-left: 2px;
}

.utm-dim-footer {
    padding: 8px 16px;
    background: white;
    border-top: 1px dashed var(--gray-100);
    text-align: center;
}

/* ========== i18n 語言切換器（Phase 4） ========== */
.i18n-switcher {
    position: relative;
    display: inline-block;
}

.i18n-current {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.i18n-current:hover {
    border-color: #10b981;
    color: #10b981;
}

.i18n-flag {
    font-size: 16px;
    line-height: 1;
}

.i18n-arrow {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.2s;
}

.i18n-switcher.open .i18n-arrow {
    transform: rotate(180deg);
}

.i18n-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 6px;
    z-index: 2000;
    display: none;
    animation: i18nFadeIn 0.15s ease-out;
}

.i18n-switcher.open .i18n-menu {
    display: block;
}

@keyframes i18nFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.i18n-option {
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.i18n-option:hover {
    background: #ecfdf5;
    color: #047857;
}

.i18n-option.active {
    background: #f0fdf4;
    color: #047857;
    font-weight: 700;
}

/* Compact 模式（後台 sidebar 用） */
.i18n-switcher-compact .i18n-current {
    padding: 4px 10px;
    font-size: 12px;
}

/* Sidebar 內部專用樣式 */
.sidebar .i18n-switcher .i18n-current {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: white;
}
.sidebar .i18n-switcher .i18n-current:hover {
    background: rgba(255,255,255,0.18);
    color: white;
}

/* ========== 廣告維護：預覽區（模擬轉址頁綠色 banner） ========== */
.ads-preview-wrap {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.ads-preview-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    min-height: 100px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.ads-preview-header img,
.ads-preview-header iframe {
    max-width: 100%;
    height: auto;
}

.ads-preview-empty {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

.ads-preview-mock-content {
    padding: 30px 20px;
    text-align: center;
    background: #f0fdf4;
    border-top: 1px solid rgba(16, 185, 129, 0.15);
}

.ads-preview-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.ads-preview-text {
    color: #064e3b;
    font-weight: 700;
    font-size: 14px;
}

/* ========== 跳轉頁面外觀設定 ========== */
.rp-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
.rp-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rp-seg {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.rp-seg-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}
.rp-seg-btn:hover { border-color: var(--primary-green); color: var(--primary-green); }
.rp-seg-btn.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 2px 8px rgba(16,185,129,0.2);
}
.rp-preview-wrap {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #f0fdf4;
    position: sticky;
    top: 20px;
}
.rp-preview-frame {
    width: 100%;
    height: 720px;
    border: 0;
    display: block;
    background: white;
}

/* 跳轉頁面預覽：語言切換器 */
.rp-preview-lang-bar {
    display: inline-flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 3px;
}
.rp-lang-chip {
    border: 0;
    background: transparent;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.2;
}
.rp-lang-chip:hover { color: var(--primary-green); }
.rp-lang-chip.active {
    background: var(--primary-green);
    color: white;
    box-shadow: 0 2px 6px rgba(16,185,129,0.25);
}

/* Email 樣版「插入變數」chip 按鈕 */
.et-var-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 10px;
}
.et-var-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.et-var-chip:hover {
    background: #ecfdf5;
    border-color: var(--primary-green);
    color: var(--dark-green);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(16,185,129,0.15);
}
.et-var-chip:active {
    transform: translateY(0);
}
.et-var-chip code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 11.5px;
    font-weight: 600;
}
.et-var-chip i {
    color: var(--primary-green);
    font-size: 12px;
}
.et-var-label {
    font-size: 11.5px;
    color: #6b7280;
    font-weight: 500;
    margin-right: 4px;
    align-self: center;
}
