.perf-scope-wrap { width: 100%; }
.perf-scope-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: center;
    font-size: 12px;
}
.perf-scope-table th, .perf-scope-table td {
    border: 1px solid #e5e7eb;
    padding: 8px 6px;
}
.perf-scope-table th {
    background: #f9fafb;
    color: #475569;
    font-weight: 600;
}
.perf-scope-table td.ok { color: #16a34a; font-weight: 700; }
.perf-scope-table td.no { color: #ef4444; font-weight: 700; }
/* 광고관리 페이지 전용 스타일 - reports.html 스타일 참고 */
.ad-management-page .main-container {
    max-width: 1200px !important;
    width: 100% !important;
    margin: 0 auto !important;
}

/* 대기업 스타일 필터 섹션 */
.filter-section {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.filter-header h3 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.025em;
}

.filter-header h3 i {
    color: #6b7280;
    font-size: 1.1rem;
}

.filter-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    font-weight: 400;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.filter-group label i {
    color: #6b7280;
    font-size: 0.875rem;
    width: 16px;
}

.filter-select, .date-input {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #111827;
    font-family: inherit;
}

.filter-select:focus, .date-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select:hover, .date-input:hover {
    border-color: #9ca3af;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.ad-management-page .btn:not(.btn-logout):not(.btn-login):not(.btn-register) {
    padding: 0.75rem 1.5rem;
    border: 1px solid;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.btn-reset {
    background: #ffffff;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-reset:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #9ca3af;
}

.btn-search {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.btn-search:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-search:active {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* 대기업 스타일 테이블 컨테이너 */
.table-container {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-header {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.table-header h3 {
    color: #111827;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.025em;
}

.radio-container {
    display: flex;
    gap: 1.5rem;
}

.stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.stat-item i {
    color: #6b7280;
    font-size: 0.75rem;
}

.record-count {
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 400;
}

/* 대기업 스타일 테이블 */
.table-wrapper {
    overflow-x: auto;
}

.ad-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.ad-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 1rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.75rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ad-table th i {
    margin-right: 0.5rem;
    color: #6b7280;
    font-size: 0.75rem;
}

/* 정렬 가능한 헤더 */
.ad-table th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.ad-table th.sortable:hover {
    background: #f3f4f6;
}

.sort-icon {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    transition: color 0.2s ease;
}

.sort-icon:hover {
    color: #6b7280;
}

.sort-icon.active {
    color: #3b82f6;
    font-weight: bold;
}

.ad-table td {
    padding: 1rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    color: #111827;
    font-weight: 400;
}

.ad-table tr:hover {
    background: #f9fafb;
}

.ad-table tr:last-child td {
    border-bottom: none;
}

/* 컬럼 너비 조정 */
.ad-table th.col-number,
.ad-table td.col-number {
    width: 80px;
    min-width: 80px;
}

.ad-table th.col-device,
.ad-table td.col-device {
    width: 100px;
    min-width: 100px;
}

.ad-table th.col-category,
.ad-table td.col-category {
    width: 120px;
    min-width: 120px;
}

.ad-table th.col-advertiser,
.ad-table td.col-advertiser {
    width: 120px;
    min-width: 120px;
}

.ad-table th.col-advertiser-name,
.ad-table td.col-advertiser-name {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-table th.col-commission,
.ad-table td.col-commission {
    width: 100px;
    min-width: 100px;
    vertical-align: middle;
}

.ad-table th.col-actions,
.ad-table td.col-actions {
    width: 100px;
    min-width: 100px;
}

/* 상태 배지 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.pending {
    background: #dbeafe;
    color: #1e40af;
}

/* 탭 네비게이션 */
.tab-navigation {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-list {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tab-item {
    flex: 1;
}

.tab-link {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #6b7280;
    font-weight: 600;
    text-align: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: transparent;
}

.tab-link:hover {
    color: #374151;
    background: #f9fafb;
}

.tab-link.active {
    color: #3b82f6;
    background: #eff6ff;
    border: 1px solid #dbeafe;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 액션 버튼 개선 */
.action-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #374151;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    white-space: nowrap;
}

.action-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.action-btn.primary {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* 버튼 색상 개선 */
.ad-management-page .btn-reset {
    background: #6b7280 !important;
    color: #ffffff !important;
    border-color: #6b7280 !important;
}

.ad-management-page .btn-reset:hover {
    background: #4b5563 !important;
    color: #ffffff !important;
    border-color: #4b5563 !important;
}

.ad-management-page .btn-reset:focus {
    background: #6b7280 !important;
    color: #ffffff !important;
    border-color: #6b7280 !important;
}

.ad-management-page .btn-reset:active {
    background: #4b5563 !important;
    color: #ffffff !important;
    border-color: #4b5563 !important;
}

.ad-management-page .btn-search {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.ad-management-page .btn-search:hover {
    background: #047857 !important;
    color: #ffffff !important;
    border-color: #047857 !important;
}

.ad-management-page .btn-search:focus {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.ad-management-page .btn-search:active {
    background: #065f46 !important;
    color: #ffffff !important;
    border-color: #065f46 !important;
}

/* 페이징 스타일 */
.pagination-container {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-top: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #374151;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-selector label {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.page-size-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #ffffff;
    color: #111827;
    min-width: 80px;
}

.page-size-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.pagination-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.pagination-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.pagination-info .current-range {
    font-weight: 600;
    color: #111827;
}

.pagination-info .total-count {
    color: #6b7280;
}

/* 데이터 없음 */
.no-data {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.no-data i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.no-data p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    color: #374151;
}

.no-data small {
    font-size: 0.875rem;
    color: #6b7280;
}

/* 커스텀 모달 스타일 */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.custom-modal.show .modal-content {
    transform: scale(1);
}

/* widen ad detail modal for 2-column tools */
#adDetailModal .modal-content {
    max-width: 1060px;
    width: 95%;
}

/* ===== Flat cleanup: remove glow/shadows site-wide on this page ===== */
.ad-management-page .btn,
.ad-management-page .btn:hover,
.ad-management-page .action-btn,
.ad-management-page .action-btn:hover,
.ad-management-page .pagination-btn,
.ad-management-page .pagination-btn:hover,
#btnShortenLink,
#btnShortenLink:hover,
.modal-footer .btn,
.modal-footer .btn:hover {
    box-shadow: none !important;
    transform: none !important;
}

.ad-management-page .filter-select:focus,
.ad-management-page .date-input:focus,
.ad-management-page .form-input:focus,
.ad-management-page .form-select:focus,
.ad-management-page .page-size-select:focus {
    box-shadow: none !important;
    border-color: #2563eb;
}

.ad-management-page .filter-section,
.ad-management-page .table-container,
.ad-management-page .tab-navigation,
.ad-management-page .pagination-container {
    box-shadow: none !important;
}

#adDetailModal .modal-content {
    box-shadow: none !important;
}

/* Merchant and general inputs: full width */
#merchantName { width: 100%; }
#adDetailModal .edit-form .form-group > .form-input,
#adDetailModal .edit-form .form-group > .form-select { width: 100%; }

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.modal-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-header h3 i {
    margin-right: 0.5rem;
    color: #3b82f6;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.form-group label i {
    color: #6b7280;
    width: 16px;
}

.form-input,
.form-select {
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-select {
    cursor: pointer;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: #f9fafb;
}

.modal-footer .btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal-footer .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.modal-footer .btn-secondary:hover {
    background: #e5e7eb;
}

.modal-footer .btn-primary {
    background: #3b82f6;
    color: white;
}

.modal-footer .btn-primary:hover {
    background: #2563eb;
}

/* Shorten button - always show primary blue color */
#btnShortenLink {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border: none;
}

#btnShortenLink:hover {
    background: #2563eb !important;
}

/* Remove glow/outline around primary buttons in modal */
.modal-footer .btn-primary,
#btnShortenLink {
    outline: none !important;
    box-shadow: none !important;
}

.modal-footer .btn-primary:focus,
.modal-footer .btn-primary:active,
#btnShortenLink:focus,
#btnShortenLink:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Short link input should expand in the inline flex row */
#shortLink {
    flex: 0 0 50% !important;
    width: 50% !important;
    min-width: 0 !important;
}

/* Match deep link button size with short link button */
#btnDeepLink {
    border: none !important;
}

/* In link tools row, let inputs expand to available space */
#adDetailModal .input-inline input#shortLink {
    flex: 0 0 50% !important;
    width: 50% !important;
    min-width: 220px !important;
}

#adDetailModal .input-inline .btn {
    padding: 0.5rem 0.9rem;
    min-width: 92px;
}

/* Ensure both 변환/복사 버튼 항상 보이도록 3열 그리드 구성 */
#adDetailModal .link-tools-row .input-inline {
    display: grid !important;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
}

#adDetailModal .link-tools-row .input-inline input#shortLink,
#adDetailModal .link-tools-row .input-inline input#deepLink,
#mobileAdDetailModal .link-tools-row .input-inline input#mobileShortLink,
#mobileAdDetailModal .link-tools-row .input-inline input#mobileDeepLink {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Copy buttons must not be transparent */
#adDetailModal .link-tools-row .input-inline .btn-secondary {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

#adDetailModal .link-tools-row .input-inline .btn-secondary:hover {
    background: #e5e7eb !important;
    color: #111827 !important;
    border-color: #cbd5e1 !important;
}

@media (max-width: 560px) {
    #adDetailModal .link-tools-row .input-inline,
    #mobileAdDetailModal .link-tools-row .input-inline {
        grid-template-columns: 1fr auto; /* 복사 버튼이 다음 줄로 내려가도 보이도록 */
        grid-auto-rows: min-content;
    }
}

#adDetailModal .input-inline .btn {
    min-width: 92px;
}

/* Make deep link input wider */
#deepLink {
    flex: 2 1 70% !important;
    width: 70% !important;
    min-width: 240px !important;
}

/* Modal form inputs width 50% by default */
#adDetailModal .edit-form .form-group > .form-input,
#adDetailModal .edit-form .form-group > .form-select { width: 100%; }

/* Force primary buttons to be blue on this page (not white) */
.ad-management-page .btn-primary {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

.ad-management-page .btn-primary:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

/* Success style for deep link button */
.ad-management-page .btn-success,
#btnDeepLink {
    background: #10b981 !important; /* emerald */
    color: #ffffff !important;
    border-color: #10b981 !important;
}

.ad-management-page .btn-success:hover,
#btnDeepLink:hover {
    background: #059669 !important;
    border-color: #059669 !important;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .main-container {
        padding: 0.5rem !important;
    }
    
    .filter-section {
        padding: 1.5rem;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .ad-management-page .btn:not(.btn-logout):not(.btn-login):not(.btn-register) {
        width: 100%;
        justify-content: center;
        min-width: auto;
    }
    
    .tab-link {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .stats-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ad-table th,
    .ad-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .pagination-info {
        justify-content: center;
    }
    
    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
}
