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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('image/background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    /* Safe-area insets for iPhone notch / Dynamic Island / home indicator */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Header */
.header {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    padding: 30px;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Function Selector */
.function-selector {
    padding: 25px 30px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* allow buttons to wrap to next row before squishing */
    gap: 15px;
}

.function-selector label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.dropdown {
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    min-width: 300px;
    transition: all 0.3s ease;
}

.dropdown:hover {
    border-color: #c0392b;
}

.dropdown:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.manage-btn {
    padding: 12px 24px;
    font-size: 1rem;
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
    white-space: nowrap; /* prevent text breaking into multiple lines */
}

.manage-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(192, 57, 43, 0.4);
}

.manage-btn:active {
    transform: translateY(0);
}

.manage-btn.btn-toolbar-secondary {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    box-shadow: 0 4px 12px rgba(73, 80, 87, 0.3);
}

.manage-btn.btn-toolbar-secondary:hover {
    box-shadow: 0 6px 16px rgba(73, 80, 87, 0.4);
}

.manage-btn.btn-toolbar-orange {
    background: linear-gradient(135deg, #e65c00 0%, #c94b00 100%);
    box-shadow: 0 4px 12px rgba(230, 92, 0, 0.35);
}

.manage-btn.btn-toolbar-orange:hover {
    box-shadow: 0 6px 16px rgba(230, 92, 0, 0.5);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 20px;
    padding: 30px;
    min-height: 600px;
    transition: grid-template-columns 0.3s ease;
}

.main-content.tc-expanded {
    grid-template-columns: 0px 100%;
    gap: 0;
}

.main-content.tc-expanded .user-stories-section {
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    min-width: 0;
    padding: 0;
    margin: 0;
}

.user-stories-section {
    /* overflow must NOT be hidden here — it clips the table-container scrollbar.
       overflow:hidden is only applied in the tc-expanded collapsed state below. */
    overflow: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Expand / collapse icon button */
.btn-icon-action {
    background: #f0f0f0;
    border: 1px solid #ced4da;
    color: #495057;
    font-size: 1rem;
    padding: 6px 10px !important;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
}

.btn-icon-action:hover {
    background: #dee2e6;
}

/* Sections */
.user-stories-section,
.test-cases-section {
    background: transparent;
}

.user-stories-section h2,
.test-cases-section h2 {
    font-size: 1.4rem;
    color: #495057;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #c0392b;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    /* Smooth momentum scroll on iOS for both axes */
    -webkit-overflow-scrolling: touch;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

th:last-child {
    border-right: none;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Test case row background based on tester status */
.tc-row-pass {
    background-color: #d4edda !important;
}
.tc-row-pass:hover {
    background-color: #c3e6cb !important;
}
.tc-row-fail {
    background-color: #fce4e4 !important;
}
.tc-row-fail:hover {
    background-color: #f5c6cb !important;
}
.tc-row-cancel {
    background-color: #e2e3e5 !important;
}
.tc-row-cancel:hover {
    background-color: #d3d4d7 !important;
}

.user-stories-table tbody tr {
    cursor: pointer;
}

.user-stories-table tbody tr:hover {
    background: #e7f1ff;
    transform: translateX(3px);
}

.user-stories-table tbody tr.selected {
    background: #cfe2ff;
    border-left: 4px solid #667eea;
}

td {
    padding: 12px;
    font-size: 0.9rem;
    color: #495057;
    border-right: 1px solid #e9ecef;
}

td:last-child {
    border-right: none;
}

.empty-message {
    text-align: center;
    padding: 40px !important;
    color: #adb5bd;
    font-style: italic;
    border-right: none !important;
}

/* User Stories Table Specific */
.user-stories-table {
    table-layout: fixed;
    width: 100%;
    /* min-width ensures horizontal scroll kicks in on mobile */
    min-width: 420px;
}

.user-stories-table th,
.user-stories-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}

/* Allow the User Story name column (3rd column) to wrap */
.user-stories-table td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
}

.user-stories-table th {
    text-align: center;
}

/* Column resize handle */
.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 1;
}

.col-resizer:hover,
.col-resizer.resizing {
    background: rgba(255, 255, 255, 0.45);
}

/* Test Cases Table Specific */
.test-cases-table {
    /* 10 columns × 150px = forces horizontal scroll on all mobile widths */
    min-width: 1400px;
}

.test-cases-table th,
.test-cases-table td {
    min-width: 150px;
}

.test-cases-table th {
    text-align: center;
}

.test-cases-table th:nth-child(1),
.test-cases-table td:nth-child(1) {
    min-width: 100px;
}

/* Checkbox column for select mode */
.tc-checkbox-col,
.tc-checkbox-cell,
.us-checkbox-col,
.us-checkbox-cell {
    width: 40px;
    min-width: 40px !important;
    text-align: center;
    padding: 8px !important;
}

.tc-checkbox-cell input[type="checkbox"],
.tc-checkbox-col input[type="checkbox"],
.us-checkbox-cell input[type="checkbox"],
.us-checkbox-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #c0392b;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-passed {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d1ecf1;
    color: #0c5460;
}

/* BA Status dropdown in TC table */
.ba-status-select {
    padding: 5px 6px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    min-width: 130px;
    box-sizing: border-box;
    appearance: auto;
}

.ba-status-select:focus {
    outline: none;
    border-color: #c0392b;
}

.ba-status-select.status-pending {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.ba-status-select.status-approved {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #17a2b8;
}

/* ================================================================
   RESPONSIVE DESIGN — Mobile, Tablet, iPhone, Android, iPad
   ================================================================ */

/* Tablet landscape (1400px) */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 40% 60%;
    }
}

/* Tablet landscape / small desktop (1024px) */
@media (max-width: 1024px) {
    .main-content {
        /* minmax(0,1fr) prevents the grid column from expanding beyond screen width
           to fit large table min-width values — crucial for horizontal table scroll */
        grid-template-columns: minmax(0, 1fr);
    }

    /* iPad Air (820px) / iPad Pro (1024px) portrait: tighten button sizing
       so all 6 buttons fit on one or two rows without text wrapping */
    .manage-btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .dropdown {
        min-width: 220px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .table-container {
        max-height: 400px;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tc-stats {
        order: 3;
        width: 100%;
        flex: 1 1 100%;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* Tablet portrait / large phones (768px) */
@media (max-width: 768px) {
    /* Fix iOS fixed background rendering bug */
    body {
        background-attachment: scroll;
        padding: 8px;
    }

    /* Horizontal scroll for tables on portrait mobile */
    .table-container {
        /* overflow-x: scroll always reserves space for scrollbar on mobile */
        overflow-x: scroll;
    }

    /* User Stories: width:max-content lets the table grow beyond the container
       so the container's overflow-x:scroll actually kicks in */
    .user-stories-table {
        table-layout: auto;
        width: max-content;
        min-width: 420px;
    }

    .user-stories-table th,
    .user-stories-table td {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }

    /* Test Cases: same approach — width:max-content makes it wider than container */
    .test-cases-table {
        width: max-content;
        min-width: 1200px;
    }

    .container {
        border-radius: 10px;
    }

    .header {
        padding: 18px 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    /* Toolbar: wrap buttons into 2-per-row */
    .function-selector {
        flex-wrap: wrap;
        align-items: stretch;
        padding: 15px;
        gap: 8px;
    }

    .function-selector label {
        width: 100%;
        margin-bottom: 0;
    }

    .dropdown {
        width: 100%;
        min-width: unset;
        flex: 1 1 100%;
    }

    .manage-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        padding: 10px 12px;
        font-size: 0.88rem;
        text-align: center;
    }

    /* Main layout */
    .main-content {
        padding: 12px;
        gap: 12px;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tc-stats {
        order: 3;
        width: 100%;
        flex: 1 1 100%;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .small-btn {
        padding: 8px 12px !important;
        font-size: 0.82rem !important;
        min-height: 36px;
    }

    /* Tables */
    .table-container {
        max-height: 320px;
    }

    th {
        padding: 12px 8px;
        font-size: 0.82rem;
    }

    td {
        padding: 10px 8px;
        font-size: 0.82rem;
    }

    /* Modals */
    .modal-content {
        width: 96%;
        max-width: 100%;
        margin: 0 auto;
        border-radius: 12px;
    }

    .modal-header {
        padding: 18px 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-actions .btn {
        flex: 1 1 auto;
        min-width: 100px;
    }

    .modal-table-container {
        max-height: 280px;
    }

    .btn {
        padding: 10px 20px;
    }
}

/* Phone landscape / small tablets (576px) */
@media (max-width: 576px) {
    .user-stories-table {
        width: max-content;
        min-width: 380px;
    }

    .test-cases-table {
        width: max-content;
        min-width: 1000px;
    }
    body {
        padding: 6px;
    }

    .container {
        border-radius: 8px;
    }

    .header {
        padding: 14px 16px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    /* Each toolbar button takes full width on narrow phones */
    .manage-btn {
        flex: 1 1 100%;
    }

    .function-selector {
        padding: 12px;
        gap: 7px;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .tc-stats-group {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .tc-stat-item {
        font-size: 0.68rem;
        padding: 1px 4px;
    }

    .table-container {
        max-height: 280px;
    }

    th {
        padding: 10px 6px;
        font-size: 0.78rem;
    }

    td {
        padding: 8px 6px;
        font-size: 0.78rem;
    }

    .small-btn {
        padding: 7px 10px !important;
        font-size: 0.78rem !important;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }
}

/* Small phones — iPhone 14 / Pixel 7 (430px) */
@media (max-width: 430px) {
    .user-stories-table {
        width: max-content;
        min-width: 360px;
    }

    .test-cases-table {
        width: max-content;
        min-width: 900px;
    }
    body {
        padding: 4px;
    }

    .header {
        padding: 12px 14px;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .function-selector {
        padding: 10px;
        gap: 6px;
    }

    .manage-btn {
        padding: 9px 10px;
        font-size: 0.82rem;
    }

    .main-content {
        padding: 8px;
        gap: 10px;
    }

    .table-container {
        max-height: 250px;
    }

    .modal-content {
        width: 98%;
        border-radius: 10px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    /* Make modal full-height on tiny screens */
    .modal.show {
        align-items: flex-end;
    }

    .modal-content {
        border-radius: 14px 14px 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }
}

/* Extra small phones — iPhone SE / iPhone 12 mini (375px) */
@media (max-width: 375px) {
    .header h1 {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .manage-btn {
        font-size: 0.78rem;
        padding: 8px 8px;
    }

    .small-btn {
        padding: 6px 8px !important;
        font-size: 0.74rem !important;
    }

    th {
        font-size: 0.72rem;
        padding: 8px 5px;
    }

    td {
        font-size: 0.72rem;
        padding: 7px 5px;
    }

    .tc-stats-group {
        font-size: 0.65rem;
    }
}

/* Touch device improvements (all mobile) */
@media (hover: none) and (pointer: coarse) {
    /* Ensure minimum touch target size of 44px */
    .manage-btn,
    .btn,
    .small-btn,
    .close-modal,
    .dropdown {
        min-height: 44px;
    }

    .small-btn {
        min-height: 38px !important;
    }

    /* Remove hover transforms that feel odd on touch */
    .manage-btn:hover,
    .btn-add:hover,
    .btn-delete:hover,
    .btn-cancel:hover,
    .btn-select:hover {
        transform: none;
    }

    /* Faster tap feedback */
    .manage-btn:active,
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }

    /* Better table scrolling on touch */
    .table-container {
        -webkit-overflow-scrolling: touch;
        /* Show thin scrollbar so user knows content is scrollable */
        scrollbar-width: thin;
        scrollbar-color: #c0392b #f1f1f1;
    }

    .table-container::-webkit-scrollbar {
        height: 5px;
        width: 5px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #c0392b;
        border-radius: 3px;
    }

    .tc-stats {
        -webkit-overflow-scrolling: touch;
    }
}

/* Scrollbar Styling */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c0392b;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #c0392b;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
    transition: opacity 0.4s ease;
}

/* Message/notification modal always on top of all other modals */
#message-modal {
    z-index: 2000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
    backdrop-filter: blur(10px);
}

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

.modal-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 2rem;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease;
}

.close-modal:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px 30px 36px;
}

.modal-body p {
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.6;
}

.modal-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.modal-table thead {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    position: sticky;
    top: 0;
}

.modal-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.modal-table th:first-child {
    width: 80px;
    text-align: center;
}

.modal-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.modal-table tbody tr:hover {
    background: rgba(168, 218, 220, 0.1);
}

.modal-table td {
    padding: 12px 15px;
}

.modal-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: #c0392b;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    min-width: 0;
}

.section-header h2 {
    margin: 0;
    white-space: nowrap;
}

/* Test Cases stats bar */
.tc-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    /* hide scrollbar but keep scrollability */
    scrollbar-width: thin;
    scrollbar-color: #ced4da transparent;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.tc-stats-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.tc-stats-label {
    font-weight: 700;
    color: #495057;
    margin-right: 2px;
    border-right: 1px solid #ced4da;
    padding-right: 6px;
}

.tc-stat-item {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tc-stat-item strong {
    font-weight: 700;
}

.tc-stat-pass   { background: #d4edda; color: #155724; }
.tc-stat-fail   { background: #fce4e4; color: #721c24; }
.tc-stat-cancel { background: #e2e3e5; color: #383d41; }
.tc-stat-wait   { background: #fff3cd; color: #856404; }

.tc-stats-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    background: rgba(192,57,43,0.08);
}

.tc-stats-total strong {
    font-size: 1rem;
    color: #c0392b;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.small-btn {
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
}

.test-cases-table tbody td {
    white-space: pre-wrap;
}

.tc-cell-link {
    color: #1a73e8;
    text-decoration: underline;
    word-break: break-all;
    cursor: pointer;
}

.tc-cell-link:hover {
    color: #0d47a1;
}

.tc-input {
    width: 100%;
    min-height: 60px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #ffffff;
    resize: vertical;
    box-sizing: border-box;
}

.tc-input:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.12);
}

/* Tester dropdown */
.tester-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    appearance: auto;
    box-sizing: border-box;
}

.tester-select.status-wait {
    background-color: #ffffff;
    color: #212529;
}

.tester-select.status-pass {
    background-color: #28a745;
    color: #ffffff;
}

.tester-select.status-fail {
    background-color: #dc3545;
    color: #ffffff;
}

.tester-select.status-cancel {
    background-color: #555555;
    color: #ffffff;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-add {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(192, 57, 43, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(192, 57, 43, 0.4);
}

.btn:active {
    transform: translateY(0);
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.form-input::placeholder {
    color: #adb5bd;
}

.btn-template {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.btn-template:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(21, 101, 192, 0.4);
}

.btn-cancel {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.4);
}

.btn-select {
    background: linear-gradient(135deg, #6d4c41 0%, #8d6e63 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.3);
}

.btn-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(109, 76, 65, 0.4);
}

.btn-edit {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(21, 101, 192, 0.4);
}

/* Inline edit inputs inside user stories table */
.us-edit-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 0.9rem;
    border: 2px solid #1976d2;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    color: #212529;
}

.us-edit-input:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
}

/* Document link buttons in the Manage Functions modal */
.btn-doc-link {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-doc-srs {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: #fff;
}

.btn-doc-design {
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
    color: #fff;
}

.btn-doc-srs:hover,
.btn-doc-design:hover {
    opacity: 0.85;
}

.btn-doc-empty {
    color: #adb5bd;
    font-size: 0.9rem;
}

.monitor-time-input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 13px;
    width: 94px;
    background: #fff;
    color: #333;
    cursor: pointer;
}
.monitor-time-input:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.15);
}

/* Report Modal */
#report-modal .modal-content {
    max-width: 480px;
}

#report-modal .modal-header h2 {
    text-align: center;
}

.report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-report {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
    padding: 16px 12px;
    font-size: 1rem;
    white-space: nowrap;
}

.btn-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(192, 57, 43, 0.45);
}

@media (max-width: 480px) {
    .report-actions {
        grid-template-columns: 1fr;
    }

    .btn-report {
        padding: 14px 12px;
        font-size: 0.95rem;
    }
}

/* Test Stats Report Modal */
.modal-content-wide {
    max-width: 1100px;
    width: 96%;
}

.report-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 1rem;
}

.report-meta-label {
    font-weight: 700;
    color: #495057;
}

.report-meta-value {
    font-weight: 600;
    color: #c0392b;
}

.report-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.btn-report-export {
    background: linear-gradient(135deg, #1a6b2e 0%, #28a745 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.35);
    padding: 8px 20px;
    font-size: 0.9rem;
    border-radius: 8px;
    white-space: nowrap;
}

.btn-report-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.5);
}

.btn-report-export:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.report-table-container {
    max-height: 60vh;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.report-stats-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
}

.report-stats-table thead {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.report-stats-table th {
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    white-space: nowrap;
}

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

/* group header (Kiểm thử vòng 1 / mới nhất) */
.report-stats-table th.th-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.12);
}

.report-stats-table td {
    padding: 10px 12px;
    font-size: 0.88rem;
    color: #495057;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
    white-space: nowrap;
}

.report-stats-table td:nth-child(2) {
    text-align: left;
    white-space: normal;
    min-width: 180px;
    max-width: 260px;
}

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

.report-stats-table tbody tr:hover {
    background: #f8f9fa;
}

/* Tỉ lệ đạt coloring */
.rate-high  { color: #155724; font-weight: 700; }
.rate-mid   { color: #856404; font-weight: 700; }
.rate-low   { color: #721c24; font-weight: 700; }

.report-loading {
    text-align: center;
    padding: 40px;
    color: #adb5bd;
    font-style: italic;
}

@media (max-width: 768px) {
    .modal-content-wide {
        width: 98%;
    }

    .report-stats-table th,
    .report-stats-table td {
        padding: 8px 8px;
        font-size: 0.78rem;
    }
}

/* ── Bug Tracker ────────────────────────────────────────────────────────── */
.modal-content-fullish {
    max-width: 1400px;
    width: 96%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Bug tracker modal header — prevent title from being clipped */
#bug-tracker-modal .modal-header {
    padding: 14px 18px;
    flex-wrap: nowrap;
    gap: 10px;
    flex-shrink: 0;
}

#bug-tracker-modal .modal-header h2 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

#bug-tracker-modal .close-modal {
    flex-shrink: 0;
    font-size: 1.6rem;
}

#bug-tracker-modal .modal-body {
    overflow-y: auto;
    flex: 1;
}

.bug-tracker-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Filter bar ─── */
.bug-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.us-search-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    max-width: 280px;
}

.us-search-inline .bug-search-group {
    flex: 1;
    min-width: 0;
}

#tc-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    background: #f0f4ff;
    border: 1px solid #c5d3f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#tc-filter-bar .bug-filter-select:focus {
    border-color: #3b5bdb;
    box-shadow: 0 0 0 2px rgba(59,91,219,0.12);
}

#tc-filter-bar .bug-search-group:focus-within {
    border-color: #3b5bdb;
    box-shadow: 0 0 0 2px rgba(59,91,219,0.12);
}

#tc-filter-bar .btn-clear-filter:hover {
    background: #dbe4ff;
    border-color: #3b5bdb;
    color: #3b5bdb;
}

.bug-search-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 4px 8px;
    gap: 6px;
    min-width: 160px;
    flex-shrink: 0;
}

.bug-search-group:focus-within {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.1);
}

.bug-search-icon {
    font-size: 0.9rem;
    color: #6c757d;
    flex-shrink: 0;
}

.bug-search-input {
    border: none;
    outline: none;
    font-size: 0.82rem;
    font-family: inherit;
    width: 100%;
    background: transparent;
    color: #343a40;
}

.bug-search-input::placeholder {
    color: #adb5bd;
}

.bug-filter-select {
    padding: 5px 6px;
    font-size: 0.82rem;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    min-width: 118px;
    flex-shrink: 0;
}

.bug-filter-select:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.1);
}

.bug-filter-date-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.bug-filter-date-label {
    font-size: 0.82rem;
    color: #495057;
    white-space: nowrap;
}

.bug-filter-date {
    padding: 5px 7px;
    font-size: 0.82rem;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    width: 118px;
}

.bug-filter-date:focus {
    outline: none;
    border-color: #c0392b;
}

.bug-filter-date-sep {
    font-size: 0.82rem;
    color: #6c757d;
}

.btn-clear-filter {
    padding: 5px 12px;
    font-size: 0.82rem;
    font-family: inherit;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    color: #6c757d;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-clear-filter:hover {
    background: #f8d7da;
    border-color: #c0392b;
    color: #c0392b;
}

.bug-filter-count {
    font-size: 0.80rem;
    color: #6c757d;
    margin-left: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.bug-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
    -webkit-overflow-scrolling: touch;
}

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

.bug-row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #c0392b;
}

.bug-tracker-table tbody tr.bug-row-selected {
    background: #fff0ee !important;
}

.bug-tracker-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
}

.bug-tracker-table thead {
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.bug-tracker-table th {
    padding: 11px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.2);
}

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

.bug-tracker-table td {
    padding: 6px 8px;
    font-size: 0.85rem;
    color: #495057;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
}

.bug-tracker-table td:last-child { border-right: none; }
.bug-tracker-table tbody tr:hover { background: #f8f9fa; }

/* STT column */
.bug-tracker-table td.bug-stt {
    text-align: center;
    font-weight: 600;
    color: #c0392b;
    min-width: 46px;
}

/* Description / Notes — allow wrapping */
.bug-tracker-table td[data-field="description"],
.bug-tracker-table td[data-field="notes"] {
    white-space: normal;
    min-width: 180px;
    max-width: 280px;
}

/* Per-field width overrides */
.bug-tracker-table input.bug-input[data-field="jira_code"] {
    min-width: 100px;
    width: 100px;
}

.bug-tracker-table select.bug-select[data-field="bug_type"] {
    min-width: 90px;
}

.bug-tracker-table textarea.bug-input[data-field="description"] {
    min-width: 260px;
}

/* Updated_at column */
.bug-tracker-table td.bug-updated {
    text-align: center;
    font-size: 0.78rem;
    color: #6c757d;
    min-width: 130px;
}

/* Text inputs inside bug table */
.bug-input {
    width: 100%;
    min-width: 120px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 5px 7px;
    font-size: 0.84rem;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
    resize: vertical;
}

.bug-input:focus {
    outline: none;
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,0.1);
}

/* Date input */
input.bug-date {
    width: 100px;
    padding: 5px 7px;
    font-size: 0.84rem;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 5px;
    box-sizing: border-box;
    cursor: text;
    text-align: center;
    letter-spacing: 0.5px;
}

input.bug-date:focus {
    outline: none;
    border-color: #c0392b;
}

/* Generic bug select base */
.bug-select {
    padding: 5px 6px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    min-width: 110px;
    box-sizing: border-box;
    appearance: auto;
}

.bug-select:focus { outline: none; border-color: #c0392b; }

/* ── Status colours ── */
.bug-status-new      { background:#dc3545; color:#fff; }
.bug-status-fixing   { background:#fd7e14; color:#fff; }
.bug-status-wait     { background:#b39ddb; color:#fff; }
.bug-status-done     { background:#28a745; color:#fff; }
.bug-status-cancel   { background:#6c757d; color:#fff; }
.bug-status-improve  { background:#007bff; color:#fff; }

/* ── Distribution colours ── */
.bug-dist-web        { background:#28a745; color:#fff; }
.bug-dist-parent     { background:#b39ddb; color:#fff; }
.bug-dist-staff      { background:#fd7e14; color:#fff; }

/* ── Bug type colours ── */
.bug-type-frontend   { background:#90caf9; color:#0d47a1; }
.bug-type-backend    { background:#f8bbd0; color:#880e4f; }

/* ── Severity colours ── */
.bug-sev-medium      { background:#90caf9; color:#0d47a1; }
.bug-sev-low         { background:#e0e0e0; color:#424242; }
.bug-sev-critical    { background:#dc3545; color:#fff; }
.bug-sev-high        { background:#f48fb1; color:#880e4f; }

/* ── Custom (user-added) option colour ── */
.bug-option-custom   { background:#e2e8f0; color:#374151; }

/* ── Gear (settings) button in bug tracker header ── */
.bug-settings-btn {
    background: none;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 3px 9px;
    color: #6c757d;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
    margin-left: auto;
}
.bug-settings-btn:hover {
    background: #fff3f3;
    color: #c0392b;
    border-color: #c0392b;
}

/* ── Bug Settings Modal ── */
.modal-content-settings {
    width: 540px;
    max-width: 96vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
.bug-settings-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bug-settings-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.bug-settings-tab {
    padding: 7px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.87rem;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, border-color 0.15s;
}
.bug-settings-tab:hover { color: #c0392b; }
.bug-settings-tab.active {
    color: #c0392b;
    border-bottom-color: #c0392b;
    font-weight: 600;
}
.bug-settings-panel-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.bug-settings-panel { display: none; }
.bug-settings-panel.active { display: block; }
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 14px;
    padding-right: 2px;
}
.settings-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}
.settings-item-label {
    flex: 1;
    font-size: 0.91rem;
    color: #212529;
    word-break: break-word;
}
.settings-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.settings-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.settings-add-row .form-input { flex: 1; }
.settings-edit-input {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
}

/* ── Jira cell: input + link icon ── */
.bug-jira-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.bug-jira-wrapper .bug-input {
    flex: 1;
    min-width: 0;
}
.bug-jira-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0969da;
    text-decoration: none;
    font-size: 0.8rem;
    opacity: 0.8;
    border: 1px solid #c5d3f0;
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.6;
    background: #f0f5ff;
    transition: opacity 0.15s, background 0.15s;
    white-space: nowrap;
}
.bug-jira-link:hover {
    opacity: 1;
    background: #dbeafe;
    border-color: #3b82f6;
}

/* ── Bug Summary Report ── */
.bug-summary-hint {
    font-size: 0.82rem;
    color: #6c757d;
    margin: 0 0 20px 0;
    text-align: center;
    letter-spacing: 0.2px;
}

.bug-summary-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.bug-summary-chart-card {
    background: linear-gradient(145deg, #ffffff 0%, #f0f4ff 100%);
    border: 1px solid rgba(100,120,200,0.15);
    border-radius: 16px;
    padding: 20px 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 18px rgba(60,80,180,0.09), 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bug-summary-chart-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 32px rgba(60,80,180,0.15), 0 2px 8px rgba(0,0,0,0.08);
}

.bug-summary-chart-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: #3b3f5c;
    margin-bottom: 16px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 0.82rem;
    background: linear-gradient(90deg, #5c6bc0, #1976d2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bug-summary-chart-wrap {
    position: relative;
    width: 100%;
    max-width: 260px;
    cursor: pointer;
    filter: drop-shadow(0 6px 16px rgba(60,80,180,0.13));
    transition: filter 0.18s ease;
}

.bug-summary-chart-wrap:hover {
    filter: drop-shadow(0 10px 24px rgba(60,80,180,0.22));
}

.bug-summary-chart-wrap canvas {
    width: 100% !important;
    height: auto !important;
}

/* Center label inside doughnut */
.bug-summary-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -56%);
    text-align: center;
    pointer-events: none;
}

.bug-summary-chart-center-num {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #3b3f5c;
    line-height: 1;
}

.bug-summary-chart-center-lbl {
    display: block;
    font-size: 0.68rem;
    color: #888;
    margin-top: 2px;
    letter-spacing: 0.4px;
}

@media (max-width: 640px) {
    .bug-summary-charts {
        grid-template-columns: 1fr;
    }
}

/* Bug Summary Report — scrollable body */
#bug-summary-report-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

#bug-summary-report-modal .modal-body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* ── AI Analysis Section ── */
.ai-analysis-section {
    margin-top: 32px;
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.10);
}

.ai-analysis-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 60%, #2563eb 100%);
}

.ai-analysis-icon {
    font-size: 1.3rem;
}

.ai-analysis-title {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex: 1;
    letter-spacing: 0.3px;
}

.ai-analysis-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 20px;
    padding: 2px 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ai-analysis-body {
    background: linear-gradient(160deg, #fafaff 0%, #f0f0ff 100%);
    padding: 22px 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-block {
    background: #fff;
    border-radius: 12px;
    border-left: 4px solid #6366f1;
    padding: 14px 18px;
    box-shadow: 0 2px 8px rgba(99,102,241,0.07);
}

.ai-block.ai-block-warn {
    border-left-color: #f59e0b;
}

.ai-block.ai-block-danger {
    border-left-color: #ef4444;
}

.ai-block.ai-block-success {
    border-left-color: #10b981;
}

.ai-block.ai-block-info {
    border-left-color: #3b82f6;
}

.ai-block-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    font-size: 0.88rem;
    color: #3730a3;
    margin-bottom: 8px;
}

.ai-block.ai-block-warn .ai-block-heading { color: #92400e; }
.ai-block.ai-block-danger .ai-block-heading { color: #991b1b; }
.ai-block.ai-block-success .ai-block-heading { color: #065f46; }
.ai-block.ai-block-info .ai-block-heading { color: #1e40af; }

.ai-block-content {
    font-size: 0.855rem;
    color: #374151;
    line-height: 1.7;
}

.ai-block-content ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
}

.ai-block-content li {
    margin-bottom: 4px;
}

.ai-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-score-label {
    font-size: 0.85rem;
    color: #6b7280;
    min-width: 130px;
}

.ai-score-bar-wrap {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
}

.ai-score-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s ease;
}

.ai-score-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    min-width: 32px;
    text-align: right;
}

/* ── Round-1 Chart ── */
.round1-chart-wrapper {
    position: relative;
    width: 100%;
    max-height: 55vh;
}

.round1-chart-wrapper canvas {
    max-height: 55vh;
}

@media (max-width: 768px) {
    .round1-chart-wrapper,
    .round1-chart-wrapper canvas {
        max-height: 45vh;
    }
}

/* Import Modal Adjustments */
#import-modal .modal-content {
    max-width: 400px;
    height: auto;
}

#import-modal .modal-header h2 {
    text-align: center;
}

/* Progress Modal */
.progress-modal {
    max-width: 300px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #c0392b 0%, #c0392b 100%);
    width: 0%;
    transition: width 0.1s ease;
}

/* ── Reminder Bell ─────────────────────────────────────────────────────── */
.reminder-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(73,80,87,0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.reminder-bell-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(73,80,87,0.4);
}

.reminder-bell-btn.bell-active {
    background: linear-gradient(135deg, #e65c00 0%, #c94b00 100%);
    box-shadow: 0 4px 14px rgba(230,92,0,0.5);
    animation: bell-shake 0.6s ease infinite alternate;
}

@keyframes bell-shake {
    0%   { transform: rotate(-8deg) translateY(-1px); }
    100% { transform: rotate(8deg)  translateY(-1px); }
}

.bell-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    line-height: 1;
}

/* ── Narrow modal variant ──────────────────────────────────────────────── */
.modal-content-narrow {
    max-width: 480px;
    width: 94%;
}

/* ── Notes Selector Modal ──────────────────────────────────────────────── */
.notes-selector-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 10px 0 6px;
}

.notes-selector-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 32px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e65c00 0%, #c94b00 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(230,92,0,0.3);
    transition: all 0.25s ease;
    min-width: 130px;
}

.notes-selector-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(230,92,0,0.4);
}

.notes-selector-btn-green {
    background: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
    box-shadow: 0 4px 14px rgba(46,125,50,0.3);
}

.notes-selector-btn-green:hover {
    box-shadow: 0 8px 22px rgba(46,125,50,0.4);
}

.notes-selector-btn-blue {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    box-shadow: 0 4px 14px rgba(21,101,192,0.3);
}

.notes-selector-btn-blue:hover {
    box-shadow: 0 8px 22px rgba(21,101,192,0.4);
}

.notes-selector-btn-green:hover {
    box-shadow: 0 8px 22px rgba(46,125,50,0.4);
}

.notes-selector-icon {
    font-size: 2rem;
    line-height: 1;
}

/* ── Reminders Table ───────────────────────────────────────────────────── */
.reminders-table {
    width: 100%;
}

.reminders-table th,
.reminders-table td {
    vertical-align: middle;
}

.reminder-row {
    cursor: pointer;
    transition: background 0.15s;
}

.reminder-row:hover {
    background: #fff3f0 !important;
}

.reminder-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.reminder-status.due {
    background: #dc3545;
    color: #fff;
}

.reminder-status.pending {
    background: #e9ecef;
    color: #495057;
}

.reminder-status.seen {
    background: #28a745;
    color: #fff;
}

.reminder-delete-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.reminder-delete-btn:hover {
    color: #c0392b;
    background: #fdf0ee;
}

/* ── Add Reminder Modal ────────────────────────────────────────────────── */
.reminder-textarea {
    min-height: 90px;
    resize: vertical;
}

/* ── Reminder Detail Modal ─────────────────────────────────────────────── */
.reminder-detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 14px;
    border-left: 3px solid #c0392b;
}

.reminder-detail-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reminder-detail-value {
    font-size: 0.95rem;
    color: #212529;
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.reminder-detail-remind {
    font-weight: 700;
    color: #c0392b;
}

/* ── Overdue Popup ─────────────────────────────────────────────────────── */
.overdue-popup {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 9999;
    overflow: hidden;
    display: none;
    animation: fadeInDown 0.25s ease;
}

.overdue-popup.show {
    display: block;
}

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

.overdue-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #e65c00 0%, #c94b00 100%);
    color: #fff;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.95rem;
}

.overdue-popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.overdue-list {
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
}

.overdue-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

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

.overdue-item:hover {
    background: #fff3f0;
}

.overdue-content {
    font-size: 0.9rem;
    color: #212529;
    font-weight: 500;
    word-break: break-word;
}

.overdue-time {
    font-size: 0.76rem;
    color: #e65c00;
    font-weight: 600;
}

.overdue-empty {
    padding: 18px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 0.88rem;
    list-style: none;
}

/* ── Notes List Modal ──────────────────────────────────────────────────── */
.notes-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    min-height: 80px;
    padding: 4px 2px;
}

.note-card {
    background: #fffde7;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    padding: 14px 14px 12px;
    cursor: pointer;
    transition: box-shadow 0.18s, transform 0.18s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 2px solid transparent;
    min-height: 100px;
    user-select: none;
}

.note-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    transform: translateY(-2px);
}

.note-card.note-card-selected {
    border-color: #2e7d32;
    background: #f1f8e9;
}

.note-card-cb {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: none;
    accent-color: #2e7d32;
}

.notes-select-mode .note-card-cb {
    display: block;
}

.note-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #333;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-preview {
    font-size: 0.80rem;
    color: #666;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.note-card-date {
    font-size: 0.72rem;
    color: #aaa;
    margin-top: auto;
}

/* ── Note Editor Modal ─────────────────────────────────────────────────── */
.note-editor-content {
    max-width: 780px;
    width: 96%;
}

.note-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    padding: 6px 8px;
}

.note-tool-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
    min-width: 28px;
    text-align: center;
    line-height: 1.6;
}

.note-tool-btn:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.note-tool-btn.active {
    background: #c0392b;
    color: #fff;
    border-color: #a93226;
}

.note-tool-select {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 3px 4px;
    font-size: 0.82rem;
    cursor: pointer;
    height: 28px;
    color: #333;
}

.note-toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: #ccc;
    margin: 0 2px;
}

.note-color-label {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.note-tool-checklist-btn {
    background: #2e7d32;
    color: #fff;
    border-color: #1b5e20;
    font-size: 0.82rem;
    padding: 3px 10px;
}

.note-tool-checklist-btn:hover {
    background: #1b5e20;
    border-color: #145214;
}

.note-editor-area {
    min-height: 260px;
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.7;
    color: #222;
    background: #fff;
    outline: none;
    word-break: break-word;
}

.note-editor-area:empty:before {
    content: attr(placeholder);
    color: #aaa;
    pointer-events: none;
}

/* ── Checklist Items ───────────────────────────────────────────────────── */
.note-cl-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 1px 0;
    border-radius: 5px;
    padding: 1px 4px;
    transition: background 0.12s;
}

.note-cl-item:hover {
    background: #f0f4f8;
}

.note-cl-del-btn {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: none;
    border: none;
    color: #bbb;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}

.note-editor-area .note-cl-item:hover .note-cl-del-btn {
    display: inline-flex;
}

.note-cl-del-btn:hover {
    background: #fde8e8;
    color: #c0392b;
}

.note-cl-cb {
    font-size: 1.1rem;
    line-height: 1.4;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    color: #555;
    transition: color 0.15s;
}

.note-cl-item.note-cl-done .note-cl-cb {
    color: #2e7d32;
}

.note-cl-text {
    flex: 1;
    font-size: 0.92rem;
    color: #222;
    line-height: 1.5;
    outline: none;
    min-width: 0;
    word-break: break-word;
}

.note-cl-item.note-cl-done .note-cl-text {
    text-decoration: line-through;
    color: #888;
}

.note-cl-done-badge {
    font-size: 0.72rem;
    color: #2e7d32;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

/* ── Note Detail Modal ─────────────────────────────────────────────────── */
.note-detail-meta {
    display: flex;
    gap: 18px;
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.note-detail-content {
    min-height: 120px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.7;
    background: #fafafa;
    color: #222;
    word-break: break-word;
}

/* ── Mind Map Button ───────────────────────────────────────────────────── */
.manage-btn.btn-toolbar-purple {
    background: linear-gradient(135deg, #6a1b9a 0%, #7b1fa2 100%);
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.35);
}

.manage-btn.btn-toolbar-purple:hover {
    box-shadow: 0 6px 16px rgba(106, 27, 154, 0.5);
}

/* ── Mind Map List Modal ───────────────────────────────────────────────── */
.modal-content-medium {
    max-width: 700px;
    width: 94%;
}

#mindmap-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    padding: 4px 0 8px;
}

.mindmap-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 14px 14px;
    border-radius: 12px;
    background: #f4f0fa;
    border: 1.5px solid #ce93d8;
    cursor: pointer;
    transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
    position: relative;
    text-align: center;
}

.mindmap-item:hover {
    box-shadow: 0 6px 20px rgba(106, 27, 154, 0.18);
    transform: translateY(-2px);
    border-color: #7b1fa2;
}

.mindmap-item-icon {
    font-size: 2rem;
    line-height: 1;
}

.mindmap-item-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #4a148c;
    word-break: break-word;
    max-width: 100%;
}

.mindmap-item-date {
    font-size: 0.75rem;
    color: #888;
}

.mindmap-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.mm-list-edit-btn,
.mm-list-del-btn {
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.mm-list-edit-btn {
    background: #7b1fa2;
    color: #fff;
}

.mm-list-edit-btn:hover {
    background: #4a148c;
}

.mm-list-del-btn {
    background: #fde8e8;
    color: #c0392b;
}

.mm-list-del-btn:hover {
    background: #fbbcbc;
}

/* ── Mind Map Editor Modal ─────────────────────────────────────────────── */
.mm-editor-modal-content {
    width: 96vw;
    max-width: 1300px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    overflow: hidden;
}

.mm-editor-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6a1b9a 0%, #7b1fa2 100%);
    border-radius: 15px 15px 0 0;
    flex-shrink: 0;
}

.mm-title-input {
    flex: 1;
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    min-width: 0;
}

.mm-title-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.mm-title-input:focus {
    background: rgba(255,255,255,0.28);
}

.mm-editor-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: #f8f9fa;
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.mm-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mm-tool-btn {
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.mm-tool-btn:hover:not(:disabled) {
    background: #e8e0f5;
    border-color: #7b1fa2;
    color: #4a148c;
}

.mm-tool-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.mm-tool-btn-danger {
    background: #fde8e8;
    border-color: #f5c6c6;
    color: #c0392b;
}

.mm-tool-btn-danger:hover:not(:disabled) {
    background: #fbbcbc;
    border-color: #c0392b;
    color: #922b21;
}

.mm-tool-btn-icon {
    min-width: 32px;
    text-align: center;
    font-size: 1rem;
}

.mm-toolbar-sep {
    width: 1px;
    height: 22px;
    background: #d8d8d8;
    margin: 0 4px;
    flex-shrink: 0;
}

.mm-tool-hint {
    font-size: 0.75rem;
    color: #999;
    margin-left: 4px;
    white-space: nowrap;
}

/* ── Canvas area ───────────────────────────────────────────────────────── */
.mm-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: default;
    user-select: none;
}

#mm-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.mm-node-edit-input {
    position: absolute;
    display: none;
    border: 2px solid #fff;
    border-radius: 8px;
    background: rgba(255,255,255,0.92);
    color: #222;
    font-weight: 700;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    padding: 0 10px;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.mm-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 18px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.mm-cancel-btn {
    background: #888;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.92rem;
    transition: background 0.15s;
}

.mm-cancel-btn:hover {
    background: #666;
}

/* ═══════════════════════════════════════════════════════════════════════
   API Tester
═══════════════════════════════════════════════════════════════════════ */

/* ── Toolbar Button ─────────────────────────────────────────────────── */
.manage-btn.btn-toolbar-teal {
    background: linear-gradient(135deg, #00796b 0%, #00897b 100%);
    box-shadow: 0 4px 12px rgba(0, 121, 107, 0.35);
}
.manage-btn.btn-toolbar-teal:hover {
    box-shadow: 0 6px 16px rgba(0, 121, 107, 0.5);
}

/* ── Modal sizing ──────────────────────────────────────────────────── */
.api-tester-modal-content {
    width: 98vw;
    max-width: 1400px;
    height: 92vh;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    overflow: hidden;
}

/* ── Body layout ────────────────────────────────────────────────────── */
.api-tester-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: #f4f6f8;
    padding: 14px 18px 12px;
    gap: 12px;
}

/* ── URL bar ────────────────────────────────────────────────────────── */
.api-request-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.api-method-select {
    padding: 8px 10px;
    border: 2px solid #00897b;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #00796b;
    background: #fff;
    cursor: pointer;
    min-width: 110px;
    outline: none;
}

.api-url-input {
    flex: 1;
    padding: 9px 14px;
    border: 1.5px solid #cdd3da;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}
.api-url-input:focus {
    border-color: #00897b;
}

.api-send-btn {
    padding: 9px 22px;
    background: linear-gradient(135deg, #00796b 0%, #00897b 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.api-send-btn:hover { opacity: 0.88; }
.api-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Main two-panel layout ──────────────────────────────────────────── */
.api-tester-main {
    display: grid;
    grid-template-columns: 48% 52%;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Panels ─────────────────────────────────────────────────────────── */
.api-request-panel,
.api-response-panel {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e4e8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.api-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e8ecf0;
    flex-shrink: 0;
    background: #f8f9fa;
}

.api-tab {
    padding: 9px 18px;
    font-size: 0.87rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: #777;
    transition: color 0.15s, border-color 0.15s;
}
.api-tab:hover { color: #00796b; }
.api-tab.active {
    color: #00796b;
    border-bottom-color: #00896b;
    background: #fff;
}

.api-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.api-tab-content.active { display: flex; }

/* ── Key-Value rows ─────────────────────────────────────────────────── */
.api-kv-toolbar {
    padding: 8px 12px 4px;
    flex-shrink: 0;
}
.api-add-kv-btn {
    font-size: 0.82rem;
    padding: 4px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.api-add-kv-btn:hover { background: #c8e6c9; }

.api-kv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
}

.api-kv-header {
    display: grid;
    grid-template-columns: 22px 1fr 1fr 28px;
    gap: 6px;
    padding: 3px 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.api-kv-row {
    display: grid;
    grid-template-columns: 22px 1fr 1fr 28px;
    gap: 6px;
    align-items: center;
}

.api-kv-row input[type="text"],
.api-kv-row input[type="password"] {
    padding: 5px 8px;
    border: 1px solid #d8dde3;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    min-width: 0;
}
.api-kv-row input:focus { border-color: #00897b; }
.api-kv-row input[type="checkbox"] { cursor: pointer; }

.api-kv-del-btn {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    border-radius: 4px;
    transition: background 0.12s;
}
.api-kv-del-btn:hover { background: #fde8e8; }

/* ── Auth section ────────────────────────────────────────────────────── */
.api-auth-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 6px;
    flex-shrink: 0;
}
.api-auth-row label { font-size: 0.88rem; font-weight: 600; color: #555; white-space: nowrap; }

.api-auth-section {
    display: flex;
    flex-direction: column;
    padding: 0 14px 10px;
    gap: 4px;
}
.api-auth-section label { font-size: 0.82rem; font-weight: 600; color: #666; }

.api-select {
    padding: 6px 10px;
    border: 1.5px solid #cdd3da;
    border-radius: 7px;
    font-size: 0.88rem;
    outline: none;
    background: #fff;
}
.api-select:focus { border-color: #00897b; }

.api-input-full {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #cdd3da;
    border-radius: 7px;
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
}
.api-input-full:focus { border-color: #00897b; }

/* ── Body tab ─────────────────────────────────────────────────────────── */
.api-body-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 14px 8px;
    flex-shrink: 0;
}
.api-radio-label {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.api-body-hint {
    padding: 12px 14px;
    color: #aaa;
    font-size: 0.88rem;
    font-style: italic;
}

.api-body-textarea {
    flex: 1;
    margin: 0 12px 12px;
    padding: 10px;
    border: 1.5px solid #d0d4da;
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: 'Fira Mono', 'Consolas', monospace;
    resize: none;
    outline: none;
    min-height: 0;
}
.api-body-textarea:focus { border-color: #00897b; }

/* ── Response panel ──────────────────────────────────────────────────── */
.api-response-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 0;
    flex-shrink: 0;
}
.api-response-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #444;
}
.api-response-meta {
    display: flex;
    gap: 12px;
    font-size: 0.82rem;
    font-weight: 600;
}
.api-meta-status { color: #2e7d32; }
.api-meta-status.error { color: #c0392b; }
.api-meta-time { color: #1565c0; }
.api-meta-size { color: #7b1fa2; }

.api-response-tabs {
    display: flex;
    border-bottom: 2px solid #e8ecf0;
    flex-shrink: 0;
    background: #f8f9fa;
    margin-top: 6px;
}

.api-response-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 0.84rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.55;
    min-height: 0;
}

.api-response-placeholder {
    color: #bbb;
    font-style: italic;
    font-family: inherit;
    font-size: 0.88rem;
    margin-top: 20px;
    text-align: center;
}

.api-json-key    { color: #1565c0; }
.api-json-str    { color: #2e7d32; }
.api-json-num    { color: #e65100; }
.api-json-bool   { color: #6a1b9a; }
.api-json-null   { color: #c62828; }

.api-res-headers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.api-res-headers-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}
.api-res-headers-table td:first-child {
    font-weight: 700;
    color: #1565c0;
    white-space: nowrap;
    padding-right: 16px;
    width: 35%;
}

/* ── Loading spinner ────────────────────────────────────────────────── */
.api-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    color: #888;
    font-size: 0.9rem;
}
.api-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #00897b;
    border-radius: 50%;
    animation: api-spin 0.7s linear infinite;
}
@keyframes api-spin { to { transform: rotate(360deg); } }

/* ── CORS warning ───────────────────────────────────────────────────── */
.api-cors-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 14px;
    font-size: 0.82rem;
    color: #795548;
    flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .api-tester-main {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .api-request-panel,
    .api-response-panel {
        min-height: 280px;
    }
    .api-tester-modal-content {
        height: 96vh;
    }
}
