/* ===== LatamReady University — brand theme ===== */

:root {
    /* Brand palette (from the LatamReady logo) */
    --lr-red: #D6402F;
    --lr-red-600: #BE3826;
    --lr-red-700: #A12F20;
    --lr-red-50: #FCEDEA;

    --lr-primary: var(--lr-red);

    /* Surfaces */
    --lr-sidebar-bg: #ffffff;
    --lr-sidebar-fg: #3a4453;
    --lr-sidebar-muted: #7a8694;
    --lr-sidebar-hover: #f2f4f7;
    --lr-border: #e3e6ea;
    --lr-ink: #2b333f;
    --lr-sidebar-width: 290px;
}

/* ---- Base typography ---- */
body { font-size: .9375rem; line-height: 1.6; }
h1, h2, h3, h4 { letter-spacing: -0.02em; color: var(--lr-ink); }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.02rem; font-weight: 600; }

/* ---- Layout / sidebar ---- */
.page { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--lr-sidebar-width, 290px);
    flex: 0 0 var(--lr-sidebar-width, 290px);
    background: var(--lr-sidebar-bg);
    color: var(--lr-sidebar-fg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--lr-border);
}

main { flex: 1; min-width: 0; background: #fbfcfd; }

/* ---- Collapse + resize ---- */
.sidebar-resizer {
    flex: 0 0 6px;
    width: 6px;
    margin-left: -6px;
    cursor: col-resize;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
    background: transparent;
    transition: background .12s ease;
}
.sidebar-resizer:hover,
html.lru-resizing .sidebar-resizer { background: var(--lr-red); }
html.lru-resizing { cursor: col-resize; user-select: none; }

html.lru-collapsed .sidebar,
html.lru-collapsed .sidebar-resizer { display: none; }

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--lr-border);
    border-radius: 8px;
    background: #fff;
    color: #5f6b7a;
    cursor: pointer;
    flex: 0 0 auto;
}
.sidebar-toggle:hover { background: var(--lr-sidebar-hover); color: var(--lr-ink); }
.top-row-spacer { flex: 1; }

.top-row {
    height: 3.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    border-bottom: 1px solid var(--lr-border);
    background: #fff;
}

.content { padding: 1.6rem 2.25rem; max-width: 980px; margin-inline: auto; }

.user-chip { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--lr-ink); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.logout-link { padding: 0; font-size: .9rem; color: var(--lr-red); }
.logout-link:hover { color: var(--lr-red-700); }

/* ---- Sidebar header / actions ---- */
.nav-header {
    background: linear-gradient(135deg, var(--lr-red) 0%, var(--lr-red-700) 100%);
    padding: .9rem 1rem;
}
.site-title { display: block; line-height: 0; }
.site-logo { width: 100%; max-width: 240px; height: auto; display: block; }

.nav-actions { padding: .85rem 1rem .35rem; }
.nav-footer { margin-top: auto; padding: 1rem; border-top: 1px solid var(--lr-border); display: flex; flex-direction: column; gap: .35rem; }
.nav-footer a { color: var(--lr-sidebar-muted); text-decoration: none; font-size: .9rem; }
.nav-footer a:hover { color: var(--lr-red); }
.nav-footer-sub { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--lr-border); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #9aa4b1; }
.nav-tenant-admin { margin-top: .5rem; padding-top: .6rem; border-top: 1px dashed var(--lr-border); font-weight: 600; color: var(--lr-ink) !important; }
.nav-tenant-admin:hover { color: var(--lr-red) !important; }

/* ---- Tree (left menu) ---- */
.tree { padding: .25rem .5rem 1rem; flex: 1; }
.tree-loading, .tree-empty { color: var(--lr-sidebar-muted); padding: .5rem 1rem; font-size: .9rem; }

.tree-node { font-size: .875rem; }
.tree-row {
    display: flex; align-items: center; gap: .15rem;
    border-radius: 6px; padding: .05rem .25rem;
    border-left: 3px solid transparent;
}
.tree-row:hover { background: var(--lr-sidebar-hover); }

.tree-toggle {
    background: none; border: none; color: var(--lr-sidebar-muted);
    width: 1.35rem; height: 1.5rem; cursor: pointer; padding: 0;
    font-size: 1rem; line-height: 1; flex: 0 0 auto;
}
.tree-toggle-empty { visibility: hidden; }
.tree-icon { flex: 0 0 auto; display: inline-flex; align-items: center; }

/* Node icons (folders / pages) */
.node-icon { display: block; }
.node-icon-folder { color: var(--lr-red); }
.node-icon-page { color: #8a94a3; }
.home-card-icon .node-icon, .children-list .node-icon { width: 18px; height: 18px; }

.tree-label {
    color: var(--lr-sidebar-fg); text-decoration: none;
    padding: .25rem .35rem; flex: 1; border-radius: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree-label:hover { color: var(--lr-ink); }
.tree-label-folder { cursor: pointer; font-weight: 600; color: var(--lr-ink); }

/* Active page: red accent bar + tinted row + red label */
.tree-row:has(.tree-label.active) {
    background: var(--lr-red-50);
    border-left-color: var(--lr-red);
}
.tree-label.active { color: var(--lr-red-700); font-weight: 600; background: transparent; }

.tree-children { margin-left: .9rem; border-left: 1px solid var(--lr-border); padding-left: .15rem; }

/* Create-child (+) action — shown on row hover */
.tree-add {
    flex: 0 0 auto; width: 1.3rem; text-align: center; line-height: 1.2;
    color: var(--lr-sidebar-muted); text-decoration: none; font-weight: 700; border-radius: 4px;
    opacity: 0; transition: opacity .1s ease;
}
.tree-row:hover .tree-add { opacity: 1; }
.tree-add:hover { color: var(--lr-red); background: var(--lr-sidebar-hover); }

/* Drag-and-drop reparenting */
.tree-row[draggable="true"] { cursor: grab; }
.tree-row.drop-target,
.nav-hubbar.drop-target {
    outline: 2px dashed var(--lr-red); outline-offset: -2px;
    background: var(--lr-red-50); border-radius: 6px;
}

/* ---- Buttons (brand) ---- */
.btn-primary {
    background-color: var(--lr-red);
    border-color: var(--lr-red);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--lr-red-600) !important;
    border-color: var(--lr-red-600) !important;
    color: #fff;
}
.btn-outline-primary {
    color: var(--lr-red);
    border-color: var(--lr-red);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
    background-color: var(--lr-red) !important;
    border-color: var(--lr-red) !important;
    color: #fff !important;
}
a { color: var(--lr-red-600); }
a:hover { color: var(--lr-red-700); }

/* ---- Document (read) view ---- */
.doc-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.doc-visibility { font-size: .8rem; padding: .15rem .5rem; border-radius: 999px; }
.doc-visibility.is-public { background: #e6f4ea; color: #137333; }
.doc-visibility.is-private { background: var(--lr-red-50); color: var(--lr-red-700); }

.doc h1 { margin-top: .25rem; margin-bottom: 1.5rem; color: var(--lr-ink); }
.doc-meta { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--lr-border); color: #5f6b7a; font-size: .85rem; }

/* ---- Versioning ---- */
.edit-state { font-size: .8rem; color: #5f6b7a; }
.draft-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    background: #fff7e6; border: 1px solid #f0e0b0; color: #6a4b08;
    border-radius: 10px; padding: .55rem .9rem; margin: 0 0 1rem;
}
.draft-banner.is-draft { background: var(--lr-red-50); border-color: #f1cdc6; color: var(--lr-red-700); }
.draft-banner-actions { display: inline-flex; gap: .4rem; flex: 0 0 auto; }
.version-meta { color: #5f6b7a; font-size: .85rem; margin-top: -.25rem; }
.version-meta code { background: #f0f2f4; padding: .1rem .4rem; border-radius: 4px; }
/* Read-only version footer (under a dividing line) */
.doc-version { margin-top: .25rem; font-size: .8rem; color: #8a94a3; }
.doc-version code { background: #f0f2f4; color: #5f6b7a; padding: .05rem .4rem; border-radius: 4px; font-size: .78rem; }
.version-table code { background: #f0f2f4; padding: .1rem .4rem; border-radius: 4px; }
.version-status { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; }
.version-status.is-published { background: #e6f4ea; color: #137333; }
.version-status.is-draft { background: #fff7e6; color: #8a5a00; }
.version-actions { display: flex; gap: .4rem; }
.badge-current { font-size: .68rem; background: var(--lr-red-50); color: var(--lr-red-700); padding: .05rem .4rem; border-radius: 999px; margin-left: .4rem; }
.badge-current.draft { background: #fff7e6; color: #8a5a00; }
.version-draft-row { background: #fffdf5; }
.version-preview { border: 1px solid var(--lr-border); border-radius: 8px; overflow: hidden; margin: .25rem 0 .75rem; }
.version-preview .markdown-body { padding: 1rem; }

.children-heading { font-size: 1.1rem; margin-top: 2rem; color: var(--lr-ink); }
.children-list { list-style: none; padding: 0; }
.children-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid #f0f2f4; }
.badge-internal { font-size: .7rem; background: var(--lr-red-50); color: var(--lr-red-700); padding: .05rem .4rem; border-radius: 999px; }

/* ---- Markdown body ---- */
.markdown-body { line-height: 1.65; color: var(--lr-ink); }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.4rem; }
.markdown-body pre { background: #f6f8fa; padding: 1rem; border-radius: 8px; overflow-x: auto; }
.markdown-body code { background: #f0f2f4; padding: .1rem .3rem; border-radius: 4px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { border-collapse: collapse; margin: 1rem 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--lr-border); padding: .4rem .75rem; }
.markdown-body th { background: #f6f8fa; }
/* Blockquotes — same look in the read view and the WYSIWYG editor */
.markdown-body blockquote,
.toastui-editor-contents blockquote {
    border-left: 4px solid var(--lr-red); margin: 1rem 0; padding: .25rem 1rem;
    color: #5f6b7a; background: var(--lr-red-50); border-radius: 0 6px 6px 0;
}

/* ---- Inline video embeds (YouTube / Google Drive) ---- */
.markdown-body .video-embed {
    position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 9;
    margin: 1rem 0; border-radius: 8px; overflow: hidden; background: #000;
}
.markdown-body .video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Callout / information blocks — rounded boxed panel, identical in editor + read view ---- */
.markdown-body blockquote.callout,
.toastui-editor-contents blockquote.callout {
    border: 1px solid #eecabf;
    border-radius: 12px;
    background: #fbeae6;
    color: #6e2a1e;
    padding: .85rem 1.05rem;
    margin: 1rem 0;
    box-shadow: 0 1px 2px rgba(20, 20, 20, .04);
}
.markdown-body blockquote.callout > :first-child,
.toastui-editor-contents blockquote.callout > :first-child { margin-top: 0; }
.markdown-body blockquote.callout > :last-child,
.toastui-editor-contents blockquote.callout > :last-child { margin-bottom: 0; }
/* Make the leading emoji read as a proper icon */
.markdown-body blockquote.callout > p:first-child::first-letter,
.toastui-editor-contents blockquote.callout > p:first-child::first-letter { font-size: 1.45em; line-height: 1; }

.markdown-body .callout-info,      .toastui-editor-contents .callout-info      { background: #fbeae6; border-color: #eecabf; color: #6e2a1e; }
.markdown-body .callout-tip,       .toastui-editor-contents .callout-tip       { background: #e9f7ef; border-color: #c4e7d4; color: #14502f; }
.markdown-body .callout-warning,   .toastui-editor-contents .callout-warning   { background: #fef6e6; border-color: #f0e0b0; color: #6a4b08; }
.markdown-body .callout-danger,    .toastui-editor-contents .callout-danger    { background: #fdecea; border-color: #f3c9c2; color: #7a1c12; }
.markdown-body .callout-important, .toastui-editor-contents .callout-important { background: #f3eefc; border-color: #ddd0f0; color: #492a78; }

/* ---- Make the WYSIWYG editor surface match the read view ---- */
.toastui-editor-contents { font-family: inherit; font-size: .9375rem; line-height: 1.6; color: var(--lr-ink); }
.toastui-editor-contents h1,
.toastui-editor-contents h2 { border-bottom: 0; padding-bottom: 0; }
.toastui-editor-contents h1 { font-size: 1.55rem; }
.toastui-editor-contents h2 { font-size: 1.2rem; }
.toastui-editor-contents h3 { font-size: 1.02rem; }
.toastui-editor-contents pre { background: #f6f8fa; border-radius: 8px; }
.toastui-editor-contents :not(pre) > code { background: #f0f2f4; }
.toastui-editor-contents a { color: var(--lr-red-600); }

/* ---- Editor ---- */
.editor-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.editor-actions { display: flex; gap: .5rem; }
.editor-meta { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin: 1rem 0; }
.editor-meta label { display: flex; flex-direction: column; font-size: .8rem; color: #5f6b7a; gap: .25rem; }
.editor-meta label.flex-grow { flex: 1; min-width: 220px; }
.editor-meta label.checkbox { flex-direction: row; align-items: center; gap: .4rem; }
.editor-meta select, .editor-meta input[type=text], .editor-meta .form-control { font-size: .95rem; padding: .4rem; }

/* Rich-text (Toast UI) editor container */
.editor-body { margin-top: 1rem; }
/* Custom toolbar buttons (link, info, video): reuse Toast UI's native icon-button class for the
   EXACT native box (size/margins), drop the sprite, and center the SVG INSIDE that box with flex —
   so the icon and the button box (the hover highlight) are concentric and align with native icons. */
.toastui-editor-toolbar-icons.lru-tb-btn {
    background-image: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #555;
}
.toastui-editor-toolbar-icons.lru-tb-btn svg {
    width: 18px; height: 18px;
}
.toastui-editor-toolbar-icons.lru-tb-btn:hover { color: #111; }
/* Toast UI wraps custom toolbar items in this wrapper, whose margin pushed our buttons out of
   line with the native icons. Removing it makes everything sit flush. */
.toastui-editor-toolbar-item-wrapper { margin: 0; }
.editor-body .toastui-editor-defaultUI { border-radius: 8px; border-color: var(--lr-border); }
.toastui-editor-defaultUI-toolbar { border-radius: 8px 8px 0 0; }

/* Rendered images: responsive, plus optional alignment from a "#lr=" directive (if present). */
.markdown-body img { max-width: 100%; height: auto; border-radius: 4px; }
.markdown-body img.lr-center { display: block; margin: 1rem auto; }
.markdown-body img.lr-left { float: left; margin: .25rem 1.1rem 1rem 0; }
.markdown-body img.lr-right { float: right; margin: .25rem 0 1rem 1.1rem; }

/* WYSIWYG image drag-resize overlay (lives on document.body, glued to the selected <img>). */
.lru-img-resizer {
    position: fixed;
    display: none;
    border: 1px solid #4a90e2;
    pointer-events: none; /* clicks pass through to the editor, except the handle below */
    z-index: 1000;
    box-sizing: border-box;
}
.lru-img-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #4a90e2;
    border: 2px solid #fff;
    border-radius: 2px;
    cursor: nwse-resize;
    pointer-events: auto;
    box-shadow: 0 0 2px rgba(0,0,0,.4);
}

.editor-split { display: flex; gap: 1rem; height: 60vh; }
.editor-pane { flex: 1; display: flex; flex-direction: column; border: 1px solid var(--lr-border); border-radius: 8px; overflow: hidden; }
.pane-label { background: #f6f8fa; padding: .35rem .75rem; font-size: .75rem; text-transform: uppercase; color: #5f6b7a; border-bottom: 1px solid var(--lr-border); }
.editor-textarea { flex: 1; border: none; padding: 1rem; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; resize: none; outline: none; }
.preview { padding: 1rem; overflow-y: auto; }

/* ---- Hub bar in the sidebar ---- */
.nav-hubbar { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem .2rem; }
.nav-allhubs { font-size: .78rem; color: var(--lr-sidebar-muted); text-decoration: none; white-space: nowrap; }
.nav-allhubs:hover { color: var(--lr-red); }
.nav-hubname { font-weight: 700; font-size: .95rem; color: var(--lr-ink); text-decoration: none; letter-spacing: -.01em; }
.nav-hubname:hover { color: var(--lr-red); }

/* ---- Hubs on the home page ---- */
.hub-head { display: flex; align-items: center; justify-content: space-between; margin: .25rem 0 1rem; }
.hub-head h2 { margin: 0; }
.hub-card {
    display: flex; gap: .85rem; align-items: flex-start; text-decoration: none; color: inherit;
    border: 1px solid var(--lr-border); border-radius: 12px; padding: 1.1rem 1.15rem; background: #fff;
    transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease;
}
.hub-card:hover { box-shadow: 0 6px 18px rgba(27,33,41,.09); border-color: #d2d7dd; }
.hub-card-icon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 10px; background: var(--lr-red-50); color: var(--lr-red);
}
.hub-card-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.hub-card-title { font-weight: 700; font-size: 1.05rem; color: var(--lr-ink); display: flex; align-items: center; gap: .5rem; }
.hub-card-desc { color: #5f6b7a; font-size: .9rem; }

/* ---- Hub admin ---- */
.hub-form { border: 1px solid var(--lr-border); border-radius: 12px; padding: 1rem 1.1rem; margin: 1rem 0 1.5rem; background: #fff; }
.hub-form-title { margin: 0 0 .75rem; font-size: 1.05rem; }
.hub-form-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hub-form-row .form-control { flex: 1; min-width: 200px; }
.hub-form-row .checkbox { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.hub-form-actions { display: flex; gap: .5rem; margin-top: .9rem; }

.icon-picker-label { font-size: .8rem; color: #5f6b7a; margin: .9rem 0 .35rem; }
.icon-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.icon-opt {
    width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--lr-border); border-radius: 9px; background: #fff; color: #5f6b7a; cursor: pointer;
    transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.icon-opt:hover { color: var(--lr-ink); border-color: #c2c9d2; }
.icon-opt.selected { border-color: var(--lr-red); color: var(--lr-red); background: var(--lr-red-50); box-shadow: 0 0 0 1px var(--lr-red) inset; }

.hub-row-icon { color: var(--lr-red); display: inline-flex; }
.hub-row-actions { display: flex; gap: .4rem; }
.role-msg.error { color: #c5221f; }

/* Hub chip on a document */
.hub-chip { font-size: .78rem; font-weight: 600; color: var(--lr-red-700); background: var(--lr-red-50); padding: .15rem .55rem; border-radius: 999px; }
.doc-code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .75rem; font-weight: 600;
    letter-spacing: .02em; color: #5f6b7a; background: #f1f3f5; border: 1px solid var(--lr-border);
    padding: .12rem .45rem; border-radius: 6px; text-transform: uppercase; }

/* ---- Home ---- */
.home-hero { padding: 1rem 0 1.4rem; border-bottom: 1px solid var(--lr-border); margin-bottom: 1.4rem; }
.home-hero-logo { height: 46px; width: auto; display: block; margin-bottom: .6rem; }
.home-hero .lead { color: #5f6b7a; margin: 0; font-size: .95rem; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.home-card { display: flex; gap: .75rem; border: 1px solid var(--lr-border); border-radius: 10px; padding: 1rem; background: #fff; transition: box-shadow .15s ease, border-color .15s ease; }
.home-card:hover { box-shadow: 0 4px 14px rgba(27,33,41,.08); border-color: #d2d7dd; }
.home-card-icon { font-size: 1.5rem; }
.home-card h3 { font-size: 1.05rem; margin: 0 0 .35rem; color: var(--lr-ink); }
.home-card-children { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .9rem; }
.home-card-children li { padding: .1rem 0; }

/* ---- Users / misc ---- */
.role-add { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0 .5rem; }
.role-add input[type=email] { flex: 1; min-width: 240px; max-width: 360px; }
.role-add select { width: auto; min-width: 180px; }
.role-msg { color: #137333; font-size: .9rem; margin: .25rem 0 1rem; }

.user-table { width: 100%; border-collapse: collapse; }
.user-table select { padding: .25rem .4rem; }
.user-table th, .user-table td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--lr-border); }
.user-table th { background: #f6f8fa; }

/* ---- Users & access (expandable rows) ---- */
.user-filter { max-width: 360px; margin: .25rem 0 1rem; }
.acc-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--lr-border); border-radius: 8px; overflow: hidden; }
.acc-item + .acc-item { border-top: 1px solid var(--lr-border); }
.acc-item.open { background: #fbfcfd; }
.acc-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem .35rem .25rem; }
.acc-toggle {
    flex: 1; display: flex; align-items: center; gap: .6rem; min-width: 0;
    background: none; border: none; text-align: left; cursor: pointer; padding: .35rem .4rem; border-radius: 6px;
}
.acc-toggle:hover { background: #f1f3f5; }
.acc-chevron { color: #8a94a6; transition: transform .15s ease; flex: none; }
.acc-item.open .acc-chevron { transform: rotate(90deg); }
.acc-who { min-width: 0; }
.acc-name { display: block; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-email { display: block; color: #5f6b7a; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-summary { margin-left: auto; padding-left: .8rem; color: #5f6b7a; font-size: .8rem; white-space: nowrap; }
.acc-adminbox { font-size: .82rem; white-space: nowrap; flex: none; }
.acc-remove { flex: none; }
.acc-panel { padding: .4rem .9rem .9rem; border-top: 1px dashed var(--lr-border); }
.acc-adminnote { margin: .6rem 0 0; }
.hub-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .15rem .9rem; padding: .5rem 0; }
.hub-role { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid #eef1f4; }
.hub-role-name { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; min-width: 0; }
.matrix-full { font-size: .8rem; color: var(--lr-red-700); font-weight: 600; }
.matrix-select { padding: .2rem .35rem; font-size: .85rem; }
.matrix-legend { font-size: .8rem; margin-top: .6rem; }

.centered-message { max-width: 520px; margin: 4rem auto; text-align: center; }

/* ---- Top-bar search (next to the hamburger) ---- */
.top-search { display: flex; align-items: center; gap: .45rem; flex: 1; max-width: 460px;
    padding: .35rem .7rem; border: 1px solid var(--lr-border); border-radius: 999px; background: #fff;
    transition: border-color .15s, box-shadow .15s; }
.top-search:focus-within { border-color: var(--lr-red); box-shadow: 0 0 0 3px var(--lr-red-50); }
.top-search-icon { flex: none; color: var(--lr-sidebar-muted); }
.top-search-input { flex: 1; min-width: 0; border: none; outline: none; background: transparent;
    font-size: .86rem; color: var(--lr-ink); }
.top-search-input::placeholder { color: var(--lr-sidebar-muted); }
@media (max-width: 640px) { .top-search-input::placeholder { color: transparent; } .top-search { max-width: 160px; } }

/* ---- Search results page ---- */
.search-page { max-width: 760px; }
.search-bar { display: flex; gap: .5rem; margin: .6rem 0 1.4rem; }
.search-bar .form-control { flex: 1; }
.search-section-title { font-size: .95rem; font-weight: 700; color: #5f6b7a; text-transform: uppercase;
    letter-spacing: .04em; margin: 1.4rem 0 .6rem; }
.search-code { border: 1px solid var(--lr-border); border-radius: 10px; background: var(--lr-red-50); padding: .3rem .6rem; }
.search-code .search-section-title { margin-top: .5rem; }
.search-code-none { color: #5f6b7a; font-size: .88rem; margin: .2rem .2rem .6rem; }
.search-count { color: #5f6b7a; font-size: .82rem; margin: 0 0 .6rem; }
.search-result { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .6rem;
    border-radius: 9px; text-decoration: none; color: inherit; border: 1px solid transparent; }
.search-result:hover { background: #f6f8fa; border-color: var(--lr-border); }
.search-result.is-code { background: #fff; }
.search-code-badge { flex: none; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; font-weight: 600;
    text-transform: uppercase; color: var(--lr-red-700); background: #fff; border: 1px solid #f3d3d0;
    border-radius: 6px; padding: .2rem .45rem; margin-top: .15rem; }
.search-result-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.search-result-title { font-weight: 600; font-size: .98rem; color: var(--lr-text); }
.search-type { margin-right: .3rem; }
.search-lock { margin-left: .35rem; font-size: .8rem; }
.search-result-meta { color: #8a94a6; font-size: .78rem; }
.search-snippet { color: #5f6b7a; font-size: .86rem; line-height: 1.45; margin-top: .15rem; }
.search-snippet mark, .search-result-title mark { background: #fff3bf; color: inherit; padding: 0 .1em; border-radius: 2px; }

/* ---- Internal-link picker (editor) ---- */
.link-picker-overlay { position: fixed; inset: 0; background: rgba(20,30,50,.35); z-index: 1000;
    display: flex; align-items: flex-start; justify-content: center; padding: 8vh 1rem; }
.link-picker { width: 100%; max-width: 540px; background: #fff; border-radius: 12px;
    box-shadow: 0 18px 50px rgba(20,30,50,.25); padding: 1rem 1.1rem 1.1rem; max-height: 76vh; display: flex; flex-direction: column; }
.link-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.link-picker-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.link-picker-msg { color: #5f6b7a; font-size: .88rem; padding: .8rem .2rem; }
.link-picker-list { list-style: none; margin: .7rem 0 0; padding: 0; overflow-y: auto; }
.link-picker-item { display: flex; align-items: flex-start; gap: .6rem; width: 100%; text-align: left;
    background: none; border: none; border-radius: 8px; padding: .5rem .55rem; cursor: pointer; }
.link-picker-item:hover { background: var(--lr-red-50); }
.link-picker-icon { flex: none; margin-top: .1rem; }
.link-picker-body { display: flex; flex-direction: column; min-width: 0; }
.link-picker-crumb { color: #8a94a6; font-size: .72rem; }
.link-picker-title { font-weight: 600; font-size: .92rem; }
.link-picker-meta { color: #8a94a6; font-size: .76rem; font-family: ui-monospace, Consolas, monospace; }
.link-picker-lock { margin-left: auto; }
.link-picker-tabs { display: flex; gap: .3rem; margin: 0 0 .8rem; }
.link-tab { border: 1px solid var(--lr-border); background: #fff; border-radius: 999px; padding: .25rem .8rem;
    font-size: .82rem; cursor: pointer; color: var(--lr-sidebar-fg); }
.link-tab.active { background: var(--lr-red); border-color: var(--lr-red); color: #fff; }
.link-url-form { display: flex; flex-direction: column; gap: .7rem; }
.link-url-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: #5f6b7a; }
.lp-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem; margin: .7rem 0 .2rem; font-size: .82rem; }
.lp-crumb { background: none; border: none; color: var(--lr-red); cursor: pointer; padding: .1rem .25rem; border-radius: 5px; }
.lp-crumb:hover { background: var(--lr-red-50); }
.lp-sep { color: #c2c9d2; }
.lp-row { display: flex; align-items: center; }
.lp-row .link-picker-item { flex: 1; }
.lp-open { flex: none; background: none; border: 1px solid var(--lr-border); border-radius: 6px; width: 28px; height: 28px;
    cursor: pointer; color: #5f6b7a; font-size: 1.1rem; line-height: 1; }
.lp-open:hover { background: var(--lr-red-50); color: var(--lr-red); border-color: var(--lr-red); }

/* ---- Object Map ---- */
/* Inline chip (in page prose) */
.map-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .85em; font-weight: 600;
    color: var(--lr-red-700); background: var(--lr-red-50); border: 1px solid #f3d3d0; border-radius: 999px;
    padding: .02em .55em; text-decoration: none; line-height: 1.5; white-space: nowrap; }
.map-chip:hover { background: var(--lr-red); color: #fff; border-color: var(--lr-red); }
.map-chip.is-missing { color: #8a94a6; background: #f1f3f5; border-color: var(--lr-border); cursor: help; }

/* Tag pills */
.map-tag { display: inline-block; font-size: .72rem; font-weight: 600; color: #44505f; background: #eef1f4;
    border: 1px solid var(--lr-border); border-radius: 999px; padding: .02rem .5rem; margin: .1rem .15rem .1rem 0;
    text-decoration: none; white-space: nowrap; }
a.map-tag:hover { background: var(--lr-red-50); color: var(--lr-red-700); border-color: #f3d3d0; }
.map-tags { display: flex; flex-wrap: wrap; gap: .15rem; margin: .2rem 0 .6rem; }

/* Tag badge input (edit form) */
.tag-input { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .35rem .5rem;
    border: 1px solid var(--lr-border); border-radius: 7px; background: #fff; min-height: 2.3rem; }
.tag-input:focus-within { border-color: var(--lr-red); box-shadow: 0 0 0 3px var(--lr-red-50); }
.tag-pill { display: inline-flex; align-items: center; gap: .15rem; font-size: .78rem; font-weight: 600;
    color: var(--lr-red-700); background: var(--lr-red-50); border: 1px solid #f3d3d0; border-radius: 999px;
    padding: .08rem .15rem .08rem .55rem; }
.tag-x { border: none; background: none; cursor: pointer; color: var(--lr-red-700); font-size: 1rem;
    line-height: 1; padding: 0 .25rem; border-radius: 999px; }
.tag-x:hover { background: var(--lr-red); color: #fff; }
.tag-input-field { border: none; outline: none; flex: 1; min-width: 130px; font-size: .88rem; padding: .15rem; background: transparent; }

/* Origin badges */
.map-origin { font-size: .74rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.map-origin-0 { background: #e7f0fb; color: #1b4f8a; }      /* Oracle Standard */
.map-origin-1 { background: #fef6e6; color: #6a4b08; }      /* Custom */
.map-origin-2 { background: var(--lr-red-50); color: var(--lr-red-700); }  /* LatamReady */

/* Embedded table (objectmap block) */
.objectmap { border: 1px solid var(--lr-border); border-radius: 10px; margin: 1.2rem 0; overflow: hidden; }
.objectmap-title { font-weight: 700; font-size: .92rem; padding: .55rem .8rem; background: #f6f8fa; border-bottom: 1px solid var(--lr-border); }
.objectmap-empty { color: #5f6b7a; font-size: .88rem; padding: .8rem; margin: 0; }
.objectmap-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.objectmap-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: #8a94a6; padding: .4rem .7rem; border-bottom: 1px solid var(--lr-border); }
.objectmap-table td { padding: .4rem .7rem; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.om-exp { width: 1.4rem; color: #8a94a6; cursor: pointer; user-select: none; }
.om-row { cursor: pointer; }
.om-row:hover { background: #f6f8fa; }
.om-row.is-open { background: var(--lr-red-50); }
.om-name { font-weight: 600; text-decoration: none; color: var(--lr-ink); }
.om-name:hover { color: var(--lr-red); }
.om-detail td { background: #fbfcfd; }
.om-desc { color: #44505f; margin-bottom: .4rem; }
.om-rel { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.om-rel-label, .om-norel { color: #8a94a6; font-size: .8rem; }

/* /map area */
.map-h1 { margin: 0; }
.map-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 1rem; }
.map-filters .form-control { flex: 1; min-width: 220px; }
.map-filters .form-select { width: auto; }
.map-count { font-size: .82rem; margin-top: .5rem; }
.map-group-toggle { font-size: .85rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
.map-group { margin-bottom: 1rem; border: 1px solid var(--lr-border); border-radius: 8px; overflow: hidden; }
.map-group-header { display: flex; align-items: center; gap: .55rem; background: #f6f8fa; padding: .45rem .7rem;
    border-bottom: 1px solid var(--lr-border); font-weight: 600; font-size: .9rem; }
.map-group-header a { text-decoration: none; }
.map-group-sub { color: #8a94a6; font-size: .76rem; font-weight: 400; }
.map-group-count { margin-left: auto; color: #8a94a6; font-size: .76rem; font-weight: 600;
    background: #fff; border: 1px solid var(--lr-border); border-radius: 999px; padding: .02rem .5rem; }
.map-group .map-list { margin: 0; }
.map-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; font-size: .85rem; color: #5f6b7a; }

/* Single-table tree view (group by parent) */
.map-count-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .6rem 0 .3rem; }
.map-treebtns { font-size: .8rem; color: #9aa4b2; display: inline-flex; gap: .4rem; align-items: center; white-space: nowrap; }
.map-tree th.om-exp, .map-tree td.om-exp { width: 1.7rem; text-align: center; padding-left: .3rem; padding-right: 0; }
.om-toggle { background: none; border: none; cursor: pointer; color: #6b7480; font-size: .8rem; line-height: 1; padding: .15rem .25rem; border-radius: 4px; }
.om-toggle:hover { background: #e7e8ea; color: #111; }
.map-parent-row { background: #f6f8fa; }
.map-parent-row > td { border-top: 1px solid var(--lr-border); font-weight: 600; }
.map-parent-name { text-decoration: none; color: var(--lr-ink); }
.map-parent-name:hover { color: var(--lr-red); }
.map-child-badge { margin-left: .45rem; color: #8a94a6; font-size: .72rem; font-weight: 600; background: #fff;
    border: 1px solid var(--lr-border); border-radius: 999px; padding: .02rem .45rem; }
.map-child-row > td { border-top: 1px solid #eef1f4; }
.map-child-name { padding-left: 1.3rem; text-decoration: none; position: relative; }
.map-child-name::before { content: "↳"; position: absolute; left: .3rem; color: #c2c9d2; }
.map-form { display: flex; flex-direction: column; gap: .8rem; max-width: 720px; }
.map-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: #5f6b7a; font-weight: 600; }
.map-form-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.map-form-row > label { flex: 1; min-width: 240px; }
.map-form-actions { display: flex; gap: .5rem; }
.map-countries { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .3rem 0; }
.map-countries-label { font-size: .85rem; font-weight: 600; color: #5f6b7a; width: 100%; }
.map-countries .checkbox { font-size: .85rem; font-weight: 400; }
.map-import { display: flex; flex-direction: column; gap: .6rem; max-width: 820px; }
.map-import label { font-size: .85rem; color: #5f6b7a; display: block; }
.map-rel-list { display: flex; flex-direction: column; gap: .3rem; }
.map-rel-row { display: flex; align-items: center; gap: .5rem; }
.map-rel-dir { color: #8a94a6; width: 1rem; text-align: center; }
.map-rel-type { font-size: .76rem; color: #8a94a6; font-style: italic; }
.map-rel-objtype { font-size: .72rem; color: #8a94a6; background: #f1f3f5; border-radius: 999px; padding: .05rem .45rem; }
.map-parent { color: #5f6b7a; font-size: .9rem; }

/* ---- Sign-in page ---- */
.login-body { min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #fbfcfd 0%, #f1f3f7 100%); padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--lr-border);
    border-radius: 14px; box-shadow: 0 10px 30px rgba(20,30,50,.08); padding: 1.8rem 1.6rem; }
.login-logo { height: 38px; width: auto; display: block; margin: 0 auto 1.2rem; }
.login-title { font-size: 1.3rem; font-weight: 700; text-align: center; margin: 0 0 .3rem; }
.login-sub { color: #5f6b7a; font-size: .86rem; text-align: center; margin: 0 0 1.2rem; }
.login-form { display: flex; flex-direction: column; gap: .6rem; }
.login-code { text-align: center; font-size: 1.5rem; letter-spacing: .4rem; font-weight: 600; }
.login-google { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 500; }
.login-g { font-weight: 700; color: #4285F4; }
.login-divider { display: flex; align-items: center; gap: .6rem; color: #9aa4b2; font-size: .8rem; margin: .9rem 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--lr-border); }
.login-alert { border-radius: 8px; padding: .55rem .7rem; font-size: .85rem; margin-bottom: 1rem; }
.login-alert.is-error { background: #fdecea; color: #c5221f; border: 1px solid #f5c6cb; }
.login-alert.is-info { background: var(--lr-red-50); color: var(--lr-red-700); border: 1px solid #f3d3d0; }
.login-secondary { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1rem;
    font-size: .85rem; color: #9aa4b2; }
.login-inline { display: inline; margin: 0; }
.btn-link { background: none; border: none; padding: 0; color: var(--lr-red); font: inherit; cursor: pointer; text-decoration: none; }
.btn-link:hover { color: var(--lr-red-700); text-decoration: underline; }
.centered-message .btn { margin: .25rem; }

@media (max-width: 768px) {
    .page { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--lr-border); }
    .sidebar-resizer { display: none; }
    .editor-split { flex-direction: column; height: auto; }
    .editor-pane { height: 40vh; }
    .content { padding: 1.25rem 1.25rem; }
}
