* {
    box-sizing: border-box;
}

html {
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
    background: #fff;
}

body {
    margin: 0;
}

.container {
    width: min(1140px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    background: #222;
    min-height: 50px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 50px;
}

.nav a {
    color: #cfcfcf;
    text-decoration: none;
    font-size: 14px;
}

.nav a:hover {
    color: #fff;
}

.brand {
    color: #fff;
    font-size: 18px;
    margin-right: 12px;
}

.page {
    padding-top: 2px;
}

.hero {
    background: #eee;
    border-radius: 4px;
    margin-top: 0;
    padding: 64px 60px;
}

.hero h1 {
    font-size: 64px;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0 0 14px;
}

.hero p {
    max-width: 980px;
    font-size: 22px;
    line-height: 1.38;
    margin: 0 0 18px;
}

.primary-button,
.secondary-button {
    display: inline-block;
    text-decoration: none;
    border-radius: 4px;
    line-height: 1;
}

.primary-button {
    background: #337ab7;
    color: #fff;
    font-size: 18px;
    padding: 14px 18px;
}

.secondary-button {
    color: #333;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 14px;
    padding: 10px 14px;
}

.columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
    margin-top: 48px;
}

.columns h2 {
    font-size: 32px;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0 0 10px;
}

.columns p {
    min-height: 92px;
    font-size: 14px;
    line-height: 1.45;
    margin: 0 0 12px;
}

.footer {
    border-top: 1px solid #e5e5e5;
    margin-top: 30px;
    padding: 24px 0;
    font-size: 14px;
}

code {
    font-family: Consolas, "Courier New", monospace;
}

.tool-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 32px 0 18px;
}

.tool-header h1 {
    font-size: 36px;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0 0 6px;
}

.tool-header p {
    margin: 0;
    color: #555;
}

.load-panel,
.log-panel {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 18px;
}

.load-form {
    display: grid;
    grid-template-columns: 2fr repeat(5, minmax(120px, 1fr)) auto auto;
    gap: 12px;
    align-items: end;
}

.load-form label {
    display: grid;
    gap: 5px;
    color: #555;
    font-size: 13px;
}

.load-form input {
    width: 100%;
    height: 38px;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
}

.load-form button {
    height: 38px;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
}

.load-form button:disabled {
    cursor: wait;
    opacity: .65;
}

.notice-text {
    color: #8a5a00;
    min-height: 20px;
    margin: 12px 0 0;
}

.progress-shell {
    margin-top: 18px;
}

.progress-meta,
.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.progress-track {
    height: 14px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: #337ab7;
    transition: width .18s ease;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 18px;
}

.metric-grid div {
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 12px;
    min-width: 0;
    border-left-width: 5px;
}

.metric-grid span {
    display: block;
    font-size: 24px;
    line-height: 1.1;
}

.metric-grid small,
.log-header span {
    color: #666;
}

.metric-grid em {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.metric-neutral {
    background: #fafafa;
    border-left-color: #8b8b8b !important;
}

.metric-neutral em {
    color: #666;
}

.metric-good {
    background: #f1f8f3;
    border-left-color: #2e7d32 !important;
}

.metric-good em {
    color: #2e7d32;
}

.metric-warn {
    background: #fff8e6;
    border-left-color: #b26a00 !important;
}

.metric-warn em {
    color: #8a5a00;
}

.metric-bad {
    background: #fff1f1;
    border-left-color: #c62828 !important;
}

.metric-bad em {
    color: #c62828;
}

.log-header h2 {
    font-size: 24px;
    font-weight: 400;
    margin: 0;
}

.log-table-wrap {
    max-height: 480px;
    overflow: auto;
    margin-top: 12px;
    border: 1px solid #eee;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}

.log-table th,
.log-table td {
    border-bottom: 1px solid #eee;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.log-table th {
    position: sticky;
    top: 0;
    background: #f8f8f8;
    z-index: 1;
}

.log-table .ok td:first-child {
    border-left: 4px solid #2e7d32;
}

.log-table .fail td:first-child {
    border-left: 4px solid #c62828;
}

@media (max-width: 800px) {
    .hero {
        padding: 40px 28px;
    }

    .hero h1 {
        font-size: 42px;
    }

    .hero p {
        font-size: 18px;
    }

    .columns {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .columns p {
        min-height: 0;
    }

    .tool-header,
    .progress-meta,
    .log-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .load-form,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Load-test nâng cao: tách cấu hình burst, editor payload và số liệu nghiệp vụ. */
.server-limit-banner,
.result-breakdown,
.load-note {
    border: 1px solid #d8e5ef;
    border-radius: 6px;
    background: #f5f9fc;
    padding: 12px 14px;
    color: #334;
    line-height: 1.45;
}

.server-limit-banner {
    margin-bottom: 16px;
}

.load-config-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.load-config-grid label {
    display: grid;
    gap: 5px;
    color: #555;
    font-size: 13px;
}

.load-config-grid input,
.load-config-grid select {
    width: 100%;
    min-width: 0;
    height: 38px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
    padding: 8px 10px;
    font-size: 14px;
}

.load-actions,
.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.load-actions {
    margin-top: 14px;
}

.load-actions button,
.editor-actions button,
.editor-heading > button {
    border-radius: 4px;
    cursor: pointer;
}

.load-actions button:disabled,
.editor-actions button:disabled,
.editor-heading > button:disabled {
    cursor: wait;
    opacity: .65;
}

.danger-button {
    border: 1px solid #b3261e;
    background: #fff;
    color: #b3261e;
    padding: 10px 14px;
}

.load-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.load-editor-panel {
    min-width: 0;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 14px;
    background: #fafafa;
}

.editor-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.editor-heading h2 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 500;
}

.editor-heading p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

.load-editor-panel textarea {
    width: 100%;
    min-height: 500px;
    resize: vertical;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
    padding: 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    tab-size: 2;
}

.variables-panel textarea {
    min-height: 130px;
}

.organization-editor-panel {
    margin-top: 18px;
}

.organization-editor-panel textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
    padding: 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
}

.organization-editor-panel[hidden] {
    display: none;
}

.organization-config-note {
    margin: 10px 0 0;
    color: #8a5a00;
    font-size: 13px;
}

.variable-help {
    margin-top: 14px;
    color: #555;
    font-size: 13px;
    line-height: 1.45;
}

.variable-help h3 {
    margin: 16px 0 8px;
    color: #333;
    font-size: 14px;
}

.variable-help p {
    margin: 7px 0;
}

.variable-help > code {
    display: inline-block;
    margin: 2px 3px 2px 0;
    padding: 3px 5px;
    border-radius: 3px;
    background: #e9eef2;
}

.variable-help pre {
    overflow: auto;
    margin: 6px 0;
    padding: 8px;
    border-radius: 4px;
    background: #20252a;
    color: #f5f5f5;
    font-size: 12px;
}

.notice-error {
    color: #b3261e;
}

.notice-warn {
    color: #8a5a00;
}

.notice-success {
    color: #2e7d32;
}

.load-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
    margin-top: 12px;
    font-size: 13px;
}

.organization-summary-wrap {
    margin-top: 16px;
}

.organization-summary-wrap h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.organization-table-wrap {
    max-height: 300px;
}

.organization-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.organization-summary-table th,
.organization-summary-table td {
    border-bottom: 1px solid #e5e5e5;
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
}

.organization-summary-table th:first-child,
.organization-summary-table td:first-child,
.organization-summary-table th:nth-child(2),
.organization-summary-table td:nth-child(2) {
    text-align: left;
}

.log-summary {
    display: grid;
    justify-items: end;
    gap: 5px;
    text-align: right;
}

.log-header small {
    color: #666;
}

.load-note {
    margin-bottom: 24px;
}

.log-table th:nth-child(1) { width: 5%; }
.log-table th:nth-child(2) { width: 10%; }
.log-table th:nth-child(3) { width: 7%; }
.log-table th:nth-child(4) { width: 11%; }
.log-table th:nth-child(5) { width: 11%; }
.log-table th:nth-child(6) { width: 20%; }
.log-table th:nth-child(7) { width: 36%; }

@media (max-width: 1000px) {
    .load-config-grid,
    .load-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .load-editor-grid,
    .result-breakdown {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .load-config-grid,
    .load-metric-grid {
        grid-template-columns: 1fr;
    }

    .editor-heading,
    .log-summary {
        align-items: flex-start;
        justify-items: start;
        flex-direction: column;
        text-align: left;
    }

    .load-editor-panel textarea {
        min-height: 360px;
    }
}
