:root {
    /* Thomax brand tokens (sampled from thomax.com) */
    --ink: #0f1423;
    --muted: #5f646e;
    --blue-deep: #002db2;
    --blue: #1863dc;
    --cyan: #00b5ff;
    --line: #d2dade;
    --surface: #ffffff;
    --bg: #f5f7fb;
    --bg-2: #eaf0f8;
    --shadow-sm: 0 1px 2px rgba(15, 20, 35, 0.06);
    --shadow: 0 1px 2px rgba(15, 20, 35, 0.06), 0 10px 28px rgba(15, 20, 35, 0.08);
    --shadow-lg: 0 4px 10px rgba(15, 20, 35, 0.08), 0 20px 40px rgba(15, 20, 35, 0.12);
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: radial-gradient(1200px 600px at 100% -10%, var(--bg-2), transparent 60%), var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 40px 24px 96px;
}

/* ---- Header / brand band ---- */
.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 28px;
    margin-bottom: 40px;
    border-radius: var(--radius);
    background:
        radial-gradient(600px 200px at 90% -40%, rgba(0, 181, 255, 0.35), transparent 70%),
        linear-gradient(120deg, #05123f, var(--blue-deep) 60%, #0b57d0);
    box-shadow: var(--shadow);
}
.logo {
    height: 30px;
    width: auto;
    display: block;
}
.topbar-sep {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.28);
}
.page-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.01em;
}

/* ---- Signed-in user chip ---- */
.user-chip {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-email {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.logout {
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 5px 12px;
    border-radius: 8px;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.logout:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.6); }

/* ---- Cards ---- */
.card {
    padding: 26px 28px;
    margin-bottom: 22px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}
.card h2 {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 600;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(120deg, var(--blue-deep), var(--blue));
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}
th {
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tr:hover td { background: var(--bg); }

/* ---- Misc ---- */
.muted { color: var(--muted); }
code, pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}
pre {
    padding: 14px;
    border-radius: 8px;
    background: var(--bg-2);
    overflow-x: auto;
}

/* ================================================================
   Text Compare
   ================================================================ */

.page { max-width: 1400px; }

/* ---- Inputs ---- */
.inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.input-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}
.input-head label {
    font-weight: 600;
    font-size: 14px;
}
.input-actions { display: flex; gap: 12px; }
.link-btn {
    border: 0;
    padding: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--blue);
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
textarea {
    width: 100%;
    height: 260px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    tab-size: 4;
}
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24, 99, 220, 0.15);
}
textarea.drop {
    border-color: var(--cyan);
    background: var(--bg-2);
}
.input-meta {
    min-height: 18px;
    margin-top: 4px;
    font-size: 12px;
}

/* ---- Controls ---- */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin-top: 14px;
}
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 14px;
}
.options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.buttons { display: flex; gap: 12px; align-items: center; }
.btn-secondary {
    color: var(--ink);
    background: var(--bg-2);
}
.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 9px;
    background: var(--bg-2);
}
.segmented button {
    border: 0;
    padding: 6px 14px;
    border-radius: 7px;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}
.segmented button.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
.privacy {
    margin: 14px 0 0;
    font-size: 12px;
}

/* ---- Result ---- */
.result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.result-head h2 { margin: 0; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.chip--change { background: #fef3c7; color: #92400e; }
.chip--del { background: #fee2e2; color: #991b1b; }
.chip--ins { background: #dcfce7; color: #166534; }
.chip--warn { background: var(--bg-2); color: var(--muted); cursor: help; }
.empty, .identical { margin: 0; }
.identical { color: #166534; font-weight: 500; }

.result {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.result:has(> p) { border: 0; }

table.diff {
    table-layout: fixed;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
}
table.diff td {
    padding: 0 10px;
    border: 0;
    vertical-align: top;
}
table.diff tr:hover td { background: inherit; }
table.diff col.col-num { width: 52px; }
table.diff td.num {
    padding: 0 8px;
    text-align: right;
    color: var(--muted);
    background: var(--bg);
    user-select: none;
}
table.diff td.code {
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 4;
}
.diff--split td.code:nth-child(2) { border-right: 1px solid var(--line); }

table.diff td.del { background: #fef2f2; }
table.diff td.ins { background: #f0fdf4; }
table.diff td.num.del { background: #fee2e2; color: #991b1b; }
table.diff td.num.ins { background: #dcfce7; color: #166534; }
table.diff td.blank { background: repeating-linear-gradient(135deg, var(--bg), var(--bg) 4px, var(--surface) 4px, var(--surface) 8px); }
table.diff td.del mark { background: #fca5a5; color: inherit; border-radius: 2px; }
table.diff td.ins mark { background: #86efac; color: inherit; border-radius: 2px; }
.sign {
    display: inline-block;
    width: 1.2em;
    color: var(--muted);
    user-select: none;
}

tr.fold td {
    padding: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
tr.fold button {
    width: 100%;
    padding: 4px 10px;
    border: 0;
    background: none;
    font: inherit;
    font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    color: var(--blue);
    text-align: left;
    cursor: pointer;
}
tr.fold button:hover { text-decoration: underline; }

@media (max-width: 760px) {
    .page { padding: 16px 16px 64px; }
    .topbar { flex-wrap: wrap; }
    .inputs { grid-template-columns: 1fr; }
    table.diff col.col-num { width: 40px; }
}
