/* ==========================================================================
   ledSales – Custom Site Styles
   DevExtreme 24.2 base — do NOT duplicate DevExtreme variables
   ========================================================================== */

/* ── CSS Variables (Light mode defaults) ── */
:root {
    --ls-brand:          #1565c0;
    --ls-brand-dark:     #0d47a1;
    --ls-sidebar-bg:     #1e2a3a;
    --ls-sidebar-text:   #cfd8dc;
    --ls-sidebar-hover:  #263547;
    --ls-sidebar-active: #1976d2;
    --ls-navbar-bg:      #1565c0;
    --ls-navbar-text:    #ffffff;
    --ls-navbar-height:  54px;
    --ls-sidebar-width:  240px;
    --ls-content-bg:     #f4f6f8;
    --ls-card-bg:        #ffffff;
    --ls-card-shadow:    0 2px 8px rgba(0,0,0,0.10);
    --ls-text-primary:   #212529;
    --ls-text-muted:     #6c757d;
    --ls-border:         #dee2e6;
    --ls-footer-bg:      #f8f9fa;
    --ls-footer-text:    #6c757d;
}

/* ── Dark Mode ── */
body.dark-mode {
    --ls-brand:          #1e88e5;
    --ls-sidebar-bg:     #111820;
    --ls-sidebar-text:   #b0bec5;
    --ls-sidebar-hover:  #1a2535;
    --ls-sidebar-active: #1976d2;
    --ls-navbar-bg:      #0d1b2a;
    --ls-navbar-text:    #eceff1;
    --ls-content-bg:     #1a1f2e;
    --ls-card-bg:        #232d3f;
    --ls-card-shadow:    0 2px 12px rgba(0,0,0,0.35);
    --ls-text-primary:   #eceff1;
    --ls-text-muted:     #90a4ae;
    --ls-border:         #2e3b4e;
    --ls-footer-bg:      #161d28;
    --ls-footer-text:    #78909c;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--ls-content-bg);
    color: var(--ls-text-primary);
}

/* ── App Container ── */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Top Navbar ── */
#top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--ls-navbar-height);
    background: var(--ls-navbar-bg);
    color: var(--ls-navbar-text);
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

#navbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

#menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--ls-navbar-text);
    font-size: 22px;
    transition: background 0.2s;
}

#menu-toggle-btn:hover {
    background: rgba(255,255,255,0.15);
}

#brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ls-navbar-text);
}

#brand-icon {
    font-size: 22px;
    line-height: 1;
}

#brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

#navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-info {
    color: var(--ls-navbar-text);
    font-size: 13px;
    opacity: 0.90;
}

#user-name-display {
    font-weight: 500;
}

#logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--ls-navbar-text);
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

#logout-btn:hover {
    background: rgba(255,255,255,0.22);
}

/* Dark mode toggle sits in the navbar */
#dark-mode-toggle .dx-button {
    color: var(--ls-navbar-text) !important;
}

/* ── Drawer + Content Wrapper ── */
#drawer-content-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#drawer-container {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar (dxDrawer) ── */
.dx-drawer-panel-content {
    background: var(--ls-sidebar-bg) !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    width: 240px !important;
    min-width: 240px !important;
    max-height: calc(100vh - var(--ls-navbar-height)) !important;
}

/* dxList inside sidebar */
.dx-drawer-panel-content .dx-list {
    background: transparent !important;
}

.dx-drawer-panel-content .dx-list-item {
    color: var(--ls-sidebar-text) !important;
    border: none !important;
}

.dx-drawer-panel-content .dx-list-item:hover,
.dx-drawer-panel-content .dx-list-item.dx-state-hover {
    background: var(--ls-sidebar-hover) !important;
}

.dx-drawer-panel-content .dx-list-item.dx-list-item-selected {
    background: var(--ls-sidebar-active) !important;
    color: #ffffff !important;
}

/* Force sidebar text visible */
.dx-drawer-panel-content .dx-list-item .sidebar-item,
.dx-drawer-panel-content .dx-list-item .sidebar-item span,
.dx-drawer-panel-content .dx-list-item .sidebar-item i,
.dx-drawer-panel-content .dx-item-content {
    color: var(--ls-sidebar-text) !important;
}

.dx-drawer-panel-content .dx-list-item.dx-list-item-selected .sidebar-item,
.dx-drawer-panel-content .dx-list-item.dx-list-item-selected .sidebar-item span,
.dx-drawer-panel-content .dx-list-item.dx-list-item-selected .sidebar-item i {
    color: #ffffff !important;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.sidebar-item .dx-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    color: inherit !important;
}

.sidebar-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit !important;
}

/* ── Main Content Area ── */
#main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-content {
    flex: 1;
    overflow-y: auto !important;
    padding: 24px;
    background: var(--ls-content-bg);
}

/* dxDrawer content scroll fix */
.dx-drawer-content {
    overflow-y: auto !important;
}
.dx-drawer-wrapper {
    overflow: visible !important;
}

/* ── Footer ── */
#app-footer {
    flex-shrink: 0;
    background: var(--ls-footer-bg);
    border-top: 1px solid var(--ls-border);
    padding: 10px 24px;
    font-size: 12px;
    color: var(--ls-footer-text);
    text-align: center;
}

/* ── Login Page ── */
body.login-page {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 60%, #1a237e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

#login-page-wrapper {
    width: 100%;
    max-width: 420px;
}

#login-card {
    background: var(--ls-card-bg);
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
}

#login-logo-area {
    text-align: center;
    margin-bottom: 28px;
}

#login-logo-icon {
    font-size: 52px;
    color: var(--ls-brand);
    line-height: 1;
    margin-bottom: 8px;
}

#login-brand {
    font-size: 28px;
    font-weight: 700;
    color: var(--ls-brand);
    margin: 0 0 4px;
    letter-spacing: 1px;
}

#login-tagline {
    font-size: 12px;
    color: var(--ls-text-muted);
    margin: 0;
}

#login-form-container {
    width: 100%;
}

#login-submit-area {
    margin-top: 20px;
}

.login-error-banner {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* ── Dashboard ── */
#dashboard-page {
    max-width: 1400px;
}

#dashboard-welcome {
    margin-bottom: 24px;
}

#dashboard-welcome h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--ls-text-primary);
}

#dashboard-welcome p {
    margin: 0;
    font-size: 13px;
    color: var(--ls-text-muted);
}

/* ── Summary Cards ── */
#summary-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--ls-card-bg);
    border-radius: 10px;
    box-shadow: var(--ls-card-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.summary-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
}

.summary-card-icon {
    font-size: 36px;
    color: var(--ls-brand);
    flex-shrink: 0;
}

.summary-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--ls-text-primary);
    line-height: 1.1;
}

.summary-card-label {
    font-size: 12px;
    color: var(--ls-text-muted);
    margin-top: 3px;
}

/* ── Charts Row ── */
#dashboard-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

/* ── Dashboard panels ── */
.dashboard-panel {
    background: var(--ls-card-bg);
    border-radius: 10px;
    box-shadow: var(--ls-card-shadow);
    padding: 20px;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ls-text-primary);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ls-border);
}

#monthly-quotation-chart,
#status-pie-chart {
    height: 240px;
}

/* ── Status badge ── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    #summary-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    #dashboard-charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #summary-cards-row {
        grid-template-columns: 1fr 1fr;
    }

    #main-content {
        padding: 16px;
    }

    #brand-name {
        display: none;
    }

    #user-name-display {
        display: none;
    }

    #login-card {
        padding: 28px 20px;
    }
}

@media (max-width: 380px) {
    #summary-cards-row {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   CHAT OVERLAY  — matches ChatOverlay.tsx + ChatPanel.tsx
   ========================================================================== */

/* Chat toggle floating button */
#chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d9d9d9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    font-size: 20px;
    color: #595959;
}

#chat-toggle-btn.active {
    background: #1677ff;
    color: #fff;
    border-color: #1677ff;
}

#chat-toggle-btn:hover:not(.active) {
    box-shadow: 0 4px 12px rgba(0,0,0,0.20);
    background: #f5f5f5;
}

#chat-toggle-btn i,
#chat-toggle-btn svg {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

#chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Chat Panel */
#chat-panel {
    position: fixed;
    bottom: 150px;
    right: 24px;
    width: 620px;
    height: 520px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    z-index: 1050;
    display: flex;
    overflow: hidden;
}

/* Left panel: user list */
#chat-user-list {
    width: 200px;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#chat-user-list-header {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
}

.chat-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    color: #888;
    font-size: 14px;
    line-height: 1;
}
.chat-close-btn:hover { background: #f0f0f0; color: #333; }

#chat-search-wrap {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

#chat-user-items {
    flex: 1;
    overflow-y: auto;
}

.chat-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    background: transparent;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.chat-user-item:hover { background: #f5f5f5; }
.chat-user-item.selected {
    background: #e6f4ff;
    border-left-color: #1677ff;
}

.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1677ff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.online-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    position: absolute;
    bottom: 0;
    right: 0;
}
.online-dot.online  { background: #52c41a; }
.online-dot.offline { background: #d9d9d9; }

.chat-user-info { flex: 1; min-width: 0; }

.chat-user-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-user-name {
    font-size: 13px;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}
.chat-user-name.bold { font-weight: 600; }
.chat-unread-count {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}
.chat-last-msg {
    font-size: 11px;
    color: #8c8c8c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-loading { text-align: center; padding: 20px; color: #999; font-size: 12px; }
.chat-empty { text-align: center; padding: 20px; color: #999; font-size: 12px; }

/* Right panel: messages */
#chat-message-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#chat-no-user-selected {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

#chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-conv-header {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chat-conv-avatar {
    position: relative;
    width: 28px;
    height: 28px;
}
.chat-conv-avatar i {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1677ff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.chat-conv-avatar .online-dot {
    width: 8px;
    height: 8px;
    bottom: -1px;
    right: -1px;
}

.chat-conv-info { display: flex; flex-direction: column; }
.chat-conv-name { font-size: 14px; font-weight: 600; color: #212529; }
.chat-conv-status { font-size: 11px; }
.chat-conv-status.online { color: #52c41a; }
.chat-conv-status.offline { color: #999; }

#chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-no-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 13px;
}

/* Message bubbles */
.msg-row {
    display: flex;
    margin-bottom: 4px;
}
.msg-row.own { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }

.msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    word-break: break-word;
}
.msg-bubble.own {
    background: #1677ff;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}
.msg-bubble.other {
    background: #f0f0f0;
    color: #000;
    border-radius: 12px 12px 12px 2px;
}

.msg-sender {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
    display: block;
}

.msg-text { white-space: pre-wrap; }

.msg-file-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: underline;
}
.msg-bubble.own .msg-file-link { color: #e6f4ff; }
.msg-bubble.other .msg-file-link { color: #1677ff; }

.msg-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.msg-time {
    font-size: 10px;
    color: rgba(255,255,255,0.65);
}
.msg-bubble.other .msg-time { color: #999; }

.msg-check { font-size: 11px; color: rgba(255,255,255,0.5); }
.msg-check.read { color: #b7eb8f; }

/* Chat input area */
#chat-input-area {
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.chat-attach-btn, .chat-send-btn {
    background: none;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: #888;
    flex-shrink: 0;
    transition: background 0.15s;
}
.chat-attach-btn:hover { background: #f0f0f0; }
.chat-send-btn { background: #1677ff; color: #fff; border-color: #1677ff; }
.chat-send-btn:hover { background: #0958d9; }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#chatMsgInput {
    flex: 1;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    resize: none;
    min-height: 34px;
    max-height: 80px;
    overflow-y: auto;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
#chatMsgInput:focus { border-color: #1677ff; }

/* ==========================================================================
   ISSUE REPORT BUTTON  — matches ReportIssueButton.tsx
   ========================================================================== */

/* Issue report floating bug button */
#issue-report-btn {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    color: #595959;
    border: 1px solid #d9d9d9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    font-size: 20px;
    transition: background 0.2s, box-shadow 0.2s;
}
#issue-report-btn:hover { background: #f5f5f5; box-shadow: 0 4px 12px rgba(0,0,0,0.20); }

/* Issue report toolbox */
#issue-report-toolbox {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1050;
    width: 480px;
    max-height: calc(100vh - 32px);
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#issue-report-toolbox.minimized {
    width: 260px;
}

.issue-toolbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.issue-toolbox-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.issue-toolbox-header-btns {
    display: flex;
    gap: 4px;
}
.issue-toolbox-header-btns button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    color: #888;
    font-size: 14px;
}
.issue-toolbox-header-btns button:hover { background: #f0f0f0; color: #333; }

#issue-toolbox-body {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

.itb-row { margin-bottom: 12px; }
.itb-label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #212529;
}
.itb-label.required::before { content: '*'; color: #ff4d4f; margin-right: 4px; }

.itb-screenshot-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.itb-upload-btn {
    background: none;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #444;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.itb-upload-btn:hover { background: #f0f0f0; }

#itbScreenshotPreview {
    margin-top: 8px;
    position: relative;
    display: inline-block;
}
#itbScreenshotPreview img {
    max-height: 150px;
    max-width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    display: block;
}
.itb-screenshot-del {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4d4f;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Issue type toggle buttons */
.itb-type-toggle {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d9d9d9;
    width: fit-content;
}
.itb-type-btn {
    padding: 6px 14px;
    font-size: 13px;
    background: #fff;
    color: #000;
    border: none;
    border-right: 1px solid #d9d9d9;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    outline: none;
}
.itb-type-btn:last-child { border-right: none; }
.itb-type-btn.active {
    background: #1677ff;
    color: #fff;
}
.itb-type-btn:hover:not(.active) { background: #f5f5f5; }

/* Page code row with detect button */
.itb-pagecode-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.itb-pagecode-row input,
.itb-pagecode-row select {
    flex: 1;
}
.itb-detect-btn {
    background: none;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #595959;
    transition: background 0.15s;
    flex-shrink: 0;
}
.itb-detect-btn:hover { background: #f0f0f0; }

/* Native form inputs inside toolbox */
.itb-input {
    width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
    background: #fff;
    color: #212529;
}
.itb-input:focus { border-color: #1677ff; }

.itb-textarea {
    width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    resize: vertical;
    transition: border-color 0.15s;
    background: #fff;
    color: #212529;
}
.itb-textarea:focus { border-color: #1677ff; }

.itb-select {
    width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    background: #fff;
    color: #212529;
    cursor: pointer;
    transition: border-color 0.15s;
}
.itb-select:focus { border-color: #1677ff; }

/* Priority slider */
.itb-priority-wrap {
    padding: 4px 0 8px;
}
.itb-slider {
    width: 100%;
    accent-color: #1677ff;
    cursor: pointer;
}
.itb-slider-marks {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}
.itb-slider-marks span {
    font-size: 11px;
    color: #8c8c8c;
    min-width: 14px;
    text-align: center;
}

/* Screen capture overlay */
#itb-capture-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.20);
    z-index: 9999;
    cursor: crosshair;
    user-select: none;
}
#itb-capture-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
}
#itb-capture-rect {
    position: absolute;
    border: 2px dashed #1677ff;
    background: rgba(22,119,255,0.08);
    pointer-events: none;
}

.itb-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}
.itb-cancel-btn {
    background: none;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 5px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}
.itb-cancel-btn:hover { background: #f0f0f0; }

.itb-submit-btn {
    background: #1677ff;
    border: none;
    border-radius: 6px;
    padding: 5px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    transition: background 0.15s;
}
.itb-submit-btn:hover { background: #0958d9; }
.itb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==========================================================================
   ISSUES PAGE  — matches IssueListPage.tsx + IssueDetailPage.tsx
   ========================================================================== */

#issues-page { padding: 16px; }

.issues-toolbar {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 8px;
}

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

.issue-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.page-code-tag {
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    color: #595959;
}

/* Issues grid */
#issuesGrid {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* New issue form */
.new-issue-form { padding: 4px 8px; }
.form-row { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #212529;
}
.form-label.required::before { content: '*'; color: #ff4d4f; margin-right: 4px; }

/* Issue detail popup */
.issue-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.issue-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.issue-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.issue-detail-card {
    margin-bottom: 12px;
    border-radius: 6px;
    padding: 12px 16px;
}

.issue-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.info-row { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 12px; color: #8c8c8c; }
.info-val { font-size: 13px; color: #212529; font-weight: 500; }

.card-title { font-weight: 600; margin-bottom: 8px; font-size: 14px; }

.issue-description {
    white-space: pre-wrap;
    font-size: 13px;
    color: #212529;
    line-height: 1.6;
}

.issue-resolution-card {
    background: #f6ffed;
    border-color: #b7eb8f !important;
}

/* Tabs content */
.tab-content { padding: 8px 4px; }
.empty-tab { text-align: center; padding: 24px; color: #999; font-size: 13px; }

/* Comments */
.comment-bubble {
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 10px;
    border: 1px solid;
}
.comment-external { background: #f6ffed; border-color: #b7eb8f; }
.comment-internal { background: #fff7e6; border-color: #ffd591; }

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}
.comment-internal-badge {
    background: #fa8c161a;
    color: #fa8c16;
    border: 1px solid #fa8c164d;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
}
.comment-time { font-size: 12px; color: #8c8c8c; }
.comment-body { font-size: 13px; white-space: pre-wrap; }

.add-comment-form {
    margin-top: 16px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 12px;
}

/* Attachments */
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.attachment-item:last-child { border-bottom: none; }
.attachment-name { font-size: 13px; font-weight: 500; }
.attachment-meta { font-size: 11px; color: #8c8c8c; margin-top: 2px; }
.attachment-download { font-size: 13px; color: #1677ff; text-decoration: none; }
.attachment-download:hover { text-decoration: underline; }

/* Status History */
.history-item {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.history-item:last-child { border-bottom: none; }
.history-statuses { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.history-meta { font-size: 12px; color: #8c8c8c; }
.history-notes { font-size: 13px; color: #595959; margin-top: 4px; }

/* Status badge color overrides (exact CMS colors) */
/* Open=orange, InProgress=blue, InReview=purple, Resolved=green, Closed=gray */
/* Priority: 1=gray, 2=cyan, 3=blue, 4=orange, 5=red */
/* Type: Bug=red, FeatureRequest=blue */

/* Responsive: hide chat panel on small screens */
@@media (max-width: 680px) {
    #chat-panel { width: calc(100vw - 32px); right: 16px; }
    #issue-report-toolbox { width: calc(100vw - 32px); right: 16px; }
}

/* ── Page Code Badge ── */
#page-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #1677ff;
    font-weight: 600;
    cursor: default;
    margin-left: 12px;
    height: 28px;
    line-height: 28px;
}
#page-code-icon {
    font-size: 14px;
}

/* ── Permission Matrix ── */
.perm-matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
.perm-matrix th, .perm-matrix td { border: 1px solid #e8e8e8; padding: 6px 8px; text-align: center; white-space: nowrap; }
.perm-matrix th { background: #fafafa; font-size: 11px; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.perm-matrix .sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; text-align: left; min-width: 140px; }
.perm-matrix thead .sticky-col { z-index: 3; background: #fafafa; }
.perm-matrix .role-header { writing-mode: vertical-lr; transform: rotate(180deg); height: 120px; padding: 8px 4px; }
.perm-select { border: 1px solid #d9d9d9; border-radius: 4px; padding: 2px 4px; font-size: 11px; cursor: pointer; width: 80px; }

