/* MGIT — estilos de la aplicación (mismos que los mockups aprobados).
   Los colores se definen como variables; el tema oscuro se activa por sistema o por elección. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --text: #1b2130;
    --muted: #5f6b7d;
    --border: #dbe0e7;
    --border-strong: #c3cad5;
    --accent: #2c56c9;
    --accent-soft: #e8eefc;
    --accent-text: #ffffff;
    --ok: #1f7a4d;
    --ok-soft: #e3f4ea;
    --warn: #8a5a00;
    --warn-soft: #fff3d6;
    --danger: #b9302a;
    --danger-soft: #fde8e6;
    --add-bg: #e6f6ec;
    --add-strong: #b9e8c9;
    --del-bg: #fdecec;
    --del-strong: #f5c2c0;
    --code-bg: #f6f8fa;
    --line-hl: #fff6c9;
    --shadow: 0 8px 28px rgba(20, 30, 50, .14);
    --radius: 8px;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* resaltado de sintaxis */
    --syn-kw: #b0236f;
    --syn-str: #1a6b3c;
    --syn-com: #6a737d;
    --syn-type: #6f42c1;
    --syn-num: #005cc5;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #11141a;
        --surface: #181c24;
        --surface-2: #1f242e;
        --text: #e3e7ee;
        --muted: #97a1b2;
        --border: #2b313d;
        --border-strong: #3a4250;
        --accent: #7193f2;
        --accent-soft: #1d2741;
        --accent-text: #0c1020;
        --ok: #5fcf95;
        --ok-soft: #15291f;
        --warn: #f0bf5a;
        --warn-soft: #2d2412;
        --danger: #f1756d;
        --danger-soft: #331a19;
        --add-bg: #14281c;
        --add-strong: #1f4a2f;
        --del-bg: #2e1718;
        --del-strong: #5a2526;
        --code-bg: #141820;
        --line-hl: #3a3317;
        --shadow: 0 10px 30px rgba(0, 0, 0, .5);
        --syn-kw: #ff7ab2;
        --syn-str: #7ee0a1;
        --syn-com: #7d8799;
        --syn-type: #c3a6ff;
        --syn-num: #79b8ff;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #11141a;
    --surface: #181c24;
    --surface-2: #1f242e;
    --text: #e3e7ee;
    --muted: #97a1b2;
    --border: #2b313d;
    --border-strong: #3a4250;
    --accent: #7193f2;
    --accent-soft: #1d2741;
    --accent-text: #0c1020;
    --ok: #5fcf95;
    --ok-soft: #15291f;
    --warn: #f0bf5a;
    --warn-soft: #2d2412;
    --danger: #f1756d;
    --danger-soft: #331a19;
    --add-bg: #14281c;
    --add-strong: #1f4a2f;
    --del-bg: #2e1718;
    --del-strong: #5a2526;
    --code-bg: #141820;
    --line-hl: #3a3317;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    --syn-kw: #ff7ab2;
    --syn-str: #7ee0a1;
    --syn-com: #7d8799;
    --syn-type: #c3a6ff;
    --syn-num: #79b8ff;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--sans);
}


a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: .88em; }
kbd {
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 .35em;
    background: var(--surface);
}
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Estructura ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .45rem; font-weight: 700; letter-spacing: .06em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 7px;
    display: grid; place-items: center;
    background: var(--accent); color: var(--accent-text);
    font-size: .8rem; letter-spacing: 0;
}
.topnav { display: flex; gap: .25rem; }
.topnav a { color: var(--muted); padding: .35rem .6rem; border-radius: 6px; font-weight: 500; }
.topnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.top-search { flex: 1; max-width: 420px; position: relative; }
.top-search input { width: 100%; padding-right: 2rem; }
.top-search kbd { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); font-size: .75rem; color: var(--muted); }
.user-menu { position: relative; margin-left: auto; }

.banner-strip { padding: .55rem 1.25rem; font-size: .9rem; display: flex; gap: .75rem; align-items: center; }
.banner-strip.warn { background: var(--warn-soft); color: var(--warn); }
.banner-strip.danger { background: var(--danger-soft); color: var(--danger); }

.page { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem; }
.page.narrow { max-width: 760px; }

.page-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { margin: 0; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.5rem; align-items: start; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }

.side-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.side-nav a { color: var(--text); padding: .45rem .7rem; border-radius: 6px; }
.side-nav a:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav .phase { float: right; font-size: .7rem; color: var(--muted); }

/* ---------- Cabecera de repositorio ---------- */

.repo-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.repo-header-inner { max-width: 1180px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
.repo-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: 1.3rem; }
.repo-title a { font-weight: 700; }
.repo-desc { color: var(--muted); margin: .3rem 0 .6rem; }
.tabs-bar { display: flex; gap: .15rem; overflow-x: auto; margin-top: .5rem; }
.tabs-bar a {
    display: flex; align-items: center; gap: .4rem;
    padding: .55rem .85rem; color: var(--muted); white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.tabs-bar a:hover { color: var(--text); text-decoration: none; }
.tabs-bar a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.count { background: var(--surface-2); border-radius: 10px; padding: 0 .45rem; font-size: .75rem; color: var(--muted); }

/* ---------- Componentes ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-body { padding: 1.1rem 1.25rem; }
.panel-head {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .7rem 1.1rem; border-bottom: 1px solid var(--border);
    background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.panel + .panel, .panel + .section, .section + .section { margin-top: 1rem; }
.panel.danger { border-color: var(--danger); }
.panel.danger .panel-head { background: var(--danger-soft); color: var(--danger); }
.panel.highlight { border-color: var(--accent); background: var(--accent-soft); }

.section { margin-bottom: 1.5rem; }
.section > h2 { padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

.alert { border-radius: var(--radius); padding: .75rem 1rem; display: flex; gap: .75rem; align-items: flex-start; border: 1px solid transparent; }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert .icon { flex: none; margin-top: .1rem; }
.alert p:last-child { margin: 0; }

.badge {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .72rem; font-weight: 600; line-height: 1;
    padding: .28rem .5rem; border-radius: 20px;
    border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface);
    white-space: nowrap;
}
.badge.accent { border-color: var(--accent); color: var(--accent); }
.badge.ok { border-color: var(--ok); color: var(--ok); }
.badge.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.badge.danger { border-color: var(--danger); color: var(--danger); }
.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 20px; background: var(--accent-soft); color: var(--accent); }
.tag:hover { text-decoration: none; filter: brightness(.95); }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* Botones */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.2;
    padding: .5rem .85rem; border-radius: 6px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: .3rem .55rem; font-size: .8rem; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); position: relative; z-index: 1; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

/* Formularios */

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label, .label { font-weight: 600; font-size: .88rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
.field .error-text { color: var(--danger); font-size: .82rem; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.field.ok-field .ok-text { color: var(--ok); font-size: .82rem; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input[type=url], select, textarea {
    font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 6px; padding: .5rem .65rem; width: 100%;
}
textarea { resize: vertical; min-height: 120px; }
textarea.mono { font-family: var(--mono); font-size: .88rem; line-height: 1.55; }
input[readonly] { background: var(--surface-2); }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; font-size: .92rem; cursor: pointer; }
.check input { margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; align-items: end; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.input-group { display: flex; }
.input-group input { border-radius: 6px 0 0 6px; min-width: 0; }
.input-group .btn { border-radius: 0 6px 6px 0; margin-left: -1px; }
.input-group .prefix {
    display: flex; align-items: center; padding: 0 .6rem; border: 1px solid var(--border-strong);
    border-right: 0; border-radius: 6px 0 0 6px; background: var(--surface-2); color: var(--muted); font-size: .88rem; white-space: nowrap;
}
.input-group .prefix + input { border-radius: 0 6px 6px 0; }

.copy-field input { font-family: var(--mono); font-size: .85rem; }

.otp { display: flex; gap: .4rem; justify-content: center; }
.otp input { width: 2.6rem; height: 3rem; text-align: center; font-size: 1.3rem; font-family: var(--mono); padding: 0; }

/* Tablas y listas */

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table th, .table td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.dim td { color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }

.repo-item { display: flex; gap: 1rem; align-items: flex-start; }
.repo-item .name { font-weight: 600; font-size: 1.05rem; }
.repo-item .meta { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .82rem; margin-top: .35rem; }
.repo-item .meta span { display: inline-flex; align-items: center; gap: .3rem; }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }

.empty { text-align: center; padding: 3rem 1.5rem; }
.empty .icon-big { width: 44px; height: 44px; color: var(--muted); margin-bottom: .5rem; }
.empty h2 { margin-bottom: .35rem; }

.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.25rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }

.ahead-behind { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.ahead-behind .bars { display: flex; width: 90px; height: 6px; }
.ahead-behind .behind { background: var(--border-strong); margin-left: auto; border-radius: 3px 0 0 3px; }
.ahead-behind .ahead { background: var(--accent); border-radius: 0 3px 3px 0; }
.ahead-behind .half { width: 50%; display: flex; }

.avatar {
    width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 700; flex: none;
}

.sha { font-family: var(--mono); font-size: .82rem; background: var(--surface-2); padding: .1rem .4rem; border-radius: 4px; color: var(--text); }

/* Desplegables */

details.dropdown { position: relative; display: inline-block; }
details.dropdown > summary { list-style: none; }
details.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 240px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: .35rem;
}
.dropdown-menu.align-right { left: auto; right: 0; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left;
    padding: .45rem .6rem; border-radius: 5px; color: var(--text); font: inherit; font-size: .9rem;
    background: none; border: 0; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .sep { border-top: 1px solid var(--border); margin: .35rem 0; }
.dropdown-menu .head { padding: .4rem .6rem; font-size: .8rem; color: var(--muted); }
.dropdown-menu input[type=search] { margin-bottom: .35rem; }
.dropdown-menu .selected { font-weight: 600; }
.dropdown-menu .scroll { max-height: 260px; overflow-y: auto; }

/* Diálogos */

dialog {
    border: 1px solid var(--border); border-radius: 10px; padding: 0; width: min(520px, calc(100vw - 32px));
    background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 14, 22, .55); }
.dialog-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
.dialog-head h2 { margin: 0; font-size: 1.05rem; }
.dialog-body { padding: 1.1rem 1.25rem; }
.dialog-foot { padding: .85rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* Avisos emergentes */

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: .5rem; z-index: 60; }
.toast {
    background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: 8px; box-shadow: var(--shadow);
    font-size: .9rem; display: flex; gap: .75rem; align-items: center; max-width: 380px;
}
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* Código */

.code-view { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.code-head {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .55rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .85rem;
}
.code-scroll { overflow-x: auto; }
.code { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: .84rem; line-height: 1.6; }
.code td { padding: 0 .9rem; white-space: pre; vertical-align: top; }
.code .ln {
    width: 1%; min-width: 3.5rem; text-align: right; color: var(--muted); user-select: none; cursor: pointer;
    padding-right: .75rem; border-right: 1px solid var(--border);
}
.code .ln:hover { color: var(--accent); }
.code tr.hl td { background: var(--line-hl); }
.code .blame {
    width: 1%; min-width: 260px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: var(--sans); font-size: .78rem; color: var(--muted); border-right: 1px solid var(--border); background: var(--surface-2);
}
.code tr.blame-start td { border-top: 1px solid var(--border); }
.kw { color: var(--syn-kw); } .str { color: var(--syn-str); } .com { color: var(--syn-com); font-style: italic; }
.typ { color: var(--syn-type); } .num { color: var(--syn-num); }

pre.block {
    background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px;
    padding: .75rem 1rem; overflow-x: auto; margin: .5rem 0 1rem; line-height: 1.55;
}

.tree { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tree td { padding: .5rem .9rem; border-top: 1px solid var(--border); }
.tree td.name { width: 30%; white-space: nowrap; }
.tree td.name a { color: var(--text); display: inline-flex; gap: .45rem; align-items: center; }
.tree td.name a:hover { color: var(--accent); }
.tree td.msg a { color: var(--muted); }
.tree td.when { text-align: right; color: var(--muted); white-space: nowrap; width: 1%; }
.tree .folder-icon { color: var(--accent); }
.tree .loading { display: inline-block; height: .7em; width: 60%; border-radius: 4px; background: var(--surface-2); }

.last-commit { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .65rem .9rem; font-size: .88rem; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; font-size: 1rem; }
.breadcrumb a { font-weight: 600; }
.breadcrumb .sep { color: var(--muted); }

/* Markdown renderizado */

.markdown { line-height: 1.65; overflow-wrap: anywhere; }
.markdown h1 { font-size: 1.6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); margin: 0 0 1rem; }
.markdown h2 { font-size: 1.25rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border); margin: 1.5rem 0 .75rem; }
.markdown h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.markdown ul, .markdown ol { padding-left: 1.6rem; margin: 0 0 .9rem; }
.markdown li.task { list-style: none; margin-left: -1.3rem; }
.markdown code { background: var(--surface-2); padding: .12rem .35rem; border-radius: 4px; }
.markdown pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: .8rem 1rem; overflow-x: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { margin: 0 0 1rem; padding: 0 1rem; border-left: 3px solid var(--border-strong); color: var(--muted); }
.markdown table { border-collapse: collapse; margin: 0 0 1rem; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: .4rem .7rem; }
.markdown th { background: var(--surface-2); }
.markdown img { max-width: 100%; border-radius: 6px; }

/* Diff */

/* overflow: clip (no hidden) para que la cabecera pegajosa se fije respecto a la página */
.diff-file { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: clip; background: var(--surface); }
.diff-file > header {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .55rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .85rem;
    position: sticky; top: 57px; z-index: 5;
}
.diff-stat { display: inline-flex; gap: 1px; }
.diff-stat i { width: 8px; height: 8px; display: inline-block; background: var(--border-strong); }
.diff-stat i.a { background: var(--ok); } .diff-stat i.d { background: var(--danger); }
/* El diff se desplaza en horizontal dentro de su caja, nunca la página */
.diff { display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--mono); font-size: .82rem; line-height: 1.55; }
.diff > tbody { display: table; width: 100%; border-collapse: collapse; }
.diff td { padding: 0 .6rem; white-space: pre; vertical-align: top; }
.diff .ln { width: 1%; min-width: 3rem; text-align: right; color: var(--muted); user-select: none; }
.diff tr.add td { background: var(--add-bg); }
.diff tr.add td.ln { background: var(--add-strong); }
.diff tr.del td { background: var(--del-bg); }
.diff tr.del td.ln { background: var(--del-strong); }
.diff tr.hunk td { background: var(--accent-soft); color: var(--muted); padding: .2rem .6rem; }
.diff td.add { background: var(--add-bg); } .diff td.del { background: var(--del-bg); }
.diff td.empty { background: var(--surface-2); }
.diff ins { background: var(--add-strong); text-decoration: none; border-radius: 2px; }
.diff del { background: var(--del-strong); text-decoration: none; border-radius: 2px; }
.diff-collapsed { padding: 1.25rem; text-align: center; color: var(--muted); }

.file-list { font-size: .88rem; }
.list.file-list.panel-body { padding: .6rem 1.1rem; }
.file-list li { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; }
.chg { font-family: var(--mono); font-size: .72rem; font-weight: 700; width: 1.4rem; text-align: center; border-radius: 4px; }
.chg.A { color: var(--ok); background: var(--ok-soft); }
.chg.M { color: var(--warn); background: var(--warn-soft); }
.chg.D { color: var(--danger); background: var(--danger-soft); }
.chg.R { color: var(--accent); background: var(--accent-soft); }

/* Pestañas internas */

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs button {
    font: inherit; background: none; border: 0; padding: .55rem .85rem; cursor: pointer; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Editor */

.editor { border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.editor-toolbar { display: flex; gap: .15rem; flex-wrap: wrap; padding: .35rem; border-bottom: 1px solid var(--border); background: var(--surface-2); align-items: center; }
.editor-toolbar .btn { padding: .3rem .5rem; }
.editor-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 420px; }
.editor-panes textarea { border: 0; border-radius: 0; min-height: 420px; resize: none; padding: 1rem; background: var(--surface); }
.editor-panes .preview { padding: 1rem 1.25rem; border-left: 1px solid var(--border); overflow: auto; max-height: 640px; }
.editor[data-mode=write] .preview { display: none; }
.editor[data-mode=write] .editor-panes, .editor[data-mode=preview] .editor-panes { grid-template-columns: 1fr; }
.editor[data-mode=preview] textarea { display: none; }
.editor[data-mode=preview] .preview { border-left: 0; }
.editor-status { display: flex; gap: 1rem; padding: .4rem .75rem; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); background: var(--surface-2); }

/* Subida de archivos */

.dropzone {
    border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted);
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.upload { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.upload:last-child { border-bottom: 0; }

/* Cuenta (login, alta) */

.account { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.account-card { width: min(420px, 100%); }
.account-card .brand { justify-content: center; font-size: 1.25rem; margin-bottom: 1.25rem; }
.account-card .panel-body { padding: 1.75rem; }

.steps { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.steps span.done { background: var(--accent); }

.qr { width: 180px; height: 180px; background: #fff; padding: 10px; border-radius: 8px; border: 1px solid var(--border); }

.codes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.5rem; font-family: var(--mono); font-size: 1rem; padding: 1rem; background: var(--surface-2); border-radius: 6px; }

/* ---------- Adaptación a pantallas pequeñas ---------- */

@media (max-width: 900px) {
    .two-col, .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .side-nav { position: static; flex-direction: row; overflow-x: auto; }
    .side-nav a { white-space: nowrap; }
    .editor-panes { grid-template-columns: 1fr; }
    .editor-panes .preview { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; padding: .5rem 1rem; gap: .5rem; }
    .top-search { order: 3; max-width: none; flex-basis: 100%; }
    .topnav a { padding: .3rem .45rem; }
    .page { padding: 1.25rem 1rem; }
    .repo-header-inner { padding: 1rem 1rem 0; }
    .tree td.msg { display: none; }
    .table .hide-sm { display: none; }
    .codes { grid-template-columns: 1fr; }
}

/* ---------- Específico de la aplicación ---------- */

/* Resaltado de sintaxis (clases generadas en el servidor) */
.hl-kw { color: var(--syn-kw); }
.hl-str { color: var(--syn-str); }
.hl-com { color: var(--syn-com); font-style: italic; }
.hl-typ { color: var(--syn-type); }
.hl-num { color: var(--syn-num); }
.hl-attr { color: var(--syn-num); }

/* Validación de formularios de Blazor */
.validation-message { color: var(--danger); font-size: .82rem; font-weight: normal; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

#blazor-error-ui {
    background: var(--warn-soft); color: var(--warn); bottom: 0; box-shadow: var(--shadow); display: none;
    left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: var(--danger); padding: 1rem; color: #fff; border-radius: var(--radius); }
.blazor-error-boundary::after { content: "Se ha producido un error."; }
h1:focus { outline: none; }
