:root {
    --sidebar-expanded: 238px;
    --sidebar-collapsed: 68px;
    --sidebar-width: var(--sidebar-expanded);
    --context-width: 264px;
    --context-collapsed: 31px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; }
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--app-bg);
    color: var(--text-primary);
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--context-width);
    width: 100%;
    height: 100%;
    background: var(--app-bg);
    transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed { --sidebar-width: var(--sidebar-collapsed); }
.app-shell.context-collapsed { --context-width: var(--context-collapsed); }

.primary-sidebar {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--panel-line);
    color: var(--text-primary);
}

.sidebar-top {
    position: relative;
    flex: 0 0 124px;
    min-height: 124px;
}

.sidebar-toggle {
    position: absolute;
    top: 5px;
    right: 6px;
    z-index: 3;
    width: 27px;
    height: 27px;
    padding: 4px;
    border: 0;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
}

.sidebar-toggle:hover { background: var(--module-hover-bg); }
.sidebar-toggle:focus-visible,
.module:focus-visible,
.user-trigger:focus-visible,
.theme-toggle:focus-visible,
.user-menu-item:focus-visible {
    outline: 1px solid var(--focus-ring);
    outline-offset: 2px;
}
.sidebar-toggle img { width: 19px; height: 19px; display: block; object-fit: contain; transition: transform 180ms ease; }

.platform-brand {
    height: 100%;
    display: flex;
    align-items: flex-start;
    padding: 15px 20px 0 24px;
    overflow: hidden;
    transition: opacity 120ms ease;
}
.platform-brand img { width: 176px; height: auto; display: block; object-fit: contain; }

.module-nav {
    display: grid;
    gap: 2px;
    padding: 26px 14px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.module {
    width: 100%;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 11px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.module:hover { background: var(--module-hover-bg); color: var(--text-primary); }
.module.active { background: var(--module-active-bg); color: var(--module-active-text); }
.module-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 15px;
    line-height: 1;
}
.module-icon i { color: inherit; margin: 0; font-style: normal; }
.module-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 400;
}

.sidebar-footer {
    position: relative;
    margin-top: auto;
    flex: 0 0 auto;
    background: var(--sidebar-bg);
}

.company-brand {
    min-height: 83px;
    display: flex;
    align-items: center;
    padding: 13px 24px 12px;
    overflow: hidden;
}
.company-logo {
    display: block;
    max-width: 184px;
    max-height: 58px;
    object-fit: contain;
    object-position: left center;
}

.user-toolbar {
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: center;
    gap: 2px;
    padding: 8px 10px 8px 13px;
    border-top: 1px solid var(--panel-line);
}

.user-menu-wrap { position: relative; min-width: 0; }
.user-trigger {
    width: 100%;
    min-width: 0;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}
.user-trigger:hover { background: var(--module-hover-bg); }
.user-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--avatar-text);
    font-size: 11px;
    line-height: 1;
}
.user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}
.user-caret {
    flex: 0 0 auto;
    margin-left: 2px;
    color: var(--text-muted);
    font-size: 13px;
    transform: translateY(-1px);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 4px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.theme-toggle:hover { background: var(--module-hover-bg); }
.theme-toggle:disabled { opacity: .55; cursor: wait; }
.theme-toggle img { display: block; width: 27px; height: 27px; object-fit: contain; }

.user-menu {
    position: absolute;
    left: -1px;
    bottom: calc(100% + 9px);
    z-index: 30;
    width: 210px;
    padding: 7px;
    border: 1px solid var(--menu-border);
    border-radius: 12px;
    background: var(--menu-bg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}
.user-menu[hidden] { display: none; }
.user-menu form { margin: 0; }
.user-menu-item {
    width: 100%;
    min-height: 39px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
}
.user-menu-item:hover { background: var(--menu-hover); }
.user-menu-item i,
.logout-mark { width: 17px; text-align: center; color: var(--text-primary); }
.logout-mark { font-size: 17px; line-height: 1; }

.module-workspace {
    min-width: 0;
    height: 100%;
    overflow: auto;
    background: var(--app-bg);
}

.module-side-panel {
    position: relative;
    min-width: 0;
    height: 100%;
    background: var(--context-bg);
    border-left: 1px solid var(--panel-line);
    overflow: hidden;
}
.context-toggle {
    position: absolute;
    top: 4px;
    right: 5px;
    z-index: 8;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    padding: 3px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}
.context-toggle:hover { background: var(--module-hover-bg); }
.context-toggle:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 1px; }
.context-toggle img { width: 18px; height: 18px; display: block; object-fit: contain; transform: rotate(180deg); transition: transform 180ms ease; }
.module-panel-content { height: 100%; display: grid; grid-template-rows: 43% 57%; min-width: 0; }
.module-options { min-height: 0; overflow: hidden; border-bottom: 1px solid var(--panel-line); }
.module-chats { min-height: 0; overflow: hidden; }
.app-shell.context-collapsed .module-panel-content { display: none; }
.app-shell.context-collapsed .context-toggle { right: 3px; }
.app-shell.context-collapsed .context-toggle img { transform: rotate(0deg); }

.app-shell.sidebar-collapsed .platform-brand,
.app-shell.sidebar-collapsed .module-name,
.app-shell.sidebar-collapsed .company-brand,
.app-shell.sidebar-collapsed .user-name,
.app-shell.sidebar-collapsed .user-caret {
    display: none;
}
.app-shell.sidebar-collapsed .sidebar-top { flex-basis: 58px; min-height: 58px; }
.app-shell.sidebar-collapsed .sidebar-toggle { top: 11px; right: 20px; }
.app-shell.sidebar-collapsed .sidebar-toggle img { transform: rotate(180deg); }
.app-shell.sidebar-collapsed .module-nav { padding: 21px 11px 12px; justify-items: center; }
.app-shell.sidebar-collapsed .module {
    width: 44px;
    height: 40px;
    justify-content: center;
    padding: 0;
}
.app-shell.sidebar-collapsed .module-icon { font-size: 17px; }
.app-shell.sidebar-collapsed .sidebar-footer { margin-top: auto; }
.app-shell.sidebar-collapsed .user-toolbar {
    grid-template-columns: 1fr;
    gap: 5px;
    justify-items: center;
    padding: 9px 6px;
}
.app-shell.sidebar-collapsed .user-menu-wrap { width: 44px; }
.app-shell.sidebar-collapsed .user-trigger { justify-content: center; width: 44px; }
.app-shell.sidebar-collapsed .user-avatar { flex-basis: 36px; width: 36px; height: 36px; }
.app-shell.sidebar-collapsed .theme-toggle { width: 36px; height: 36px; }
.app-shell.sidebar-collapsed .user-menu {
    left: calc(100% + 12px);
    bottom: -2px;
}


.module-placeholder,
.mp-loading,
.mp-error {
    min-height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13px;
}

.mp-create-view {
    min-height: 100%;
    display: grid;
    place-items: start center;
    padding: clamp(70px, 11vh, 128px) 30px 50px;
}
.mp-create-card { width: min(590px, 92%); text-align: center; }
.mp-create-kicker { margin: 0 0 31px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.mp-create-instruction { margin: 0 0 34px; color: var(--text-secondary); font-size: 14px; line-height: 1.35; }
.mp-template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 0 auto 48px; }
.mp-template-card {
    min-width: 0;
    height: 136px;
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    gap: 6px;
    padding: 15px 12px 11px;
    border: 1px solid var(--control-border);
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
}
.mp-template-card:hover { border-color: var(--control-border-strong); color: var(--text-primary); }
.mp-template-card.is-selected { border-color: var(--selected-outline); color: var(--text-primary); box-shadow: 0 0 0 1px var(--selected-outline) inset; }
.mp-template-logo { min-height: 76px; display: grid; place-items: center; }
.mp-template-logo img { max-width: 82px; max-height: 76px; object-fit: contain; opacity: .78; }
html[data-theme="light"] .mp-template-card:not(.is-selected) .mp-template-logo img { opacity: .47; }
html[data-theme="dark"] .mp-template-card.is-selected .mp-template-logo img { filter: brightness(0) invert(1); opacity: 1; }
html[data-theme="light"] .mp-template-card.is-selected .mp-template-logo img { opacity: 1; }
.mp-template-name { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mp-empty-templates { grid-column: 1 / -1; padding: 34px 20px; border: 1px dashed var(--control-border); color: var(--text-muted); }
.mp-client-block { display: grid; gap: 16px; }
.mp-client-mode { justify-self: center; display: inline-flex; padding: 3px; border: 1px solid var(--control-border); border-radius: 7px; background: var(--surface-1); }
.mp-client-mode-btn { min-height: 30px; padding: 5px 12px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; }
.mp-client-mode-btn.is-active { background: var(--surface-3); color: var(--text-primary); }
.mp-client-field { display: grid; gap: 25px; color: var(--text-secondary); font-size: 13px; text-align: center; }
.mp-client-field input,
.mp-client-field select {
    width: min(520px, 100%);
    height: 40px;
    justify-self: center;
    padding: 0 14px;
    border: 1px solid var(--control-border);
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--text-primary);
    outline: none;
}
.mp-client-field input:focus,
.mp-client-field select:focus { border-color: var(--control-border-strong); }
.mp-primary-action,
.mp-panel-action,
.mp-send-action {
    border: 1px solid var(--control-border);
    background: var(--surface-2);
    color: var(--text-primary);
    cursor: pointer;
}
.mp-primary-action { width: 236px; height: 41px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; margin-top: 51px; border-radius: 5px; font-weight: 600; }
.mp-primary-action:hover:not(:disabled), .mp-panel-action:hover, .mp-send-action:hover:not(:disabled) { background: var(--surface-3); }
.mp-primary-action:disabled, .mp-send-action:disabled { opacity: .45; cursor: not-allowed; }
.mp-inline-status { min-height: 20px; margin-top: 12px; color: var(--text-muted); font-size: 12px; }

.mp-proposals-panel,
.mp-chats-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 41px 11px 10px; }
.mp-chats-panel { padding-top: 17px; }
.mp-panel-heading { flex: 0 0 auto; padding: 0 3px 9px; color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.mp-panel-heading--recent { padding-top: 17px; border-top: 1px solid var(--panel-line); margin-top: 11px; }
.mp-panel-action { flex: 0 0 auto; min-height: 42px; width: 100%; display: flex; align-items: center; gap: 15px; padding: 0 15px; border-radius: 5px; font-size: 13px; font-weight: 600; text-align: left; }
.mp-panel-action i { font-size: 16px; }
.mp-proposal-tree,
.mp-chat-list { min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; padding: 14px 0 0; }
.mp-chat-list { padding-top: 5px; }
.mp-panel-empty { padding: 15px 7px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }
.mp-tree-year,
.mp-tree-client { margin: 0; }
.mp-tree-year > summary,
.mp-tree-client > summary { list-style: none; cursor: pointer; user-select: none; }
.mp-tree-year > summary::-webkit-details-marker,
.mp-tree-client > summary::-webkit-details-marker { display: none; }
.mp-tree-year > summary { min-height: 29px; display: flex; align-items: center; justify-content: space-between; padding: 4px 4px; color: var(--text-muted); font-size: 11px; }
.mp-tree-client > summary { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 4px 3px 8px; color: var(--text-primary); font-size: 12px; }
.mp-tree-year summary i,
.mp-tree-client summary i { font-size: 9px; transition: transform 120ms ease; }
.mp-tree-year:not([open]) > summary i,
.mp-tree-client:not([open]) > summary i { transform: rotate(-90deg); }
.mp-tree-items { display: grid; gap: 2px; }
.mp-tree-proposal { width: 100%; min-height: 33px; display: flex; align-items: center; gap: 8px; padding: 5px 7px 5px 9px; border: 0; border-radius: 3px; background: transparent; color: var(--text-muted); text-align: left; cursor: pointer; font-size: 11px; }
.mp-tree-proposal:hover { background: var(--module-hover-bg); color: var(--text-primary); }
.mp-tree-proposal.is-selected { background: var(--module-active-bg); color: var(--module-active-text); }
.mp-tree-proposal span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-chat-row { min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) 26px; align-items: center; border-radius: 3px; }
.mp-chat-row:hover, .mp-chat-row.is-selected { background: var(--module-hover-bg); }
.mp-chat-row.is-selected { background: var(--module-active-bg); }
.mp-chat-select { min-width: 0; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 5px 0 8px; border: 0; background: transparent; color: var(--text-muted); text-align: left; cursor: pointer; font-size: 10.5px; }
.mp-chat-row.is-selected .mp-chat-select { color: var(--text-primary); }
.mp-chat-select span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-chat-more { width: 26px; height: 31px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; }

.mp-work-view { min-height: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.mp-work-view.is-empty-chat { grid-template-rows: clamp(150px, 24vh, 245px) auto; align-content: start; }
.mp-work-view.is-empty-chat .mp-composer-zone { padding-bottom: 0; }
.mp-conversation { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.mp-conversation-inner { width: min(760px, 82%); margin: 0 auto; padding: 52px 0 28px; display: grid; gap: 19px; }
.mp-message { max-width: 88%; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.55; }
.mp-message--user { justify-self: end; background: var(--surface-3); }
.mp-message--assistant { justify-self: start; background: var(--surface-1); border: 1px solid var(--control-border); }
.mp-message--system { justify-self: stretch; max-width: 100%; color: var(--danger); background: var(--danger-bg); }
.mp-message-role { margin-bottom: 5px; color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.mp-message-content { color: var(--text-primary); overflow-wrap: anywhere; }
.mp-composer-zone { width: min(720px, 84%); margin: 0 auto; padding: 0 0 clamp(46px, 8vh, 92px); }
.mp-agent-guidance { margin-bottom: 32px; color: var(--text-secondary); font-size: 13px; line-height: 1.35; }
.mp-composer { min-height: 142px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface-2); overflow: visible; }
.mp-composer textarea { width: 100%; min-height: 91px; resize: vertical; padding: 19px 15px 10px; border: 0; outline: none; background: transparent; color: var(--text-primary); line-height: 1.45; }
.mp-composer textarea::placeholder { color: var(--text-muted); }
.mp-composer-footer { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 10px 8px 10px; }
.mp-composer-left { min-width: 0; display: flex; align-items: center; gap: 8px; }
.mp-round-action { flex: 0 0 37px; width: 37px; height: 37px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text-primary); cursor: pointer; }
.mp-file-chips { min-width: 0; display: flex; gap: 5px; overflow: hidden; }
.mp-file-chip { max-width: 135px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 4px; background: var(--surface-1); color: var(--text-muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-proposal-inline { position: relative; flex: 0 0 min(290px, 47%); display: grid; grid-template-columns: minmax(0, 1fr) 39px; gap: 7px; }
.mp-proposal-inline input { min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 4px; background: var(--surface-3); color: var(--text-muted); outline: none; }
.mp-proposal-inline input:focus { box-shadow: 0 0 0 1px var(--control-border-strong) inset; color: var(--text-primary); }
.mp-more-action { width: 39px; height: 36px; border: 0; border-radius: 18px; background: var(--surface-3); color: var(--text-muted); cursor: pointer; }
.mp-proposal-menu { position: absolute; right: 0; bottom: 44px; z-index: 20; width: 270px; padding: 6px; border: 1px solid var(--menu-border); border-radius: 9px; background: var(--menu-bg); box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.mp-proposal-menu[hidden] { display: none; }
.mp-proposal-menu button { width: 100%; min-height: 35px; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; font-size: 11px; }
.mp-proposal-menu button:hover:not(:disabled) { background: var(--menu-hover); }
.mp-proposal-menu button:disabled { opacity: .42; cursor: not-allowed; }
.mp-proposal-menu button.is-danger { color: var(--danger); }
.mp-proposal-menu i { width: 15px; text-align: center; }
.mp-send-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.mp-send-action { min-width: 92px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 5px; font-size: 11px; }

.mp-modal-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.58); }
.mp-modal { width: min(430px, 94vw); border: 1px solid var(--menu-border); border-radius: 12px; background: var(--menu-bg); color: var(--text-primary); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.mp-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 12px; border-bottom: 1px solid var(--panel-line); }
.mp-modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.mp-modal-close { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 22px; }
.mp-modal-body { padding: 17px 18px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.mp-modal-field { display: grid; gap: 7px; margin-bottom: 13px; }
.mp-modal-field input, .mp-modal-field select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 5px; background: var(--surface-2); color: var(--text-primary); }
.mp-modal-separator { margin: 5px 0 12px; color: var(--text-muted); text-align: center; font-size: 10px; text-transform: uppercase; }
.mp-modal-error { min-height: 18px; color: var(--danger); font-size: 11px; }
.mp-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 17px; }
.mp-modal-actions button { min-height: 34px; padding: 6px 13px; border: 1px solid var(--control-border); border-radius: 5px; cursor: pointer; }
.mp-modal-secondary { background: transparent; color: var(--text-primary); }
.mp-modal-primary { background: var(--surface-3); color: var(--text-primary); }
.mp-modal-danger { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 1180px) {
    .mp-composer-zone { width: 90%; }
    .mp-conversation-inner { width: 88%; }
}
@media (max-width: 900px) {
    .mp-template-grid { grid-template-columns: 1fr; width: min(300px, 100%); }
    .mp-create-view { padding-top: 45px; }
    .mp-composer-zone { width: 94%; }
    .mp-proposal-inline { flex-basis: 45%; }
}

/* Login se mantiene independiente del shell de usuario. */
.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background-image: linear-gradient(rgba(0,0,0,.32), rgba(0,0,0,.32)), url('/assets/login-background.php');
    background-size: cover;
    background-position: center;
    color: #fff;
}
.login-card {
    width: min(425px, 90vw);
    padding: 24px 40px 42px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    background: rgba(0,0,0,.42);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    backdrop-filter: blur(3px);
    color: #fff;
}
.login-card h1 { margin: 5px 0 28px; font-size: 34px; font-weight: 400; text-align: center; }
.login-card form { display: grid; gap: 18px; }
.login-card label { display: grid; gap: 7px; font-size: 13px; color: #fff; }
.login-card input {
    height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,255,255,.9);
    color: #333;
}
.login-card button {
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(45,45,45,.85);
    color: #fff;
    cursor: pointer;
}
.login-card button:hover { background: rgba(20,20,20,.9); }
.login-logo { max-width: 290px; display: block; margin: 0 auto 35px; filter: brightness(0) invert(1); }
.alert { padding: 10px; border-radius: 6px; background: #fff0eb; color: #8d2e08; }
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,.9) inset !important;
    -webkit-text-fill-color: #333 !important;
}
@font-face {
    font-family: 'Shadows Into Light';
    src: url('/assets/fonts/ShadowsIntoLight-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
.who-title { font-family: 'Shadows Into Light', cursive !important; }

@media (max-width: 1180px) {
    :root { --context-width: 210px; --sidebar-expanded: 220px; }
}

@media (max-width: 820px) {
    :root { --context-width: 190px; --sidebar-expanded: 190px; }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell,
    .sidebar-toggle img { transition: none; }
}

/* 4.4.0 · Ajustes Make-Prop de conversación y navegación */
.theme-toggle img { width: 20px; height: 20px; }
.mp-tree-client-label { min-width: 0; display: flex; align-items: center; gap: 8px; }
.mp-tree-client-label > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-tree-client-label > i { flex: 0 0 13px; width: 13px; font-size: 12px !important; transform: none !important; }
.mp-work-view,
.mp-work-view.is-empty-chat { grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; }
.mp-work-view.is-empty-chat .mp-composer-zone { padding-bottom: 18px; }
.mp-conversation-inner { width: min(720px, 84%); padding-top: 34px; }
.mp-message { width: auto; max-width: 88%; }
.mp-message--user { justify-self: end; max-width: 58%; }
.mp-message--assistant { justify-self: stretch; width: 100%; max-width: 100%; background: var(--surface-1); border: 1px solid var(--control-border); }
.mp-message-role { display: none; }
.mp-composer-zone { padding-bottom: 18px; }
.mp-agent-guidance { margin-bottom: 18px; }
.mp-round-action i { font-size: 17px; }
.mp-inline-status { min-height: 18px; padding-top: 5px; }
@media (max-width: 1180px) {
    .mp-conversation-inner { width: 90%; }
}
@media (max-width: 900px) {
    .mp-conversation-inner { width: 94%; }
}

/* 4.5.0 · Ajustes visuales Make-Prop y estado de procesamiento */
.theme-toggle img { width: 15px; height: 15px; }
.mp-primary-action > i,
.mp-panel-action > i { flex: 0 0 auto; width: 16px; text-align: center; }
.mp-round-action > i { display: inline-block; min-width: 1em; text-align: center; }
.mp-more-action > i { font-size: 14px; }
.mp-inline-status.is-agent-processing {
    min-height: 31px;
    padding-top: 4px;
    font-family: 'Shadows Into Light', cursive;
    font-size: 20px;
    line-height: 1.35;
    letter-spacing: .01em;
    color: var(--text-secondary);
}
@media (prefers-reduced-motion: reduce) {
    .mp-inline-status.is-agent-processing { font-family: inherit; font-size: 12px; }
}

/* 4.8.0 · Make-Prop: creación simplificada, contexto por propuesta y conversación ampliada */
.app-shell[data-module-code="make-prop"] .module-panel-content { grid-template-rows: 58% 42%; }

.mp-create-card { width: min(620px, 94%); }
.mp-create-kicker { margin-bottom: 34px; }
.mp-create-dropzone {
    width: min(520px, 100%);
    min-height: 180px;
    margin: 32px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    border: 1px dashed var(--control-border-strong);
    border-radius: 7px;
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: border-color 120ms ease, background 120ms ease;
}
.mp-create-dropzone:hover,
.mp-create-dropzone.is-dragging { border-color: var(--selected-outline); background: var(--surface-2); }
.mp-create-dropzone:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 2px; }
.mp-create-dropzone > i { font-size: 26px; color: var(--text-primary); }
.mp-create-dropzone > strong { font-size: 13px; font-weight: 400; }
.mp-create-dropzone > span { font-size: 14px; line-height: 1.4; }
.mp-create-pending-files {
    width: min(520px, 100%);
    margin: 10px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.mp-create-pending-file {
    max-width: 100%;
    display: inline-grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
}
.mp-create-pending-file > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-create-pending-file button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; }
.mp-create-view .mp-primary-action { margin-top: 28px; }

.mp-conversation-inner,
.mp-composer-zone { width: min(1080px, 90%); }
.mp-conversation-inner { padding-top: 34px; }
.mp-message { font-size: 15px; line-height: 1.55; }
.mp-message-content strong { font-weight: 700; color: var(--text-primary); }
.mp-composer textarea { font-size: 15px; line-height: 1.5; }
.mp-agent-guidance { font-size: 15px; }

.mp-tree-proposal-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border-radius: 3px;
}
.mp-tree-proposal-row:hover,
.mp-tree-proposal-row.is-selected { background: var(--module-hover-bg); }
.mp-tree-proposal-row.is-selected { background: var(--module-active-bg); }
.mp-tree-proposal-row .mp-tree-proposal { background: transparent; }
.mp-tree-proposal-row .mp-tree-proposal:hover,
.mp-tree-proposal-row .mp-tree-proposal.is-selected { background: transparent; }
.mp-proposal-download {
    width: 28px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 3px;
}
.mp-proposal-download:hover { color: var(--text-primary); background: var(--surface-3); }

.mp-proposals-panel { overflow: hidden; }
.mp-proposal-tree { flex: 1 1 auto; min-height: 72px; }
.mp-context-files-section {
    flex: 0 1 48%;
    min-height: 122px;
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--panel-line);
}
.mp-panel-heading--context { padding-top: 15px; padding-bottom: 6px; }
.mp-context-file-list { min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.mp-context-file-row {
    min-height: 34px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 4px;
    border-radius: 3px;
}
.mp-context-file-row:hover { background: var(--module-hover-bg); }
.mp-context-file-download {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 6px 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
}
.mp-context-file-download span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-context-file-delete {
    width: 28px;
    height: 30px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.mp-context-file-delete:hover { color: var(--danger); }
.mp-context-empty { padding-top: 7px; }

.login-notice {
    margin: 0 0 18px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 7px;
    background: rgba(0,0,0,.42);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
}

@media (max-width: 1180px) {
    .mp-conversation-inner,
    .mp-composer-zone { width: 92%; }
}
@media (max-width: 900px) {
    .mp-conversation-inner,
    .mp-composer-zone { width: 95%; }
    .mp-create-dropzone { min-height: 150px; }
}

/* 4.8.1 · coherencia del panel lateral y gestión completa de contexto */
.mp-tree-proposal-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
}
.mp-proposal-delete {
    width: 28px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.mp-proposal-delete:hover { color: var(--danger); background: var(--surface-3); }
.mp-panel-heading--context,
.mp-panel-heading--chats { padding-top: 0; padding-bottom: 9px; }
.mp-chat-list { padding-top: 14px; }
.mp-context-file-list { padding-top: 7px; }

.mp-modal--files { width: min(760px, 94vw); }
.mp-modal--files .mp-modal-body { padding: 0 18px 8px; }
.mp-context-manager { min-width: 0; }
.mp-context-manager-add {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--panel-line);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
}
.mp-context-manager-add:hover { color: var(--text-primary); background: var(--module-hover-bg); }
.mp-context-manager-add-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-primary);
    font-size: 14px;
}
.mp-context-manager-list { max-height: min(54vh, 520px); overflow-y: auto; scrollbar-width: thin; }
.mp-context-manager-row {
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    align-items: center;
    border-bottom: 1px solid var(--panel-line);
}
.mp-context-manager-row:last-child { border-bottom: 0; }
.mp-context-manager-row:hover { background: var(--module-hover-bg); }
.mp-context-manager-file {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    color: var(--text-primary);
    text-decoration: none;
}
.mp-context-manager-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 15px;
}
.mp-context-manager-copy { min-width: 0; display: grid; gap: 2px; }
.mp-context-manager-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.mp-context-manager-copy small { color: var(--text-muted); font-size: 11px; }
.mp-context-manager-delete {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
}
.mp-context-manager-delete:hover { color: var(--danger); }
.mp-context-manager-delete:disabled { opacity: .45; cursor: wait; }
.mp-context-manager-empty { padding: 24px 10px; color: var(--text-muted); font-size: 12px; text-align: center; }
.mp-context-manager-status { min-height: 24px; padding: 8px 10px 0; color: var(--text-muted); font-size: 11px; }

/* 4.10.1 · gestión segura de clientes, feedback inmediato y bienvenida */
.platform-brand {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.platform-brand:focus-visible {
    outline: 1px solid var(--focus-ring);
    outline-offset: -3px;
}

.home-welcome {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 32px;
}
.home-welcome-text {
    max-width: min(900px, 92%);
    min-height: 90px;
    font-family: 'Shadows Into Light', cursive;
    font-size: 30px;
    font-weight: 400;
    line-height: 1.35;
    text-align: center;
    white-space: pre-line;
    color: var(--text-primary);
}

.mp-tree-client-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.mp-client-manage {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.mp-client-manage:hover { color: var(--text-primary); background: var(--surface-3); }
.mp-client-manage > i { font-size: 11px !important; transform: none !important; }
.mp-tree-client-chevron { width: 18px; text-align: center; }
.mp-tree-client:not([open]) > summary .mp-tree-client-chevron { transform: rotate(-90deg); }
.mp-client-manage-help { margin: 2px 0 13px; color: var(--text-muted); font-size: 11px; }

.mp-agent-processing-status {
    min-height: 33px;
    margin: 0 0 10px;
    padding: 1px 2px 2px;
    font-family: 'Shadows Into Light', cursive;
    font-size: 20px;
    line-height: 1.35;
    letter-spacing: .01em;
    color: var(--text-muted);
    white-space: pre-wrap;
}
.mp-agent-processing-status[hidden] { display: none; }
.mp-agent-processing-char {
    color: var(--text-muted);
    animation: mp-agent-char-pulse 1.65s ease-in-out infinite;
    animation-delay: calc(var(--char-index) * 42ms);
}
@keyframes mp-agent-char-pulse {
    0%, 45% { color: var(--text-muted); }
    70%, 100% { color: var(--text-primary); }
}

@media (prefers-reduced-motion: reduce) {
    .mp-agent-processing-char { animation: none; color: var(--text-secondary); }
}

@media (max-width: 900px) {
    .home-welcome-text { font-size: 27px; }
}

/* 4.11.0 · delegated operating context */
.module-operating-context{min-height:100%;display:flex;align-items:center;justify-content:center;padding:32px}
.module-operating-context-card{width:min(620px,92%);padding:28px;border:1px solid var(--border,#343434);border-radius:10px;background:var(--panel,#161616)}
.module-operating-context-card h2{margin:8px 0 24px;font-size:24px}
.module-operating-context-card label{display:flex;flex-direction:column;gap:8px;margin-bottom:14px}
.module-operating-context-card select{min-height:42px;padding:0 12px;border:1px solid #444;border-radius:7px;background:#1f1f1f;color:inherit;font:inherit}
.module-operating-context-card small{display:block;margin-top:16px;opacity:.68;line-height:1.45}
.mp-composer textarea:disabled,.mp-proposal-inline input:disabled{opacity:.72;cursor:not-allowed}
.mp-round-action:disabled,.mp-more-action:disabled{opacity:.45;cursor:not-allowed}
.mp-proposal-running{display:inline-flex;align-items:center;justify-content:center;width:24px;opacity:.82}

/* 4.12.3 · Agente DUM: panel, archivos y UX conversacional */
.app-shell[data-module-code="dum-agent"] .module-panel-content { grid-template-rows: minmax(0, 1fr); }
.app-shell[data-module-code="dum-agent"] .module-options { display: none; }
.app-shell[data-module-code="dum-agent"] .module-chats { min-height: 0; height: 100%; overflow: hidden; }
.dum-right-stack { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.dum-right-stack .mp-chats-panel { flex: 1 1 48%; min-height: 190px; overflow: auto; padding-bottom: 20px; }
.dum-files-panel { flex: 1 1 26%; min-height: 145px; max-height: none; overflow: auto; border-top: 1px solid var(--panel-line); padding: 20px 10px 18px; }
.dum-files-panel .mp-panel-heading { margin-bottom: 12px; }
.dum-side-file { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 6px 6px; color: var(--text-secondary); text-decoration: none; border-radius: 4px; font-size: 11px; }
.dum-side-file:hover { background: var(--surface-2); color: var(--text-primary); }
.dum-side-file i { width: 14px; text-align: center; flex: 0 0 auto; font-size: 11px; }
.dum-side-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dum-chat-menu { width: 30px; min-width: 30px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.dum-chat-menu:hover { color: var(--text-primary); }
.dum-message-files { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.dum-download-link { display:inline-flex;align-items:center;color:#fff;text-decoration:underline;text-underline-offset:3px;background:#444444;padding:2px 6px;border-radius:20%;font-weight:700; }
.dum-download-link i { margin-right: 6px; }
.app-shell[data-module-code="dum-agent"] .mp-agent-processing-status { margin-bottom: 8px; }

.app-shell[data-module-code="dum-agent"] .mp-message--assistant .mp-message-content strong { display: inline-block; padding: 1px 4px; border-radius: 20%; background: #444444; color: #fff; font-weight: 700; }

/* 4.12.5 · AKER panel refinements */
.app-shell[data-module-code="dum-agent"] .mp-chat-select{font-size:12px;}
.app-shell[data-module-code="dum-agent"] .mp-panel-empty{font-size:11px;}
.app-shell[data-module-code="dum-agent"] .dum-files-panel .mp-panel-heading{font-size:10px;letter-spacing:.08em;}
.dum-embed-app{--context-width:285px;--context-collapsed:31px;grid-template-columns:minmax(0,1fr) var(--context-width)!important;height:calc(100vh - 54px)!important;transition:grid-template-columns 180ms ease;}
.dum-embed-app .primary-sidebar{display:none!important;}
.dum-embed-app .module-side-panel{grid-column:2;}
.dum-embed-app .module-workspace{grid-column:1;}

/* 4.12.5-r1 · AKER export/download and visual consistency */
.app-shell[data-module-code="dum-agent"] .mp-chat-select,
.app-shell[data-module-code="dum-agent"] .dum-side-file,
.app-shell[data-module-code="dum-agent"] .mp-panel-empty { font-size: 12px; }
.app-shell[data-module-code="dum-agent"] .dum-side-file i { font-size: 12px; width: 15px; }
.app-shell[data-module-code="dum-agent"] .mp-message--assistant .mp-message-content strong,
.dum-download-link { border-radius: 5%; background: #444444; color: #fff; }
html[data-theme="light"] .app-shell[data-module-code="dum-agent"] .mp-message--assistant .mp-message-content strong { background: #E8E8E8; color: #1d1d1d; }
html[data-theme="light"] .dum-download-link { background: #D6D6CF; color: #1d1d1d; }
.dum-download-link { text-decoration: underline; text-underline-offset: 3px; }

.app-shell[data-module-code="dum-agent"] .mp-message { font-size: 13px; line-height: 1.55; }

/* 4.12.8 · AKER processing text uses the same typography as the conversation */
.app-shell[data-module-code="dum-agent"] .mp-agent-processing-status{
    font-family:inherit;
    font-size:13px;
    line-height:1.55;
    letter-spacing:normal;
    font-weight:400;
}
