* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    font-size: 13px;
    line-height: 1.4;
}

.ads-manager {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

.side-nav {
    width: 56px;
    background: #fff;
    border-right: 1px solid #dddfe2;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease;
}

.side-nav:hover {
    width: 220px;
}

.side-nav.collapsed {
    width: 0;
    overflow: hidden;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #dddfe2;
    font-weight: 600;
    color: #1877f2;
    white-space: nowrap;
}

.nav-header span {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.side-nav:hover .nav-header span {
    opacity: 1;
}

.nav-section {
    padding: 12px 0;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #65676b;
    text-transform: uppercase;
    padding: 8px 16px 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, height 0.2s ease;
}

.side-nav:hover .nav-section-title {
    opacity: 1;
    height: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #1c1e21;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    white-space: nowrap;
}

.nav-item span:not(.nav-icon) {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.side-nav:hover .nav-item span:not(.nav-icon) {
    opacity: 1;
}

.nav-item:hover {
    background: #f0f2f5;
}

.nav-item.active {
    background: #e7f3ff;
    color: #1877f2;
    font-weight: 500;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    min-width: 20px;
    text-align: center;
}

.main-content {
    margin-left: 56px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

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

.nav-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: #65676b;
    display: none;
}

@media (max-width: 768px) {
    .side-nav {
        width: 0;
        overflow: hidden;
    }
    .side-nav.show {
        width: 220px;
    }
    .main-content {
        margin-left: 0;
    }
    .nav-toggle {
        display: block;
    }
}

.top-header {
    background: #fff;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dddfe2;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
}

.app-title {
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
    margin: 0;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #dddfe2;
    margin: 0 8px;
}

.account-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f2f5;
    padding: 4px;
    border-radius: 8px;
}

.account-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #65676b;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.account-tab:hover {
    background: rgba(0,0,0,0.05);
    color: #1c1e21;
}

.account-tab.active {
    background: #fff;
    color: #1877f2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: #65676b;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #f0f2f5;
    color: #1877f2;
    border-color: #1877f2;
}

.refresh-btn.spinning svg {
    animation: spin 0.8s ease-in-out;
}

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

.date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #1c1e21;
}

.date-picker:hover {
    background: #f7f8fa;
}

.date-range-detail {
    color: #65676b;
    font-size: 12px;
    margin-left: 4px;
}

.date-range-detail::before {
    content: '：';
}

.date-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 199;
    display: none;
}

.date-modal-overlay.show {
    display: block;
}

.date-modal {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border: 1px solid #dddfe2;
    display: none;
    z-index: 200;
    width: 680px;
}

.date-modal.show {
    display: block;
}

.date-modal-content {
    display: flex;
    padding: 0;
}

.date-presets {
    width: 180px;
    border-right: 1px solid #dddfe2;
    padding: 16px 0;
    max-height: 400px;
    overflow-y: auto;
}

.preset-section-title {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #65676b;
    text-transform: uppercase;
}

.date-preset {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #1c1e21;
    transition: background 0.15s;
}

.date-preset:hover {
    background: #f7f8fa;
}

.date-preset.active {
    color: #1877f2;
    font-weight: 500;
}

.preset-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #bcc0c4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.date-preset.active .preset-radio {
    border-color: #1877f2;
}

.date-preset.active .preset-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #1877f2;
    border-radius: 50%;
}

.date-calendars {
    display: flex;
    gap: 24px;
    padding: 20px;
}

.calendar-container {
    flex: 1;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cal-month-year {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-month-year select {
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #1c1e21;
    cursor: pointer;
    padding: 4px;
}

.cal-month-year select:hover {
    color: #1877f2;
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: #65676b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-nav-btn:hover {
    background: #f7f8fa;
    color: #1877f2;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #65676b;
    padding: 8px 0;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    border-radius: 50%;
    color: #1c1e21;
    transition: all 0.15s;
}

.cal-day:hover:not(.empty):not(.disabled) {
    background: #e7f3ff;
}

.cal-day.empty {
    cursor: default;
}

.cal-day.disabled {
    color: #bcc0c4;
    cursor: not-allowed;
}

.cal-day.today {
    color: #1877f2;
    font-weight: 600;
}

.cal-day.in-range {
    background: #e7f3ff;
    border-radius: 0;
}

.cal-day.range-start {
    background: #1877f2;
    color: #fff;
    border-radius: 50% 0 0 50%;
}

.cal-day.range-end {
    background: #1877f2;
    color: #fff;
    border-radius: 0 50% 50% 0;
}

.cal-day.range-start.range-end {
    border-radius: 50%;
}

.date-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid #dddfe2;
    background: #f7f8fa;
    border-radius: 0 0 8px 8px;
}

.selected-date-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #65676b;
}

.date-display {
    background: #fff;
    border: 1px solid #dddfe2;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    color: #1c1e21;
    min-width: 110px;
    text-align: center;
}

.date-separator {
    color: #65676b;
}

.date-modal-actions {
    display: flex;
    gap: 12px;
}

.btn-cancel {
    padding: 8px 20px;
    border: 1px solid #dddfe2;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #1c1e21;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #f7f8fa;
}

.btn-update {
    padding: 8px 24px;
    border: none;
    background: #1877f2;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
}

.btn-update:hover {
    background: #166fe5;
}

.toolbar {
    background: #fff;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dddfe2;
    gap: 0;
}

.toolbar-actions {
    margin-left: auto;
}

.view-tabs {
    display: flex;
    gap: 0;
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #65676b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.view-tab:hover {
    color: #1877f2;
    background: #f7f8fa;
}

.view-tab.active {
    color: #1877f2;
    border-bottom-color: #1877f2;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1877f2;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
}

.badge-text {
    white-space: nowrap;
}

.badge-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.badge-clear:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tab-icon {
    font-size: 14px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-container {
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #dddfe2;
    border-radius: 20px;
    background: #f0f2f5;
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 13px;
    width: 200px;
    outline: none;
}

.search-clear {
    cursor: pointer;
    color: #65676b;
    font-size: 12px;
    padding: 2px 4px;
}

.search-clear:hover {
    color: #1c1e21;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 200;
    min-width: 280px;
    display: none;
}

.search-dropdown.show {
    display: block;
}

.search-section {
    padding: 8px 0;
    border-bottom: 1px solid #e4e6eb;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-title {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #65676b;
    text-transform: uppercase;
}

.search-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-option:hover {
    background: #f7f8fa;
}

.search-option.active {
    background: #e7f3ff;
}

.option-icon {
    font-size: 16px;
}

.option-text {
    font-weight: 500;
    color: #1c1e21;
    flex: 1;
}

.option-desc {
    font-size: 12px;
    color: #65676b;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: #f7f8fa;
}

.result-type {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.result-type.campaign {
    background: #e7f3ff;
    color: #1877f2;
}

.result-type.adset {
    background: #fff3e0;
    color: #e65100;
}

.result-type.ad {
    background: #e8f5e9;
    color: #2e7d32;
}

.result-name {
    flex: 1;
    font-size: 13px;
    color: #1c1e21;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-id {
    font-size: 11px;
    color: #65676b;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #65676b;
    cursor: pointer;
}

.filter-checkbox input {
    cursor: pointer;
}

.refresh-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: #166fe5;
}

.refresh-btn:disabled {
    background: #bcc0c4;
    cursor: not-allowed;
}

.refresh-btn .refresh-icon {
    font-size: 14px;
    transition: transform 0.3s;
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

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

.last-updated {
    font-size: 12px;
    color: #65676b;
}

.selected-summary {
    background: #e7f3ff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #c2dbf7;
}

.summary-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.selected-count {
    font-size: 13px;
    color: #1877f2;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-link {
    opacity: 0;
    font-size: 11px;
    color: #1877f2;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e7f3ff;
}

.meta-link:hover {
    text-decoration: underline;
    background: #d0e8ff;
}

tr:hover .meta-link {
    opacity: 1;
}

.summary-metrics {
    display: flex;
    gap: 24px;
}

.metric {
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 11px;
    color: #65676b;
    margin-bottom: 2px;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #1c1e21;
}

.metric.highlight .metric-value {
    color: #1877f2;
}

.data-container {
    flex: 1;
    background: #fff;
    position: relative;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #1c1e21;
    font-weight: 500;
}

.loading-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #65676b;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e4e6eb;
    border-top-color: #1877f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e4e6eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: #f7f8fa;
    font-weight: 600;
    font-size: 12px;
    color: #65676b;
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 1px solid #e4e6eb;
    overflow: visible;
}

.data-table th:last-child {
    border-right: none;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background: #e4e6eb;
}

.data-table th.sorted {
    color: #1877f2;
    background: #e7f3ff;
}

.sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    color: #8a8d91;
    vertical-align: middle;
}

.data-table th.sorted .sort-icon {
    color: #1877f2;
    font-weight: 700;
}

.data-table th .th-content {
    display: inline;
    position: relative;
}

.data-table th.highlight-col {
    background: #e7f3ff;
}

.data-table td {
    border-right: 1px solid #f0f2f5;
}

.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr:hover {
    background: #f7f8fa;
}

.data-table tbody tr.selected {
    background: #e7f3ff;
}

.col-checkbox {
    width: 40px;
    text-align: center !important;
}


.col-name {
    min-width: 280px;
    width: 280px;
}

.col-status {
    width: 90px;
    text-align: center !important;
}

.col-number {
    min-width: 90px;
    text-align: right !important;
}

.col-number .th-content {
    display: block;
    text-align: center;
}

.row-checkbox {
    cursor: pointer;
}

.toggle-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    color: #65676b;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    background: #e4e6eb;
}

.toggle-btn.expanded {
    transform: rotate(90deg);
}

.item-name {
    font-weight: 500;
    color: #1c1e21;
    cursor: pointer;
}

.item-name:hover {
    color: #1877f2;
    text-decoration: underline;
}

.item-id {
    font-size: 11px;
    color: #8a8d91;
    margin-top: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.active {
    background: #e6f4ea;
    color: #137333;
}

.status-badge.paused {
    background: #fef7e0;
    color: #b06000;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.active {
    background: #42b72a;
}

.status-dot.paused {
    background: #f7b928;
}

.status-badge.deleted {
    background: #fce8e6;
    color: #c5221f;
}

.status-dot.deleted {
    background: #ea4335;
}

.status-badge.archived {
    background: #e8eaed;
    color: #5f6368;
}

.status-dot.archived {
    background: #9aa0a6;
}

.number-cell {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: #1c1e21;
    overflow: visible !important;
    text-overflow: clip !important;
}

.total-row {
    background: linear-gradient(to right, #e7f3ff, #f0f7ff) !important;
    border-bottom: 2px solid #1877f2 !important;
    position: sticky;
    top: 36px;
    z-index: 5;
}

.total-row:hover {
    background: linear-gradient(to right, #d4e9ff, #e7f3ff) !important;
}

.total-row .total-label {
    font-weight: 600;
    color: #1877f2;
    font-size: 13px;
}

.total-row .total-value {
    font-weight: 700;
    color: #1c1e21;
    font-size: 14px;
}

.total-row .total-value.highlight {
    color: #1877f2;
}

.number-cell.highlight {
    font-weight: 600;
    color: #1877f2;
}

.child-row {
    background: #f7f8fa;
}

.child-row:hover {
    background: #eef1f4 !important;
}

.grandchild-row {
    background: #f0f2f5;
}

.grandchild-row:hover {
    background: #e4e6eb !important;
}

.tree-line {
    color: #1877f2;
    font-family: monospace;
    font-weight: bold;
    margin-right: 4px;
}

.tree-line.level-2 {
    color: #65676b;
    margin-left: 20px;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #65676b;
}

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 12px rgba(0,0,0,0.15);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #dddfe2;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-panel {
    width: 32px;
    height: 32px;
    border: none;
    background: #e4e6eb;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel:hover {
    background: #d8dadf;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #65676b;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f5;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: #65676b;
}

.detail-value {
    font-weight: 500;
    color: #1c1e21;
}

@media (max-width: 1200px) {
    .col-name {
        min-width: 200px;
        width: 200px;
    }
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box input {
        width: 120px;
    }
}

.has-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: default;
}

.tooltip-icon {
    font-size: 11px;
    color: #65676b;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.has-tooltip:hover .tooltip-icon {
    opacity: 1;
    color: #1877f2;
}

.meta-tooltip {
    position: fixed;
    width: 320px;
    max-width: 320px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 16px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    text-align: left;
    pointer-events: auto;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.meta-tooltip:hover {
    opacity: 1;
    visibility: visible;
}

.meta-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #fff;
}

.tooltip-title {
    font-size: 15px;
    font-weight: 600;
    color: #1c1e21;
    margin-bottom: 8px;
}

.tooltip-body {
    font-size: 13px;
    color: #65676b;
    line-height: 1.5;
    margin-bottom: 12px;
    white-space: normal;
    word-wrap: break-word;
}

.tooltip-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #65676b;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
    white-space: normal;
    word-wrap: break-word;
}

.tooltip-note .note-icon {
    color: #1877f2;
    flex-shrink: 0;
}

.tooltip-link {
    color: #1877f2;
    text-decoration: none;
    font-weight: 500;
}

.tooltip-link:hover {
    text-decoration: underline;
}

.attribution-summary {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e4e6eb;
    flex-wrap: wrap;
}

.attribution-card {
    flex: 1;
    min-width: 120px;
    max-width: 180px;
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.attribution-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.attribution-card.highlight {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    border: 1px solid #1877f2;
}

.attr-label {
    font-size: 11px;
    color: #65676b;
    margin-bottom: 4px;
    font-weight: 500;
}

.attr-value {
    font-size: 18px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 2px;
}

.attribution-card.highlight .attr-value {
    color: #1877f2;
}

.attr-sublabel {
    font-size: 10px;
    color: #8a8d91;
}

@media (max-width: 900px) {
    .attribution-summary {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .attribution-card {
        min-width: 100px;
        padding: 8px 12px;
    }
    
    .attr-value {
        font-size: 16px;
    }
}

/* Help Panel (Right Slide) - Meta Style */
.help-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.help-panel-overlay.active {
    display: block;
}

.help-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.help-panel.active {
    right: 0;
}

.help-panel-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dddfe2;
    background: #fff;
}

.help-panel-back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
    color: #65676b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-panel-back:hover {
    color: #1877f2;
}

.help-panel-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
}

.help-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #65676b;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.help-panel-close:hover {
    color: #1c1e21;
}

.help-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

.help-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 16px;
}

.help-info-box {
    display: flex;
    gap: 12px;
    background: #e7f3ff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.help-info-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.help-info-box p {
    font-size: 14px;
    line-height: 1.5;
    color: #1c1e21;
    margin: 0;
}

.help-subsection-title {
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
    margin: 24px 0 12px 0;
}

.help-text {
    font-size: 14px;
    line-height: 1.6;
    color: #1c1e21;
    margin-bottom: 12px;
}

.help-list {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.help-list li {
    font-size: 14px;
    line-height: 1.8;
    color: #1c1e21;
    margin-bottom: 8px;
}

.help-list li strong {
    color: #1877f2;
}

/* Tooltip enhancements */
.meta-tooltip-wide {
    min-width: 280px;
}

.tooltip-link {
    color: #1877f2;
    font-size: 12px;
    margin-top: 8px;
    cursor: pointer;
    display: inline-block;
}

.tooltip-link:hover {
    text-decoration: underline;
}

@media (max-width: 500px) {
    .help-panel {
        width: 100%;
        right: -100%;
    }
}
