:root {
    color-scheme: light;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --green: #059669;
    --green-dark: #047857;
    --green-soft: #ecfdf5;
    --green-line: #a7f3d0;
    --blue: #2563eb;
    --blue-soft: #eff6ff;
    --blue-line: #dbeafe;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --amber-line: #fde68a;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --red-line: #fecaca;
    --terminal: #0f172a;
    --terminal-line: rgba(30, 41, 59, 0.85);
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

.shell {
    width: min(896px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0;
    color: var(--green);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 4px 0 0;
    color: var(--text);
    font-size: 28px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0;
}

.search {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.search-inner {
    max-width: 576px;
}

.search label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.search-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-icon::before,
.input-icon::after {
    content: "";
    position: absolute;
    background: #94a3b8;
}

.input-icon::before {
    left: 2px;
    right: 2px;
    top: 6px;
    height: 2px;
}

.input-icon::after {
    left: 6px;
    top: 2px;
    bottom: 2px;
    width: 2px;
}

input {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 16px 0 44px;
    direction: ltr;
    text-align: left;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder {
    color: #94a3b8;
}

input:focus {
    background: #fff;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    min-height: 50px;
    border-radius: 12px;
    padding: 0 24px;
    background: var(--green);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background-color 0.16s ease, opacity 0.16s ease;
}

.search button:hover {
    background: var(--green-dark);
}

.search button:disabled {
    opacity: 0.72;
    cursor: wait;
}

.button-icon {
    position: relative;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.button-icon::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 7px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(45deg);
}

.button-spinner {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: conic-gradient(currentColor 0 100deg, rgba(255, 255, 255, 0.35) 100deg 260deg, transparent 260deg 360deg);
    animation: spin 0.82s linear infinite;
}

.button-spinner::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: inherit;
    background: var(--green);
}

.summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.summary-item.warning {
    border-color: var(--amber-line);
    background: rgba(255, 251, 235, 0.45);
}

.summary-item.fault,
.summary-item.error {
    border-color: var(--red-line);
    background: rgba(254, 242, 242, 0.55);
}

.summary-item.ok,
.summary-item.success {
    border-color: var(--green-line);
    background: rgba(236, 253, 245, 0.42);
}

.summary-label {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: uppercase;
}

.summary-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
    text-align: left;
    color: var(--text-soft);
    font-size: 16px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.summary-value.warning {
    color: var(--amber);
}

.summary-value.ok,
.summary-value.success {
    color: var(--green);
}

.summary-value.fault,
.summary-value.error {
    color: var(--red);
}

.activity {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 32px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.activity-toggle {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    color: var(--text-soft);
    background: var(--surface-soft);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.16s ease;
}

.activity-toggle:hover {
    background: rgba(241, 245, 249, 0.72);
}

.activity-toggle[aria-expanded="true"] {
    border-bottom: 1px solid var(--line);
}

.activity-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: uppercase;
}

.activity-icon {
    position: relative;
    display: inline-flex;
    width: 17px;
    height: 13px;
    border: 1.8px solid var(--muted);
    border-radius: 3px;
}

.activity-icon::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 4px;
    width: 5px;
    height: 5px;
    border-top: 1.8px solid var(--muted);
    border-right: 1.8px solid var(--muted);
    transform: rotate(45deg);
}

.activity-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid var(--blue-line);
    border-radius: 999px;
    padding: 2px 10px;
    background: var(--blue-soft);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 500;
}

.activity-state.running,
.activity-state.warning {
    border-color: var(--amber-line);
    background: var(--amber-soft);
    color: var(--amber);
}

.activity-state.finished,
.activity-state.ok,
.activity-state.success {
    border-color: var(--green-line);
    background: var(--green-soft);
    color: var(--green);
}

.activity-state.error,
.activity-state.fault {
    border-color: var(--red-line);
    background: var(--red-soft);
    color: var(--red);
}

.log-list {
    display: grid;
    gap: 0;
    max-height: 260px;
    overflow: auto;
    margin: 0;
    padding: 16px 24px;
    list-style: none;
    background: var(--terminal);
    color: #cbd5e1;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

.log-item {
    display: grid;
    grid-template-columns: 88px 24px 1fr;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--terminal-line);
}

.log-item:last-child {
    border-bottom: 0;
}

.log-time {
    direction: ltr;
    text-align: left;
    color: #64748b;
}

.log-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #94a3b8;
    font-weight: 900;
    line-height: 1;
}

.log-text {
    color: #cbd5e1;
}

.log-item.ok .log-mark,
.log-item.success .log-mark,
.log-item.ok .log-text,
.log-item.success .log-text {
    color: #34d399;
}

.log-item.warning .log-mark,
.log-item.warning .log-text {
    color: #fbbf24;
}

.log-item.fault .log-mark,
.log-item.error .log-mark,
.log-item.fault .log-text,
.log-item.error .log-text {
    color: #f87171;
}

.results {
    display: grid;
    gap: 24px;
}

.ticket-report {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ticket-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 54px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.ticket-report h2 {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.ticket-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ticket-copy,
.ticket-share,
.share-link-copy,
.topbar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border: 1px solid var(--green-line);
    border-radius: 8px;
    padding: 0 14px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.ticket-copy:hover,
.ticket-share:hover,
.share-link-copy:hover,
.topbar-action:hover {
    border-color: var(--green);
    background: #d1fae5;
}

.ticket-share:disabled,
.share-link-copy:disabled {
    opacity: 0.65;
    cursor: wait;
}

.ticket-share[hidden],
.share-link-panel[hidden] {
    display: none;
}

.ticket-report-text {
    margin: 0;
    padding: 16px 20px 18px;
    background: #fff;
    color: var(--text-soft);
    direction: ltr;
    text-align: left;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.share-link-panel {
    display: grid;
    gap: 8px;
    padding: 14px 20px 16px;
    border-top: 1px solid var(--line);
    background: var(--green-soft);
}

.share-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.share-link-input {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--green-line);
    border-radius: 8px;
    background: #fff;
    color: var(--text-soft);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

.share-link-status {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.share-link-status.success {
    color: var(--green-dark);
}

.share-link-status.error {
    color: var(--red);
}

.topbar-action {
    flex: 0 0 auto;
    text-decoration: none;
}

.shared-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--line);
    box-shadow: var(--shadow);
}

.shared-meta > div {
    display: grid;
    gap: 3px;
    padding: 14px 16px;
    background: var(--surface);
}

.shared-meta span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.shared-meta strong {
    color: var(--text-soft);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.category {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 252, 0.72);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: var(--muted);
    font-size: 0;
    font-weight: 700;
}

.category.ok .category-icon {
    color: var(--green);
}

.category.warning .category-icon,
.category.running .category-icon {
    color: var(--amber);
}

.category.fault .category-icon,
.category.error .category-icon {
    color: var(--red);
}

.category.skipped .category-icon,
.category.pending .category-icon {
    color: var(--muted);
}

.module-list {
    display: grid;
}

.module {
    display: block;
    border-bottom: 1px solid var(--line-soft);
}

.module:last-child {
    border-bottom: 0;
}

.module.running {
    background: rgba(236, 253, 245, 0.35);
}

.module-summary {
    width: 100%;
    min-height: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px 24px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.16s ease;
}

.module-summary:hover {
    background: rgba(248, 250, 252, 0.78);
}

.module.details-disabled .module-summary {
    cursor: default;
}

.module.details-disabled .module-summary:hover {
    background: transparent;
}

.module-heading {
    display: flex;
    align-items: center;
    min-width: 0;
}

.module-title {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.module-title > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-meta,
.module-time {
    color: #94a3b8;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    font-weight: 500;
    direction: ltr;
    text-align: left;
    white-space: nowrap;
}

.module-overview {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    min-width: 0;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
    max-width: min(100%, 520px);
}

.chevron {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    width: 24px;
    min-width: 24px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    transition: transform 0.16s ease;
}

.chevron::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg);
}

.module.expanded .chevron {
    transform: rotate(180deg);
}

.module-details {
    display: grid;
    gap: 10px;
    padding: 16px 24px 18px;
    border-top: 1px solid var(--line-soft);
    background: #fff;
}

.module-details[hidden],
.log-list[hidden],
.summary[hidden],
.activity[hidden],
.ticket-report[hidden] {
    display: none;
}

.module-data {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.kv {
    display: grid;
    grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: 12px 20px;
    min-width: 0;
}

.kv-key {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.kv-value {
    min-width: 0;
    direction: ltr;
    text-align: left;
    color: var(--text-soft);
    font-size: 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message {
    margin: 0;
    color: var(--muted);
}

.message.error {
    color: var(--red);
}

.message.warning {
    color: var(--amber);
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 96px;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    min-width: 16px;
    height: 16px;
    line-height: 1;
}

.status-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: currentColor;
    flex: 0 0 auto;
    overflow: hidden;
}

.status-icon.ok::before,
.status-icon.success::before {
    content: "";
    width: 11px;
    height: 6px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-1px) rotate(-45deg);
}

.status-icon.warning::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 15px solid currentColor;
}

.status-icon.warning::after {
    content: "!";
    position: absolute;
    top: 3px;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.status-icon.error::before,
.status-icon.error::after,
.status-icon.fault::before,
.status-icon.fault::after {
    content: "";
    position: absolute;
    width: 13px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.status-icon.error::before,
.status-icon.fault::before {
    transform: rotate(45deg);
}

.status-icon.error::after,
.status-icon.fault::after {
    transform: rotate(-45deg);
}

.status-icon.info::before {
    content: "i";
    width: 16px;
    height: 16px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.status-icon.pending::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-icon.skipped::before {
    content: "";
    width: 12px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.category-icon.status-icon {
    width: 22px;
    min-width: 22px;
    height: 22px;
}

.status-mark.status-icon {
    width: 16px;
    min-width: 16px;
    height: 16px;
}

.log-mark.status-icon {
    width: 20px;
    min-width: 20px;
    height: 20px;
}

.status-mark.status-icon.warning::before {
    border-left-width: 7px;
    border-right-width: 7px;
    border-bottom-width: 13px;
}

.status-mark.status-icon.warning::after {
    top: 3px;
    font-size: 8px;
}

.chip.ok,
.chip.success {
    color: var(--green);
    border-color: var(--green-line);
    background: var(--green-soft);
}

.chip.pending {
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface-soft);
}

.chip.running {
    color: var(--green);
    border-color: var(--green-line);
    background: var(--green-soft);
}

.chip.warning,
.chip.info {
    color: var(--amber);
    border-color: var(--amber-line);
    background: var(--amber-soft);
}

.chip.fault,
.chip.error {
    color: var(--red);
    border-color: var(--red-line);
    background: var(--red-soft);
}

.chip.skipped {
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface-soft);
}

.status-icon.running {
    position: relative;
    width: 18px;
    min-width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: conic-gradient(from 35deg, var(--green) 0 95deg, rgba(5, 150, 105, 0.26) 95deg 210deg, rgba(5, 150, 105, 0.08) 210deg 300deg, transparent 300deg 360deg);
    color: transparent;
    flex: 0 0 auto;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    animation: spin 0.82s linear infinite;
}

.status-icon.running::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: inherit;
    background: var(--green-soft);
}

.log-item.running .status-icon.running::after {
    background: var(--terminal);
}

.category .status-icon.running::after {
    background: var(--surface-soft);
}

.empty {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 20px;
    color: var(--muted);
    box-shadow: var(--shadow);
}

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

@media (max-width: 760px) {
    .shell {
        width: min(100% - 24px, 896px);
        padding: 28px 0;
    }

    .topbar {
        display: grid;
        align-items: flex-start;
    }

    .search {
        padding: 20px;
    }

    .search-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .search button {
        width: 100%;
    }

    .summary {
        grid-template-columns: 1fr;
    }

    .shared-meta,
    .share-link-row {
        grid-template-columns: 1fr;
    }

    .ticket-report-header {
        align-items: flex-start;
    }

    .ticket-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .category-header {
        align-items: flex-start;
    }

    .module-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .module-overview {
        white-space: normal;
    }

    .module-status {
        justify-content: space-between;
    }

    .kv {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .log-list {
        padding: 14px 16px;
    }

    .log-item {
        grid-template-columns: 76px 22px 1fr;
    }
}

@media (min-width: 640px) {
    .search {
        padding: 32px;
    }
}
