:root {
    --page-bg: #f3f6f2;
    --panel: #fffdf7;
    --panel-strong: #f1f8ee;
    --ink: #17304d;
    --muted: #5c6b78;
    --line: #cfdbc8;
    --accent: #9a3c23;
    --accent-strong: #7b2713;
    --success: #0e6b47;
    --success-soft: #dff4e9;
    --danger: #8d1f2d;
    --danger-soft: #fae1e5;
}

* {
    box-sizing: border-box;
}

body.dtr-page {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(154, 60, 35, 0.08), transparent 30%),
        linear-gradient(180deg, #f8fbf7 0%, var(--page-bg) 100%);
    color: var(--ink);
    font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
}

.app-shell {
    width: min(1440px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.hero-card,
.panel,
.flash {
    border: 1px solid rgba(23, 48, 77, 0.08);
    box-shadow: 0 14px 40px rgba(23, 48, 77, 0.08);
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
    padding: 24px;
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 248, 238, 0.94)),
        var(--panel);
}

.hero-card h1,
.panel h2 {
    margin: 0;
}

.hero-card__eyebrow,
.panel__eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero-card__copy {
    max-width: 65ch;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.hero-card__pill {
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(160deg, #183655, #285173);
    color: #f8fbfd;
}

.hero-card__pill span {
    opacity: 0.75;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-card__pill strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.flash {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 18px;
    font-weight: 600;
}

.flash--success {
    background: var(--success-soft);
    color: var(--success);
}

.flash--error {
    background: var(--danger-soft);
    color: var(--danger);
}

.panel {
    margin-top: 20px;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 253, 247, 0.94);
    backdrop-filter: blur(10px);
}

.panel__heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

.panel__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.panel__meta span {
    padding: 7px 12px;
    border-radius: 999px;
    background: #f1f8ee;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.filters-form,
.report-controls {
    display: grid;
    gap: 14px;
}

.filters-form {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
}

.filters-form label,
.report-controls label {
    display: grid;
    gap: 6px;
}

.filters-form span,
.report-controls span {
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.filters-form input,
.filters-form select,
.report-controls select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 14px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.toggle {
    align-self: center;
    justify-self: start;
}

.toggle input {
    width: auto;
    min-height: auto;
    margin-right: 10px;
}

.toggle span {
    display: inline;
    letter-spacing: 0.06em;
}

.filters-actions,
.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filters-actions {
    grid-column: 1 / -1;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--ink);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(23, 48, 77, 0.1);
}

.button--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: transparent;
    color: #fff;
}

.button--ghost {
    border-style: dashed;
}

.button--disabled,
.button[disabled] {
    pointer-events: none;
    opacity: 0.48;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.table-shell {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.panel--logs {
    padding: 16px 16px 18px;
}

.panel--logs .table-shell {
    max-height: 560px;
}

.panel--report {
    position: relative;
    padding: 22px;
    background:
        radial-gradient(circle at top right, rgba(154, 60, 35, 0.09), transparent 28%),
        linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(241, 248, 238, 0.96));
    box-shadow: 0 24px 52px rgba(23, 48, 77, 0.12);
}

.panel--report::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(23, 48, 77, 0.06);
    border-radius: 20px;
    pointer-events: none;
}

.panel--report > * {
    position: relative;
    z-index: 1;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
    table-layout: fixed;
}

.logs-table th,
.logs-table td {
    padding: 10px 11px;
    border-bottom: 1px solid rgba(207, 219, 200, 0.75);
    text-align: left;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logs-table th {
    position: sticky;
    top: 0;
    background: #eef6ea;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.logs-table__empty {
    text-align: center;
    color: var(--muted);
    padding: 24px 14px;
}

.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.pager__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.pager__button.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.pager__text {
    color: var(--muted);
    font-weight: 700;
}

.report-controls {
    grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.6fr);
    align-items: end;
    padding: 16px;
    border: 1px solid rgba(23, 48, 77, 0.08);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 248, 238, 0.9));
}

.report-preview-caption {
    margin: 16px 0 14px;
    padding: 12px 14px;
    border-left: 4px solid var(--accent);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
    font-weight: 600;
    line-height: 1.5;
}

.report-frame {
    overflow: hidden;
    padding: 14px;
    border: 2px solid rgba(23, 48, 77, 0.08);
    border-radius: 30px;
    background:
        radial-gradient(circle at top, rgba(23, 48, 77, 0.06), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 243, 247, 0.94));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.5),
        0 28px 56px rgba(23, 48, 77, 0.14);
}

.report-frame__browser {
    display: block;
    width: 100%;
    height: clamp(780px, 84vh, 1200px);
    border: 0;
    border-radius: 22px;
    background: #fff;
}

.report-sheet {
    padding: 20px;
    border: 2px solid rgba(23, 48, 77, 0.1);
    border-radius: 24px;
    background: #fff;
}

.report-sheet__empty {
    display: grid;
    place-items: center;
    min-height: 260px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(241, 248, 238, 0.5), rgba(255, 255, 255, 0.9));
    text-align: center;
}

.report-sheet__empty h3 {
    margin: 0 0 8px;
}

.report-sheet__empty p {
    margin: 0;
    color: var(--muted);
}

.report-sheet__topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.82rem;
}

.report-sheet__heading {
    margin: 14px 0 18px;
    text-align: center;
}

.report-sheet__brand {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.report-sheet__title {
    margin-top: 4px;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.report-sheet__identity {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.identity-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    align-items: end;
    border-bottom: 1px solid var(--line);
    padding-bottom: 5px;
}

.identity-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.identity-value {
    font-weight: 700;
}

.report-sheet__tables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.report-sheet__tables--single {
    grid-template-columns: minmax(0, 1fr);
}

.report-table-card {
    display: grid;
    gap: 8px;
}

.report-table-card__title {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.report-table th,
.report-table td {
    padding: 6px 5px;
    border: 1px solid var(--line);
    text-align: center;
}

.report-table th {
    background: #f2f7f0;
    color: var(--muted);
}

.report-sheet__footnote {
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.report-sheet__signature {
    margin-top: 24px;
    text-align: center;
}

.signature-line {
    width: 320px;
    max-width: 100%;
    margin: 0 auto 8px;
    border-top: 1px solid var(--ink);
}

.signature-name {
    font-weight: 800;
}

.signature-designation,
.signature-role {
    color: var(--muted);
    font-size: 0.82rem;
}

@media (max-width: 1180px) {
    .hero-card,
    .workspace-grid,
    .report-controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel--report {
        order: -1;
    }

    .panel--logs .table-shell {
        max-height: 440px;
    }

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

@media (max-width: 720px) {
    .app-shell {
        width: min(100vw - 20px, 1440px);
        padding-top: 14px;
    }

    .hero-card,
    .panel {
        padding: 16px;
        border-radius: 20px;
    }

    .filters-form,
    .report-controls,
    .report-sheet__tables {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel--report {
        padding: 18px;
    }

    .panel--logs .table-shell {
        max-height: 360px;
    }

    .report-frame {
        padding: 10px;
    }

    .report-frame__browser {
        height: clamp(620px, 72vh, 900px);
    }

    .identity-row {
        grid-template-columns: minmax(0, 1fr);
    }
}
