:root {
    --bg: #f4f1eb;
    --panel: #fffdf8;
    --ink: #10201d;
    --muted: #63736e;
    --line: #ded7cc;
    --brand: #0b7770;
    --brand-dark: #075a55;
    --brand-soft: #e2f7f1;
    --danger: #b33a3a;
    --danger-soft: #fff1ef;
    --accent: #c88b2f;
    --deep: #0b3d3a;
    --shadow: 0 18px 50px rgba(41, 35, 24, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: linear-gradient(180deg, rgba(11, 61, 58, 0.08), rgba(244, 241, 235, 0) 280px), var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea {
    font: inherit;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 14px 0;
    display: grid;
    grid-template-rows: auto auto minmax(520px, 1fr) auto auto;
    gap: 10px;
}

.topbar,
.workspace,
.intro-panel,
.file-panel,
.assurance-item,
.stats-panel,
.stats-grid div,
.stats-header {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar {
    min-height: 52px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 760;
    font-size: 1.05rem;
    letter-spacing: 0;
}

.brand img {
    border-radius: 8px;
}

.status-line {
    color: var(--muted);
    font-size: 0.94rem;
    text-align: right;
    overflow-wrap: anywhere;
}

.intro-panel {
    min-height: 108px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
    gap: 16px;
    align-items: center;
}

.intro-copy {
    max-width: 780px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 760;
    letter-spacing: 0;
    text-transform: uppercase;
}

.intro-copy h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2.55rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.intro-copy p:last-child {
    max-width: 680px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.42;
}

.trust-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.trust-strip span {
    min-height: 30px;
    display: flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid #cde8df;
    border-radius: 8px;
    background: var(--brand-soft);
    color: #174d48;
    font-size: 0.84rem;
    font-weight: 650;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(420px, 1fr) auto;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tool-row {
    min-height: 54px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
}

.button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf1;
    color: var(--ink);
    padding: 0 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button:hover:not(:disabled) {
    border-color: var(--accent);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.button-primary:hover:not(:disabled) {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.button-danger {
    background: var(--danger-soft);
    border-color: #efc3bc;
    color: var(--danger);
}

.button:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(66, 214, 180, 0.35);
    outline-offset: 2px;
}

.select-label {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

select {
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 0 10px;
}

#clipText {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    resize: none;
    border: 0;
    outline: 0;
    padding: 18px;
    background: #fffefb;
    color: var(--ink);
    font-size: 1.04rem;
    line-height: 1.62;
}

#clipText::placeholder {
    color: #9b998f;
}

.meta-row {
    min-height: 40px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.92rem;
}

.assurance-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.file-panel {
    padding: 10px;
    display: grid;
    gap: 8px;
}

.file-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.file-panel-head div {
    display: grid;
    gap: 3px;
}

.file-panel-head span,
.file-drop,
.file-meta {
    color: var(--muted);
    font-size: 0.94rem;
}

.button-secondary input {
    display: none;
}

.file-drop {
    min-height: 46px;
    border: 1px dashed #b9d8cf;
    border-radius: 8px;
    background: #f8fffc;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 14px;
}

.file-drop.is-over {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: #174d48;
}

.file-list {
    display: grid;
    gap: 8px;
}

.file-row {
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf1;
}

.file-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.file-meta {
    margin-top: 2px;
}

.assurance-item {
    min-height: 88px;
    padding: 10px;
    display: grid;
    align-content: start;
    gap: 8px;
}

.assurance-item span {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.32;
}

.assurance-item code {
    padding: 1px 5px;
    border-radius: 5px;
    background: #eee7dd;
    color: var(--deep);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
    pointer-events: none;
    min-height: 42px;
    max-width: min(460px, calc(100% - 32px));
    padding: 10px 14px;
    border-radius: 8px;
    background: #17201b;
    color: #fff;
    box-shadow: var(--shadow);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.stats-shell {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
    display: grid;
    gap: 16px;
}

.stats-header {
    min-height: 70px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stats-grid div {
    min-height: 110px;
    padding: 18px;
    display: grid;
    align-content: center;
    gap: 4px;
}

.stats-grid strong {
    font-size: 2rem;
}

.stats-grid span {
    color: var(--muted);
}

.stats-panel {
    padding: 18px;
    overflow: auto;
}

.stats-panel h1 {
    margin: 0 0 14px;
    font-size: 1.2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th,
td {
    padding: 11px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.94rem;
}

th {
    color: var(--muted);
    font-weight: 650;
}

@media (max-width: 900px) {
    .intro-panel,
    .assurance-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: 100%;
        padding: 0;
        gap: 0;
    }

    .topbar,
    .workspace,
    .intro-panel,
    .file-panel,
    .assurance-item,
    .stats-header,
    .stats-grid div,
    .stats-panel {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .intro-panel {
        padding: 14px 16px;
    }

    .intro-copy h1 {
        font-size: 1.75rem;
        line-height: 1.03;
    }

    .trust-strip {
        justify-content: flex-start;
    }

    .select-label {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .meta-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .file-panel-head,
    .file-row {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .file-panel-head {
        flex-direction: column;
    }

    .assurance-grid,
    .stats-grid {
        gap: 0;
    }

    .stats-shell {
        width: 100%;
        padding: 0;
    }
}
