:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --panel: #ffffff;
    --ink: #172026;
    --muted: #5e6b73;
    --line: #d9e0e4;
    --accent: #0d6b61;
    --accent-dark: #084d47;
    --danger: #a82222;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 64px;
    padding: 0 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--ink);
    text-decoration: none;
}

.brand img {
    display: block;
    width: auto;
    height: 38px;
    max-width: min(180px, 58vw);
}

nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

nav a {
    color: var(--accent-dark);
    text-decoration: none;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

h1, h2, p {
    margin-top: 0;
}

p {
    color: var(--muted);
}

.tool-header,
.results-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.panel,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.login-panel {
    width: min(440px, 100%);
    margin: 80px auto;
}

.url-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, auto) auto;
    align-items: end;
    gap: 16px;
}

.crawl-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 10px;
}

.mode-option {
    min-height: 70px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    color: var(--ink);
}

.mode-option input {
    width: 18px;
    min-height: 18px;
}

.mode-option span {
    display: grid;
    gap: 3px;
}

.mode-option small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.3;
}

.advanced-options {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.advanced-options summary {
    color: var(--accent-dark);
    cursor: pointer;
    font-weight: 700;
}

.advanced-options label {
    width: min(320px, 100%);
    margin-top: 12px;
}

.check-label {
    min-height: 44px;
    grid-template-columns: auto 1fr;
    align-items: center;
    color: var(--ink);
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
}

select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.secondary {
    background: #e7ecef;
    color: var(--ink);
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.source-list {
    min-width: 220px;
    margin: 0;
    padding-left: 18px;
}

.source-list a {
    color: var(--accent-dark);
    overflow-wrap: anywhere;
}

.status-panel {
    margin-top: 18px;
}

.analysis-progress {
    margin-top: 18px;
}

.progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.timer {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 14px;
    background: #f7faf9;
    color: var(--accent-dark);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.progress-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f7faf9;
}

.progress-grid strong {
    display: block;
    color: var(--ink);
    font-size: 26px;
    line-height: 1;
}

.progress-grid span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.current-url {
    margin: 16px 0 0;
    overflow-wrap: anywhere;
}

.live-results-head {
    margin-top: 24px;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 9px;
    background: #e8f4f2;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
}

.error {
    margin-top: 16px;
    color: var(--danger);
    font-weight: 700;
}

.hint {
    margin: 14px 0 0;
    font-size: 14px;
}

@media (max-width: 760px) {
    .topbar,
    .tool-header,
    .results-head,
    .progress-head,
    .url-form,
    .crawl-options {
        display: grid;
    }

    .progress-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        padding: 16px;
    }

    .actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 520px) {
    .progress-grid {
        grid-template-columns: 1fr;
    }
}
