/* Toomics CS Dashboard — BizOPS Design System — Light mode only */

/* Screen-reader only — visually hidden but accessible */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── WCAG AA Focus Indicators ── */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
/* Dark backgrounds need light focus ring */
.header :focus-visible,
.mobile-sidebar :focus-visible {
    outline-color: #93C5FD;
}
/* Skip-to-content link — visible only on focus */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: top var(--transition);
}
.skip-link:focus {
    top: 8px;
}
/* Restore visible outlines for keyboard users on elements that suppress outline */
.filters select:focus-visible,
.filters input:focus-visible,
.platform-lang-select:focus-visible,
.detail-actions-bar select:focus-visible,
#compose-text:focus-visible,
.no-match-select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* Canonical tokens from design-tokens.css — keep in sync with DESIGN.md §2 */
:root {
    --color-primary: #2563EB;
    --color-primary-dark: #1E3A8A;
    --color-primary-light: #EFF6FF;
    --color-secondary: #3B82F6;
    --color-cta: #F59E0B;
    --color-cta-hover: #D97706;
    --color-bg: #F8FAFC;
    --color-card: #FFFFFF;
    --color-surface: #FFFFFF;
    --color-muted: #F1F5F9;
    --color-text: #0F172A;
    --color-text-muted: #475569;
    --color-text-subtle: #94A3B8;
    --color-border: #E2E8F0;
    --color-border-strong: #CBD5E1;
    --color-border-light: #F1F5F9;
    --color-success: #10B981;
    --color-success-light: #D1FAE5;
    --color-danger: #EF4444;
    --color-danger-light: #FEE2E2;
    --color-warning: #F59E0B;
    --color-warning-light: #FEF3C7;
    --color-info: #0EA5E9;
    --color-info-light: #EFF6FF;
    --color-purple: #7C3AED;
    --color-cyan: #06B6D4;
    --font-heading: 'Fira Code', 'Malgun Gothic', 'Noto Sans KR', monospace;
    --font-body: 'Fira Sans', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 20px;
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-brand: 0 4px 12px rgba(37, 99, 235, 0.3);
    --transition: 200ms ease;
    --transition-smooth: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 52px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: 60px; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    padding-top: 52px;
}

/* ── Login ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}

.login-card {
    background: var(--color-card);
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 360px;
    text-align: center;
}

.login-logo {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.login-card h2 {
    font-family: var(--font-body);
    color: var(--color-text-muted);
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color var(--transition);
}

.login-card input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,0.08);
}
.login-card input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.error-msg {
    color: var(--color-danger-text);
    font-size: 13px;
    margin-top: 8px;
}

/* ── Header (Navbar) ── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--color-primary-dark);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.logo {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    margin: 0;
    line-height: 1.2;
}

h1.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title {
    font-family: var(--font-heading);
    color: rgba(255,255,255,0.78);
    font-size: 13px;
    font-weight: 500;
}

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

.last-updated {
    font-family: var(--font-body);
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    font-weight: 400;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.82);
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform 0.6s ease;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.btn-icon.spin {
    animation: spin-once 0.6s ease;
}

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

.user-badge {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

/* ── KPI Strip ── */
.kpi-strip {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    max-width: 1080px;
    margin: 0 auto;
}

.kpi-card {
    flex: 1;
    background: var(--color-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    border-top: 3px solid transparent;
    box-shadow: var(--shadow-sm);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.kpi-card:hover, .kpi-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(30,64,175,0.08);
}

/* KPI active state — when a card is selected as filter */
.kpi-strip.has-active .kpi-card { opacity: 0.5; }
.kpi-strip.has-active .kpi-card.kpi-active { opacity: 1; }

.kpi-card.kpi-active[data-status="new"]         { border-color: var(--color-secondary); box-shadow: 0 4px 16px rgba(59,130,246,0.15); }
.kpi-card.kpi-active[data-status="open"]        { border-color: var(--color-warning); box-shadow: 0 4px 16px rgba(245,158,11,0.15); }
.kpi-card.kpi-active[data-status="pending"]     { border-color: var(--color-purple); box-shadow: 0 4px 16px rgba(139,92,246,0.15); }
.kpi-card.kpi-active[data-status="in_progress"] { border-color: var(--color-cyan); box-shadow: 0 4px 16px rgba(6,182,212,0.15); }
.kpi-card.kpi-active[data-status="solved"]      { border-color: var(--color-success); box-shadow: 0 4px 16px rgba(16,185,129,0.15); }

.kpi-card[data-status="new"]         { border-top-color: var(--color-secondary); }
.kpi-card[data-status="open"]        { border-top-color: var(--color-warning); }
.kpi-card[data-status="pending"]     { border-top-color: var(--color-purple); }
.kpi-card[data-status="in_progress"] { border-top-color: var(--color-cyan); }
.kpi-card[data-status="solved"]      { border-top-color: var(--color-success); }
.kpi-card[data-status="weekly"]      { border-top-color: #f97316; }
.kpi-card.kpi-active[data-status="weekly"] { border-color: #f97316; box-shadow: 0 4px 16px rgba(249,115,22,0.15); }
.kpi-card[data-status="refund_open"]      { border-top-color: #EA580C; }
.kpi-card.kpi-active[data-status="refund_open"] { border-color: #EA580C; box-shadow: 0 4px 16px rgba(234,88,12,0.15); }
.kpi-refund-open .kpi-label { color: #EA580C; font-weight: 600; }
.kpi-overdue-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 8px; margin-left: 4px; background: #FEE2E2; color: #991B1B; vertical-align: super; }
.kpi-refund-open.has-overdue { animation: pulse-refund 2s ease-in-out infinite; }
@keyframes pulse-refund { 0%, 100% { box-shadow: var(--shadow-sm); } 50% { box-shadow: 0 0 12px rgba(234,88,12,0.3); } }
.aging-ok { background: #DCFCE7; color: #166534; }
.aging-warning { background: #FEF3C7; color: #92400E; }
.aging-overdue { background: #FEE2E2; color: #991B1B; font-weight: 700; }

.kpi-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.kpi-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ── Filters ── */
.filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    max-width: calc(1080px - 48px);
    margin: 0 auto 16px;
    background: #F8F9FA;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    box-sizing: border-box;
}
.filters .filter-row-1,
.filters .filter-row-2 {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}
.filters .filter-row-1 select {
    flex: 1;
    min-width: 0;
}
.filters .filter-row-1 .filter-market-group {
    flex: 1.2;
    min-width: 0;
}
.filters .filter-row-1 .filter-market-group select {
    width: 100%;
}
.filters .filter-row-2 .date-group {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 0 8px;
    height: 34px;
    flex: none;
}
.filters .filter-row-2 .date-group input[type="date"] {
    border: none;
    background: transparent;
    height: 32px;
    padding: 4px 2px;
    width: 112px;
    font-size: 12px;
    color: var(--color-text);
}
.filters .filter-row-2 .date-group input[type="date"]:focus { outline: none; }
.filters .filter-row-2 .date-group .date-separator {
    color: #9CA3AF;
    font-size: 13px;
    margin: 0 4px;
}
.filters .filter-row-2 input[type="text"] {
    flex: none;
    width: 110px;
}
.filter-ticket-count {
    flex: 1;
    text-align: right;
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
}
.filter-ticket-count strong { color: #4F46E5; font-weight: 700; }
.btn-refresh {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex: none;
    cursor: pointer;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #fff;
    transition: all 0.15s;
}
.btn-refresh:hover { background: #F3F4F6; border-color: #9CA3AF; }
.filters .filter-row-2 .btn-sort {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex: none;
}

.filters select, .filters input {
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 13px;
    background: #fff;
    color: var(--color-text);
    transition: all 0.15s;
}

.filters select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    font-size: 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.filters input[type="text"] { flex: 1; min-width: 120px; font-size: 13px; }
.filters input[type="date"] { width: 120px; min-width: auto; flex: none; font-size: 12px; }
.filters .date-separator { color: #94A3B8; font-size: 14px; flex: none; font-weight: 500; }
.filters select:hover, .filters input:hover { border-color: #9CA3AF; }
.filters select:focus, .filters input:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 0 3px rgba(30,64,175,0.06);
}

/* ── Main Layout ── */
.main-content {
    display: flex;
    gap: 0;
    align-items: start;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 24px;
    min-height: 0;
}

.panel {
    background: var(--color-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.panel-list {
    flex: 0 0 30%;
    min-width: 250px;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
    align-self: start;
}

.panel-detail {
    flex: 1 1 0;
    min-width: 400px;
    overflow: visible;
}

/* ── Panel Resizer ── */
.panel-resizer {
    flex: 0 0 4px;
    align-self: stretch;
    cursor: col-resize;
    background: transparent;
    position: relative;
    z-index: 10;
    transition: background var(--transition);
}

.panel-resizer::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 32px;
    background: var(--color-border);
    border-radius: 1px;
    transition: height var(--transition), background var(--transition);
}

.panel-resizer:hover { background: rgba(30,64,175,0.04); }
.panel-resizer:hover::after { height: 48px; background: var(--color-primary); }
.panel-resizer.dragging { background: rgba(30,64,175,0.06); }
.panel-resizer.dragging::after { height: 64px; background: var(--color-primary); }

/* ── Ticket List ── */
.ticket-list {
    overflow-y: auto;
}

.ticket-item {
    padding: 12px 16px;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background var(--transition);
}

.ticket-item:hover { background: #F8FAFC; cursor: pointer; }
.ticket-item.active {
    background: #EFF6FF;
    border-left: 3px solid var(--color-primary);
}

.ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.ticket-id {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-primary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.ticket-subject {
    font-family: var(--font-body);
    font-weight: 500;
    margin-bottom: 2px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-new         { background: #DBEAFE; color: #1E40AF; } /* 7.1:1 */
.badge-in-progress { background: #ECFEFF; color: #0A5568; } /* 5.8:1 */
.badge-open        { background: #FEF3C7; color: #78350F; } /* 5.5:1 */
.badge-pending     { background: #EDE9FE; color: #4C1D95; } /* 5.2:1 */
.badge-solved      { background: #D1FAE5; color: #064E3B; } /* 5.6:1 */
.badge-refund-open { background: #FFF7ED; color: #EA580C; font-weight: 700; border: 1px solid #FED7AA; }
.badge-refund-open-detail { background: #FFF7ED; color: #C2410C; font-weight: 700; margin-left: 6px; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.badge-market      { background: #F1F5F9; color: #334155; border: 1px solid var(--color-border); }
.badge-plang       { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; font-size: 10px; }
.lang-pick.active  { background: #4F46E5; color: #fff; border-color: #4F46E5; }
@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); }
    50% { box-shadow: 0 0 0 8px rgba(59,130,246,0.2); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
.ticket-ref        { color: #4F46E5; font-weight: 600; text-decoration: none; cursor: pointer; }
.ticket-ref:hover  { text-decoration: underline; color: #3730A3; }
.badge-category    { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; } /* 5.0:1 */
.badge-auto-responded {
    background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0;
    font-weight: 700; font-size: 9px; letter-spacing: 0.5px;
    padding: 1px 5px; border-radius: 4px; margin-right: 4px;
}

/* Auto-response info banner in ticket detail */
.auto-response-info {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; margin: 0 0 8px;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border: 1px solid #A7F3D0; border-radius: 8px;
    font-size: 12px; color: #064E3B; font-weight: 500; /* 6.2:1 on gradient */
}
.ar-icon { font-size: 14px; }
.ar-text { flex: 1; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    border-top: 1px solid var(--color-border);
}

.pagination button {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card);
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.pagination button:hover {
    background: var(--color-bg);
    border-color: #CBD5E1;
}

.pagination button.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ── Chart Overview (right panel, no ticket selected) ── */
.chart-overview {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

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

.chart-overview-header h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
}

.chart-total-badge {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
}

.chart-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
}

.chart-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.chart-card h4 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    letter-spacing: 0.3px;
}

.chart-canvas-wrap {
    position: relative;
    max-width: 100%;
    cursor: pointer;
}

.chart-canvas-bar {
    height: 280px;
}

.chart-canvas-aging {
    height: 220px;
}

.chart-card-market {
    padding: 12px;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chart-card-header h4 {
    margin-bottom: 0;
}

.market-toggle {
    display: flex;
    background: #F1F5F9;
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.market-toggle .toggle-btn {
    padding: 3px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.market-toggle .toggle-btn:hover {
    color: #334155;
}

.market-toggle .toggle-btn.active {
    background: #FFFFFF;
    color: #2563EB;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ── Market Donut: donut left + table right ── */
.market-layout {
    display: flex;
    gap: 12px;
    align-items: center;
}

.market-donut-wrap {
    flex: 0 0 55%;
    height: 200px;
    position: relative;
    cursor: pointer;
}

.market-table-wrap {
    flex: 1;
    min-width: 0;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 11px;
}

.market-table tr {
    border-bottom: 1px solid var(--color-border);
}

.market-table tr:last-child {
    border-bottom: none;
}

.market-table td {
    padding: 3px 0;
    vertical-align: middle;
}

.market-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.market-code {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12px;
    color: var(--color-text);
    min-width: 32px;
    display: inline-block;
}

.market-count {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.market-pct {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: right;
    min-width: 48px;
}

/* ── Timeline ── */
.timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 0;
    margin-bottom: 8px;
    overflow-x: auto;
}

.timeline-step {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent;
    border: 2.5px solid var(--color-border);
}

.timeline-dot.status-created  { border-color: var(--color-info); }
.timeline-dot.status-new      { border-color: var(--color-info); }
.timeline-dot.status-open     { border-color: var(--color-warning); }
.timeline-dot.status-pending  { border-color: var(--color-purple); }
.timeline-dot.status-solved   { border-color: var(--color-success); }
.timeline-dot.status-closed   { border-color: var(--color-text-muted); }
.timeline-dot.status-hold     { border-color: #F97316; }

/* Only the current (last) timeline node is filled */
.timeline-step:last-child .timeline-dot.status-created  { background: var(--color-info); }
.timeline-step:last-child .timeline-dot.status-new      { background: var(--color-info); }
.timeline-step:last-child .timeline-dot.status-open     { background: var(--color-warning); }
.timeline-step:last-child .timeline-dot.status-pending  { background: var(--color-purple); }
.timeline-step:last-child .timeline-dot.status-solved   { background: var(--color-success); }
.timeline-step:last-child .timeline-dot.status-closed   { background: var(--color-text-muted); }
.timeline-step:last-child .timeline-dot.status-hold     { background: #F97316; }

.timeline-label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text);
    white-space: nowrap;
}

.timeline-time {
    font-size: 9px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.timeline-line {
    width: 24px;
    height: 2px;
    background: var(--color-border);
    flex-shrink: 0;
}

/* ── Escalate button — outline danger style ── */
.btn-escalate {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger-text);
}
.btn-escalate:hover {
    background: #FEF2F2;
}

/* ── Detail Panel ── */
.placeholder-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    font-size: 15px;
}

#ticket-detail {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.detail-ticket-id {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}
.detail-header h2 {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ── Customer Profile ── */
.customer-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F8FAFC;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.customer-profile:hover {
    background: #EFF6FF;
}

.customer-avatar {
    font-size: 20px;
    line-height: 1;
}

/* Related tickets */
.related-tickets {
    margin: 0 0 12px;
    max-height: 200px;
    overflow-y: auto;
}
.related-tickets:empty { display: none; }
.related-header {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    padding: 6px 0 4px;
    border-bottom: 1px solid #E2E8F0;
    margin-bottom: 4px;
}
.related-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.related-item:hover { background: #F1F5F9; }
.related-id { color: var(--color-primary); font-weight: 600; min-width: 60px; }
.related-status {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}
.related-status.badge-new { background: #DBEAFE; color: #1D4ED8; }
.related-status.badge-open { background: #FEF3C7; color: #B45309; }
.related-status.badge-pending { background: #E0E7FF; color: #4338CA; }
.related-status.badge-solved { background: #D1FAE5; color: #065F46; }
.related-status.badge-closed { background: #F3F4F6; color: #6B7280; }
.related-subject { flex: 1; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-date { color: #94A3B8; font-size: 11px; flex: none; }

/* Merge */
.btn-merge-select {
    float: right;
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s;
}
.btn-merge-select:hover, .btn-merge-select.active {
    background: #4F46E5;
    color: #fff;
    border-color: #4F46E5;
}
.merge-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    background: #FEF3C7;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}
.merge-info { color: #92400E; flex: 1; }
.merge-check { width: 16px; height: 16px; cursor: pointer; flex: none; margin-right: -4px; }
.btn-danger { background: #DC2626; color: #fff; border: none; border-radius: 6px; font-size: 11px; cursor: pointer; padding: 4px 10px; }
.btn-danger:hover { background: #B91C1C; }

.customer-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.customer-name {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.customer-email {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ── Platform Language Dropdown (in customer profile card) ── */
.customer-platform-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.platform-lang-label {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.platform-lang-select {
    font-family: var(--font-heading);
    font-size: 11px;
    padding: 2px 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    min-width: 48px;
}

.platform-lang-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.platform-lang-status {
    font-size: 12px;
    min-width: 14px;
    text-align: center;
}

.platform-lang-status.saved {
    color: var(--color-success-text);
    font-weight: 600;
}

.platform-lang-status.error {
    color: var(--color-danger-text);
    font-weight: 600;
}

.platform-lang-status.saving {
    color: var(--color-text-muted);
}

/* ── Market Filter Tab Group ── */
.filter-market-group {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.filter-market-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 4px;
}

.filter-tab {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #fff;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.3;
    white-space: nowrap;
}

.filter-tab:hover {
    background: #F1F5F9;
}

.filter-tab.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
}

/* ── Profile Modal ── */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-modal {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    position: relative;
}

.profile-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.profile-modal-close:hover {
    color: var(--color-text);
}

.profile-modal-title {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
}

.profile-table {
    width: 100%;
    border-collapse: collapse;
}

.profile-row td {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.profile-row:last-child td {
    border-bottom: none;
}

.profile-label {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-text-muted);
    width: 100px;
    white-space: nowrap;
}

.profile-value {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.profile-value.profile-mono {
    font-family: var(--font-heading);
}

.profile-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    margin-left: 6px;
    border-radius: 4px;
    vertical-align: middle;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.profile-copy-btn:hover {
    opacity: 1;
    background: var(--color-bg);
}

.profile-vip-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.profile-vip-badge.vip {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
}

.profile-vip-badge.normal {
    background: #F1F5F9;
    color: #64748B;
    border: 1px solid var(--color-border);
}

.profile-vip-badge.state {
    background: #EFF6FF;
    color: var(--color-primary);
    border: 1px solid var(--color-secondary);
}

.profile-admin-link {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.profile-admin-link:hover {
    text-decoration: underline;
}

.profile-admin-link.disabled {
    color: var(--color-text-subtle);
    font-weight: 400;
}

.detail-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.detail-actions-bar select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    transition: border-color var(--transition);
}

.detail-actions-bar select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ── Conversation ── */
.conversation {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.comment {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
}

.comment-customer {
    background: #EFF6FF;
    border-left: 3px solid var(--color-info);
}

.comment-agent {
    background: #F0FDF4;
    border-left: 3px solid var(--color-success);
}

.comment-internal {
    background: #FFFBEB;
    border-left: 3px solid var(--color-warning);
    font-style: italic;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 700;
    font-family: var(--font-body);
}

.comment-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    margin-top: 4px;
}

/* ── Quality Score 6-dimension ── */
.quality-breakdown {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding: 4px 0;
}

.quality-dim {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
}

.dim-label {
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--color-text-muted);
}

.dim-value {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
}

/* ── Quality Evaluation Card ── */
.quality-eval-card {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.eval-card-left {
    flex: 0 0 auto;
    text-align: center;
    min-width: 60px;
}

.eval-overall-score {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.eval-overall-label {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.eval-card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

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

.eval-dim-label {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-text-muted);
    min-width: 60px;
    flex-shrink: 0;
}

.eval-dim-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.eval-dim-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.eval-dim-value {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    min-width: 32px;
    text-align: right;
}

/* ── Compose Section ── */
/* ── Conversation Tabs (Replies / Internal Notes) ── */
.conv-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 0;
}
.conv-tab {
    flex: 1;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.conv-tab:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
}
.conv-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.conv-tab[data-conv="notes"].active {
    color: #92400E;
    border-bottom-color: #D97706;
}
.conv-tab-count {
    font-size: 10px;
    background: #E5E7EB;
    color: #6B7280;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 3px;
}
.conv-tab.active .conv-tab-count {
    background: var(--color-primary);
    color: #fff;
}
.conv-tab[data-conv="notes"].active .conv-tab-count {
    background: #D97706;
    color: #fff;
}

.compose-section {
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

/* ── Compose Mode Tabs (Reply / Internal Note) ── */
.compose-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--color-border);
}
.compose-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.compose-tab:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
}
.compose-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.compose-tab[data-mode="note"].active {
    color: #92400E;
    border-bottom-color: #D97706;
}

/* ── Note Mode ── */
.note-mode-banner {
    background: #FFFBEB;
    border: 1px solid #F59E0B;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #92400E;
    margin-bottom: 8px;
}
.note-editable {
    min-height: 80px;
    border-color: #F59E0B !important;
}
.note-editable:focus {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
    border-color: #D97706 !important;
}
.btn-note-send {
    border-color: #D97706 !important;
    color: #92400E !important;
}
.btn-note-send:hover {
    background: #FFFBEB !important;
}

.compose-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* ── Compose Toolbar ── */
.compose-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #F8FAFC;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

.toolbar-btn:hover {
    background: #E2E8F0;
    color: var(--color-text);
    border-color: var(--color-border);
}

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: var(--color-border);
    margin: 0 4px;
}

.toolbar-highlight-group {
    position: relative;
}

.toolbar-highlight-icon {
    font-size: 14px;
    background: linear-gradient(135deg, #FEF08A 25%, #BBF7D0 50%, #BFDBFE 75%, #FECACA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.toolbar-highlight-palette {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    padding: 4px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    gap: 4px;
    flex-direction: row;
    margin-top: 2px;
}

.toolbar-highlight-palette.open {
    display: flex;
}

.toolbar-color {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s;
}

.toolbar-color:hover {
    transform: scale(1.15);
    border-color: var(--color-text-muted);
}

.toolbar-color[data-color="#FEF08A"] { background: #FEF08A; }
.toolbar-color[data-color="#BBF7D0"] { background: #BBF7D0; }
.toolbar-color[data-color="#BFDBFE"] { background: #BFDBFE; }
.toolbar-color[data-color="#FECACA"] { background: #FECACA; }

.toolbar-color-none {
    background: #fff;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Compose Editable (contenteditable div replacing textarea) ── */
#compose-text {
    width: 100%;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    box-sizing: border-box;
    transition: border-color var(--transition);
    white-space: pre-wrap;
    word-wrap: break-word;
}

#compose-text:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-subtle);
    pointer-events: none;
}

#compose-text:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,0.06);
}

.quality-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s, background 0.3s;
}

.draft-sections {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ref-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.ref-manual { background: #EFF6FF; border: 1px solid #BFDBFE; }
.ref-cases  { background: #FFF7ED; border: 1px solid #FED7AA; }
.ref-icon   { font-size: 15px; flex-shrink: 0; }
.ref-label  {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    min-width: 72px;
}

.badge-manual {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    background: #DBEAFE;
    color: #2563EB;
}

.badge-case {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    background: #FFEDD5;
    color: #C2410C;
    font-family: var(--font-heading);
}

.compose-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 0 0;
    border-top: 1px solid var(--color-border);
}

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

.compose-actions-primary {
    /* Primary row: reply buttons + escalate, left-aligned */
}

.compose-actions-secondary {
    justify-content: flex-end;
    gap: 6px;
}

.compose-actions-secondary .btn {
    font-size: 11px;
    padding: 5px 8px;
}

.compose-actions-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.compose-actions-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border);
    flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

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

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1E3A8A; }

.btn-accent { background: var(--color-purple); color: #fff; }
.btn-accent:hover { background: #7C3AED; }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: var(--color-cta-hover); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger-text);
    font-weight: 600;
}
.btn-danger-outline:hover {
    background: var(--color-danger);
    color: #fff;
}


.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover { background: var(--color-bg); border-color: #CBD5E1; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Header buttons (on dark bg) */
.header .btn-outline {
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
}
.header .btn-outline:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}
.header .btn-portal {
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: #fff;
    background: rgba(245,158,11,0.25);
    text-decoration: none;
    font-weight: 600;
}
.header .btn-portal:hover {
    background: rgba(245,158,11,0.45);
    border-color: rgba(245,158,11,0.6);
}
.header .btn-ip-link {
    border: 1px solid rgba(16,185,129,0.5);
    border-radius: 6px;
    color: #047857;
    background: rgba(16,185,129,0.15);
    text-decoration: none;
    font-weight: 600;
}
.header .btn-ip-link:hover {
    background: rgba(16,185,129,0.35);
    border-color: rgba(16,185,129,0.7);
    color: #fff;
}
.header .btn-translate-link {
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: #fff;
    background: rgba(99,102,241,0.3);
    text-decoration: none;
    font-weight: 600;
}
.header .btn-translate-link:hover {
    background: rgba(99,102,241,0.5);
    border-color: rgba(99,102,241,0.6);
}

/* ── Spam Banner ── */
.spam-banner {
    margin-top: 12px;
    padding: 16px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid var(--color-danger);
    border-radius: var(--radius-sm);
}

.spam-banner-header {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: var(--color-danger-text);
    margin-bottom: 8px;
}

.spam-banner-body { font-size: 13px; color: #991B1B; margin-bottom: 12px; }
.spam-banner-body ul { margin: 6px 0 0 18px; }
.spam-banner-body li { margin-bottom: 2px; }
.spam-banner-actions { display: flex; gap: 8px; }

/* ── NO_MATCH Manual Scenario Selector ── */
.no-match-selector {
    margin: 12px 0;
    padding: 14px 16px;
    background: #FFFBEB;
    border: 1px solid #F59E0B;
    border-radius: 8px;
    border-left: 4px solid #F59E0B;
}
.no-match-header {
    font-size: 13px;
    color: #92400E;
    margin-bottom: 10px;
    line-height: 1.5;
}
.no-match-icon {
    font-size: 16px;
    margin-right: 6px;
}
.no-match-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.no-match-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    max-width: 400px;
}
.no-match-select:focus {
    border-color: #3B82F6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ── P0 Escalation Alert Banner ── */
.escalation-alert-banner {
    margin: 12px 0;
    padding: 14px 16px;
    background: #FEF2F2;
    border: 1px solid #EF4444;
    border-radius: 8px;
    border-left: 4px solid #DC2626;
    animation: escalation-pulse 2s ease-in-out 3;
}
@keyframes escalation-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }
}
.escalation-alert-header {
    font-size: 14px;
    font-weight: 700;
    color: #991B1B;
    margin-bottom: 8px;
}
.escalation-alert-icon {
    font-size: 18px;
    margin-right: 6px;
    color: #DC2626;
}
.escalation-alert-body {
    font-size: 13px;
    color: #7F1D1D;
    line-height: 1.5;
    margin-bottom: 12px;
}
.escalation-alert-body p { margin: 0 0 6px; }
.escalation-alert-actions {
    display: flex;
    gap: 8px;
}
.btn-pulse {
    animation: btn-pulse-anim 0.6s ease-in-out 3;
}
@keyframes btn-pulse-anim {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3); }
}

/* ── Verification Banner ── */
.verification-banner {
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius-sm);
}

.verification-banner-header {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: #2563EB;
    margin-bottom: 10px;
}

.verification-banner-body { font-size: 13px; }

/* Image Analysis Banner — distinct from operator notes */
.image-analysis-banner {
    background: #F0F9FF;
    border-color: #7DD3FC;
    border-left-color: #0284C7;
}
.image-analysis-banner .verification-banner-header {
    color: #0369A1;
}

.verification-item {
    padding: 8px 0;
    border-bottom: 1px solid #DBEAFE;
}

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

.verification-tag {
    display: inline-block;
    background: #DBEAFE;
    color: #2563EB;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

.verification-label {
    font-weight: 700;
    color: var(--color-primary-dark);
    font-size: 13px;
}

.verification-detail {
    margin: 4px 0 0;
    color: #374151;
    font-size: 13px;
    line-height: 1.5;
}

/* ── Language Correction Banner ── */
.language-correction-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #92400E;
}

.lang-correction-icon { font-size: 16px; }
.language-correction-banner strong { color: #78350F; }

/* ── Ticket List Summary ── */
.ticket-list-summary {
    border-top: 1px solid var(--color-border);
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-text-muted);
}

.summary-count {
    margin-bottom: 6px;
    font-weight: 600;
}

.summary-markets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text);
}

.summary-pill-count {
    font-family: var(--font-heading);
    color: var(--color-text-muted);
}

/* ── KPI Change Badge ── */
.kpi-change {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.kpi-change-up { color: #B91C1C; }
.kpi-change-down { color: #047857; }
.kpi-change-none { color: var(--color-text-subtle); }

/* ── Priority Dot ── */
.priority-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.priority-high { background: #EF4444; }
.priority-normal { background: #F59E0B; }
.priority-low { background: #94A3B8; }
.priority-urgent { background: #DC2626; }

/* ── Priority Badge (detail panel) ── */
.badge-priority {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}
.badge-priority.priority-urgent { background: #DC2626; }
.badge-priority.priority-high { background: #EF4444; }
.badge-priority.priority-normal { background: #F59E0B; color: #1E293B; }
.badge-priority.priority-low { background: #94A3B8; }

/* ── Repeat Customer Banner ── */
.repeat-customer-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #FFF7ED;
    border: 1px solid #FDBA74;
    border-radius: 8px;
    font-size: 13px;
    color: #9A3412;
}
.repeat-customer-banner .repeat-icon {
    font-size: 16px;
}
.repeat-ticket-link {
    cursor: pointer;
    color: #2563EB;
    text-decoration: underline;
    font-weight: 600;
}
.repeat-ticket-link:hover {
    color: #1D4ED8;
}

/* ── Footer ── */
.dashboard-footer {
    background: #0F172A;
    color: #94A3B8;
    text-align: center;
    padding: 20px;
    font-family: var(--font-body);
    font-size: 13px;
}

/* ── Loading Spinner ── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Global Loading Bar ── */
.global-loading-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 3px;
    z-index: 9999; pointer-events: none; opacity: 0;
    transition: opacity 0.2s;
}
.global-loading-bar.active { opacity: 1; }
.global-loading-bar::after {
    content: ''; display: block; height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-cta), var(--color-primary));
    background-size: 200% 100%;
    animation: loadingSlide 1.5s ease-in-out infinite;
}
@keyframes loadingSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Hamburger Button ── */
.btn-hamburger {
    display: none; /* shown only on mobile */
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-right: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.btn-hamburger:hover { background: rgba(0,0,0,0.06); }
.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.btn-hamburger.active .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.btn-hamburger.active .hamburger-line:nth-child(2) { opacity: 0; }
.btn-hamburger.active .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Mobile Sidebar ── */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.mobile-sidebar-overlay.visible { display: block; opacity: 1; }

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--color-card);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
.mobile-sidebar.open { left: 0; }

.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}
.mobile-sidebar-header .logo { font-size: 18px; }

.btn-sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.btn-sidebar-close:hover { background: rgba(0,0,0,0.06); }

.mobile-sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    flex: 1;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}
.mobile-nav-item:hover { background: var(--color-bg); }
.mobile-nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }

.mobile-sidebar-actions {
    border-top: 1px solid var(--color-border);
    padding: 8px 0;
}
.mobile-nav-action { color: var(--color-text-muted); }
.mobile-nav-danger { color: var(--color-danger-text); }

.mobile-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mobile-user-badge { font-size: 13px; font-weight: 600; color: var(--color-text); }
.mobile-last-updated { font-size: 11px; color: var(--color-text-subtle); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .btn-hamburger { display: flex; }
    .header { padding: 0 12px; }
    .header-title { display: none; }
    .header-right .btn, .header-right .last-updated, .header-right .user-badge { display: none; }
    .header-right #btn-refresh { display: inline-flex; }
    .kpi-strip {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px;
        gap: 8px;
        scrollbar-width: none;
    }
    .kpi-strip::-webkit-scrollbar { display: none; }
    .kpi-card { min-width: 120px; flex: 0 0 auto; }
    .kpi-value { font-size: 24px; }
    .filters {
        flex-direction: column;
        width: calc(100% - 32px);
        padding: 12px;
        max-width: none;
    }
    .filters select, .filters input { width: 100%; min-width: auto; }
    .main-content {
        flex-direction: column;
        height: auto;
        padding: 0 16px 24px;
    }
    .panel-list, .panel-detail { width: 100%; min-width: 0; flex: none; }
    .panel-list { max-height: 40vh; }
    .panel-resizer { display: none; }
    .market-layout { flex-direction: column; }
    .market-donut-wrap { flex: none; width: 100%; height: 180px; }
}

@media (max-width: 375px) {
    .kpi-card { flex: 1 1 100%; }
    .compose-actions { flex-wrap: wrap; }
    .compose-actions-group { flex-wrap: wrap; }
    .compose-actions-divider { display: none; }
    .compose-actions .btn { justify-content: center; }
}

/* ── Print ── */
@media print {
    .header, .filters, .kpi-strip, .compose-section { display: none; }
    .main-content { display: block; }
    .panel { box-shadow: none; border: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Generic Followup Panel (VIP, Login, Fraud) ── */
.followup-panel {
    background: #FAFAFA;
    border: 2px solid #94A3B8;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.followup-header {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.followup-icon { font-size: 18px; }
.followup-desc {
    font-size: 12.5px;
    color: #64748B;
    margin-bottom: 12px;
    line-height: 1.5;
}
.followup-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.followup-confirm-btn {
    width: 100%;
}

/* Fraud panel (3.7) — red theme */
.followup-panel-fraud {
    background: #FEF2F2;
    border-color: #EF4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
    animation: fraudPanelPulse 2s ease-in-out;
}
@keyframes fraudPanelPulse {
    0% { border-color: #EF4444; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15); }
    50% { border-color: #DC2626; box-shadow: 0 2px 16px rgba(239, 68, 68, 0.35); }
    100% { border-color: #EF4444; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15); }
}
.followup-panel-fraud .followup-header { color: #991B1B; }

/* VIP panel — purple theme */
.followup-panel-vip {
    background: #FAF5FF;
    border-color: #A855F7;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
}
.followup-panel-vip .followup-header { color: #6B21A8; }

/* ── Admin Lookup in Profile Modal ── */
.profile-lookup-btn { margin-left: 8px; font-size: 11px; padding: 2px 10px; }
.admin-lookup-section { margin-top: 14px; border-top: 1px solid #E2E8F0; padding-top: 10px; }
.admin-lookup-title { font-size: 13px; font-weight: 700; color: #1E293B; margin-bottom: 8px; }
.admin-lookup-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.admin-lookup-table td { padding: 4px 8px; border-bottom: 1px solid #F1F5F9; }
.admin-lookup-table td:first-child { color: #64748B; width: 100px; white-space: nowrap; }
.admin-lookup-data-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.admin-lookup-data-table th { background: #F8FAFC; padding: 4px 6px; font-weight: 600; color: #475569; border-bottom: 2px solid #E2E8F0; text-align: left; white-space: nowrap; }
.admin-lookup-data-table td { padding: 3px 6px; border-bottom: 1px solid #F1F5F9; white-space: nowrap; }
.admin-lookup-scroll {
    max-height: 240px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Always-visible scrollbar styling */
.admin-lookup-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.admin-lookup-scroll::-webkit-scrollbar-track { background: #F1F5F9; border-radius: 4px; }
.admin-lookup-scroll::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 4px; min-height: 32px; }
.admin-lookup-scroll::-webkit-scrollbar-thumb:hover { background: #64748B; }
/* Firefox */
.admin-lookup-scroll { scrollbar-width: thin; scrollbar-color: #94A3B8 #F1F5F9; }

/* Admin lookup result container — scrollable on small screens */
#admin-lookup-result {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
}
#admin-lookup-result::-webkit-scrollbar { width: 8px; }
#admin-lookup-result::-webkit-scrollbar-track { background: #F1F5F9; border-radius: 4px; }
#admin-lookup-result::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 4px; }
#admin-lookup-result::-webkit-scrollbar-thumb:hover { background: #64748B; }
#admin-lookup-result { scrollbar-width: thin; scrollbar-color: #94A3B8 #F1F5F9; }

/* Profile modal — scrollable on low-res */
.profile-modal {
    max-height: 85vh;
    overflow-y: auto;
}
.profile-modal::-webkit-scrollbar { width: 8px; }
.profile-modal::-webkit-scrollbar-track { background: #F1F5F9; border-radius: 4px; }
.profile-modal::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 4px; }
.profile-modal { scrollbar-width: thin; scrollbar-color: #94A3B8 #F1F5F9; }

@media (max-width: 1024px) {
    .admin-lookup-scroll { max-height: 180px; }
    #admin-lookup-result { max-height: 350px; }
    .admin-lookup-data-table { font-size: 10px; }
    .admin-lookup-data-table th, .admin-lookup-data-table td { padding: 2px 4px; }
}

.admin-lookup-empty { color: #94A3B8; font-size: 12px; text-align: center; padding: 12px; }
.admin-cache-tag { font-size: 10px; background: #E2E8F0; color: #64748B; padding: 1px 6px; border-radius: 8px; font-weight: 500; vertical-align: middle; }
.badge-vip { background: #7C3AED; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.badge-muted { background: #E2E8F0; color: #64748B; padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* ── PG Refund Button & Modal ── */
.btn-refund-pg { font-size: 10px; padding: 2px 8px; background: #DC2626; color: #fff; border: none; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn-refund-pg:hover { background: #B91C1C; }
.btn-refund-pg.btn-refunded { background: #94A3B8; cursor: default; }
.refund-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.refund-confirm-box { background: #fff; border-radius: 12px; padding: 24px; max-width: 440px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.refund-confirm-box h4 { margin: 0 0 16px; font-size: 16px; color: #1E293B; }
.refund-confirm-info { width: 100%; font-size: 13px; border-collapse: collapse; margin-bottom: 12px; }
.refund-confirm-info td { padding: 6px 8px; border-bottom: 1px solid #F1F5F9; }
.refund-confirm-info td:first-child { color: #64748B; width: 80px; }
.refund-confirm-info code { background: #F1F5F9; padding: 2px 6px; border-radius: 3px; font-size: 11px; }
.refund-confirm-info .input-sm { padding: 4px 8px; border: 1px solid #CBD5E1; border-radius: 4px; font-size: 12px; }
.refund-confirm-warning { background: #FEF3C7; border: 1px solid #F59E0B; border-radius: 6px; padding: 8px 12px; font-size: 12px; color: #92400E; margin-bottom: 14px; }
.refund-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.refund-result-success { margin-top: 12px; background: #F0FDF4; border: 1px solid #22C55E; border-radius: 6px; padding: 10px; font-size: 12px; color: #166534; }
.refund-result-fail { margin-top: 12px; background: #FEF2F2; border: 1px solid #EF4444; border-radius: 6px; padding: 10px; font-size: 12px; color: #991B1B; }

/* ── Refund Followup Decision Panel ── */
.refund-followup-panel {
    background: #FFF7ED;
    border: 2px solid #F59E0B;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    animation: refundPanelPulse 2s ease-in-out;
}
@keyframes refundPanelPulse {
    0% { border-color: #F59E0B; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15); }
    50% { border-color: #D97706; box-shadow: 0 2px 16px rgba(245, 158, 11, 0.35); }
    100% { border-color: #F59E0B; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15); }
}
.refund-followup-header {
    font-size: 14px;
    font-weight: 700;
    color: #92400E;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cancel-subcase-badge {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-heading);
    background: #EFF6FF;
    color: var(--color-primary);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-pill);
    padding: 2px 10px;
}
.subcase-badge-standalone {
    margin: 6px 0;
}
.refund-followup-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
/* Last odd child spans full width to avoid orphan half-row */
.refund-followup-checks > label.refund-check:nth-child(odd):last-of-type {
    grid-column: 1 / -1;
}
.refund-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.refund-check:hover { border-color: var(--color-primary); box-shadow: 0 2px 8px rgba(30,64,175,0.10); }
.refund-check:has(input:checked) { border-color: var(--color-primary); background: #EFF6FF; box-shadow: 0 0 0 2px rgba(30,64,175,0.15); }
.refund-check:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.refund-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; flex-shrink: 0; }
.refund-check-approved { border-color: #86EFAC; background: #F0FDF4; }
.refund-check-approved:has(input:checked) { border-color: #22C55E; background: #DCFCE7; }
.refund-check-denied { border-color: #FCA5A5; background: #FFF5F5; }
.refund-check-denied:has(input:checked) { border-color: #EF4444; background: #FEE2E2; }
.refund-check-icon { font-size: 20px; flex-shrink: 0; }
.refund-check-text { display: flex; flex-direction: column; gap: 1px; }
.refund-check-label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.refund-check-desc { font-size: 11px; color: var(--color-text-muted); }
.refund-template-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-left: 4px; background: #DCFCE7; color: #166534; vertical-align: middle; }
.refund-template-tag.denied { background: #FEE2E2; color: #991B1B; }
.refund-check-consumer-law { border-color: #93C5FD; background: #EFF6FF; }
.refund-check-consumer-law:has(input:checked) { border-color: #3B82F6; background: #DBEAFE; }
.refund-template-tag.consumer-law { background: #DBEAFE; color: #1E40AF; }
.refund-template-hint { display: none; padding: 6px 10px; margin: 4px 0 6px; font-size: 12px; color: #1E40AF; background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 6px; }
.refund-template-hint .hint-arrow { font-weight: 700; color: #2563EB; }
.refund-confirm-btn { width: 100%; padding: 8px; font-size: 13px; font-weight: 600; }
.refund-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cancel scenario: radio reuses checkbox styles */
.refund-check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; flex-shrink: 0; }

/* ── AI Recommendation Highlight (panel integration) ── */
.refund-check.ai-recommended {
    border: 2px solid #3B82F6;
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}
.refund-check.ai-recommended:hover {
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
.ai-recommend-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #3B82F6;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Inline body images (from markdown) ── */
.inline-body-img {
    display: block;
    max-width: 240px;
    max-height: 200px;
    margin: 6px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: box-shadow 0.15s;
    object-fit: contain;
}

.inline-body-img:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Sort toggle ── */
.btn-sort {
    font-size: 12px;
    padding: 4px 10px;
    white-space: nowrap;
    min-width: 80px;
}

/* ── Attachment display in comments ── */
.comment-attachments { margin-top: 8px; }

.attachment-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.attachment-image-wrap {
    position: relative;
    cursor: pointer;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: box-shadow 0.15s;
    max-width: 180px;
}

.attachment-image-wrap:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.attachment-thumb {
    display: block;
    max-width: 180px;
    max-height: 140px;
    object-fit: cover;
}

.attachment-image-name {
    display: block;
    font-size: 10px;
    color: var(--color-text-muted);
    padding: 2px 6px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-files { margin-top: 6px; }

.attachment-file-link {
    display: inline-block;
    font-size: 12px;
    color: var(--color-primary);
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-right: 6px;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.attachment-file-link:hover { background: #EFF6FF; }
.attachment-file-size { color: var(--color-text-muted); font-size: 11px; }

/* ── Lightbox ── */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.lightbox-filename {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox-actions { display: flex; gap: 8px; }

.lightbox-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 8px;
    color: var(--color-text-muted);
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s;
}

.lightbox-btn:hover { background: #F1F5F9; }

.lightbox-body {
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #F8FAFC;
}

.lightbox-img {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
}

/* ── Upload Zone ── */
.upload-zone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border: 2px dashed transparent;
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone.drag-over {
    border-color: var(--color-primary);
    background: #EFF6FF;
}

.btn-attach {
    white-space: nowrap;
    font-size: 12px;
    padding: 4px 10px;
}

.upload-hint {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ── Attachment Previews (compose area) ── */
.attachment-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.attachment-preview-item {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: 80px;
    background: var(--color-bg);
}

.attachment-preview-item img {
    display: block;
    width: 80px;
    height: 60px;
    object-fit: cover;
}

.attachment-preview-info {
    font-size: 9px;
    color: var(--color-text-muted);
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview-remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.attachment-preview-remove:hover { background: #EF4444; }

/* ── End-User Internal Note Badge ── */
.badge-eu-internal {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #B45309;
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.comment-eu-internal {
    border-left: 3px solid #F59E0B;
}

/* ── Image Resize Controls ── */
.upload-resize-separator {
    color: var(--color-border);
    font-size: 14px;
    margin: 0 2px;
    user-select: none;
}

.upload-resize-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    user-select: none;
}

.upload-resize-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.resize-max-select {
    font-size: 11px;
    padding: 2px 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    outline: none;
}

.resize-max-select:focus {
    border-color: var(--color-primary);
}

.resize-max-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.attachment-preview-info.resized {
    color: var(--color-success, #16A34A);
    font-weight: 600;
}

.attachment-preview-uploading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Performance Monitor Widget ── */
.perf-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.perf-summary .perf-stat {
    background: var(--color-surface, #F8FAFC);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    line-height: 1.4;
}
.perf-stat .perf-stat-value {
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text, #0F172A);
}
.perf-stat .perf-stat-label {
    color: var(--color-text-secondary, #64748B);
    font-size: 11px;
}
.perf-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}
.perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'Fira Code', monospace;
}
.perf-table th {
    text-align: left;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary, #64748B);
    border-bottom: 2px solid var(--color-border, #E2E8F0);
    white-space: nowrap;
}
.perf-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--color-border, #E2E8F0);
    white-space: nowrap;
}
.perf-table tr:hover td {
    background: var(--color-surface, #F8FAFC);
}
.perf-table .perf-slow { color: #B91C1C; font-weight: 600; }
.perf-table .perf-warn { color: #F59E0B; font-weight: 600; }
.perf-table .perf-ok { color: #047857; }
.perf-slow-list {
    margin-top: 8px;
    font-size: 12px;
}
.perf-slow-list h5 {
    font-size: 12px;
    font-weight: 600;
    color: #B91C1C;
    margin-bottom: 6px;
}
.perf-slow-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.perf-slow-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border, #E2E8F0);
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--color-text-secondary, #64748B);
}

