:root {
    --ink: #243246;
    --muted: #6c7684;
    --line: #e1e5ea;
    --surface: #f6f7f9;
    --navy: #293b55;
    --bs-body-color: var(--ink);
    --bs-body-bg: #fff;
    --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bs-border-color: var(--line);
    --bs-border-radius: .35rem;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; -webkit-font-smoothing: antialiased; }
body.mail-app { overflow: hidden; height: 100dvh; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #8ba8d2; outline-offset: 2px; }
[hidden] { display: none !important; }
.text-muted { color: var(--muted) !important; }
.btn { font-size: 13px; font-weight: 500; border-radius: 5px; --bs-btn-padding-y: .5rem; --bs-btn-padding-x: .8rem; }
.btn-sm { font-size: 12px; --bs-btn-padding-y: .4rem; --bs-btn-padding-x: .65rem; }
.btn-primary { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: #1c2b41; --bs-btn-hover-border-color: #1c2b41; --bs-btn-active-bg: #1c2b41; --bs-btn-active-border-color: #1c2b41; }
.btn-light-border { background: #fff; border: 1px solid #d5dbe3; color: #475569; }
.btn-light-border:hover { background: #f1f4f8; border-color: #aeb9c8; }
.btn-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); color: #506078; }
.btn-icon:hover { background: var(--surface); }
.btn-icon.disabled { opacity: .3; }
.form-control, .form-select { font-size: 13px; background-color: #fff; border-color: #ccd4df; color: var(--ink); padding: .55rem .65rem; border-radius: 5px; }
.form-control:focus, .form-select:focus { border-color: #7d98bf; box-shadow: 0 0 0 3px #4c7fb315; }
.form-label { font-size: 12px; font-weight: 500; color: #4c596d; margin-bottom: 5px; }
.form-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.required-mark { color: #9e4a3b; }
.invalid-feedback { font-size: 12px; }
.app-shell { display: flex; flex-direction: column; height: 100dvh; min-height: 400px; overflow: hidden; }
.app-header { height: 65px; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 650; letter-spacing: -.2px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand > i { color: #596d87; font-size: 21px; }
.mode-label { font-size: 10px; border: 1px solid #dbdfdf; color: #7c725d; background: #faf8f1; border-radius: 4px; padding: 3px 7px; cursor: help; }
.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.header-count { margin-right: 12px; font-size: 12px; color: var(--muted); }
.header-count strong { color: var(--ink); font-weight: 600; }
.btn-microsoft { display: flex; align-items: center; gap: 8px; border: 1px solid #d5dbe3; background: #fff; white-space: nowrap; }
.btn-microsoft:hover { background: #f3f5f8; border-color: #aeb9c8; }
.ms-logo { display: grid; grid-template-columns: repeat(2, 6px); gap: 2px; }
.ms-logo b { width: 6px; height: 6px; background: #f35325; }
.ms-logo b:nth-child(2) { background: #81bc06; }
.ms-logo b:nth-child(3) { background: #05a6f0; }
.ms-logo b:nth-child(4) { background: #ffba08; }
.btn-account { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.account-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e8edf3; color: #4d6280; font-size: 13px; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.dropdown-menu { font-size: 13px; border-color: var(--line); padding: 5px; box-shadow: 0 4px 14px #18294312; }
.dropdown-item { border-radius: 3px; padding: 8px 10px; }
.notice-area { flex-shrink: 0; max-height: 140px; overflow-y: auto; }
.notice-area .alert { margin: 0; border-radius: 0; border-width: 0 0 1px; padding: 10px 44px 10px 22px; font-size: 12px; line-height: 1.5; }
.notice-area .btn-close { font-size: 10px; padding: 13px 16px; }
.category-nav { display: flex; gap: 7px; padding: 0 20px; min-height: 49px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-chip { display: flex; align-items: center; gap: 7px; padding: 14px 12px 12px; border-bottom: 2px solid transparent; font-size: 12px; font-weight: 500; color: #677388; text-decoration: none; white-space: nowrap; }
.category-chip > span { color: #98a1ad; font-size: 11px; font-weight: 400; }
.category-chip:hover { background: #f6f8fb; color: var(--ink); }
.category-chip.active { color: #263e61; border-bottom-color: #3c5e88; }
.category-chip.active > span { color: #3c5e88; }
.mail-workspace { display: grid; grid-template-columns: 315px minmax(0, 1fr); flex: 1; min-height: 0; }
.inbox-panel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fbfcfd; }
.inbox-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 18px 15px; }
.inbox-heading h2 { font-size: 14px; font-weight: 600; margin: 0; }
.inbox-heading > span { font-size: 11px; color: #8893a1; }
.inbox-search { padding: 0 14px 12px; }
.search-input { position: relative; display: flex; align-items: center; }
.search-input > i { position: absolute; left: 10px; color: #8692a2; font-size: 13px; }
.search-input input { padding: 9px 31px; border-color: #dce1e8; font-size: 12px; background: #fff; }
.search-submit { position: absolute; right: 2px; padding: 6px 7px; color: #8a95a4; }
.search-input input::-webkit-search-cancel-button { cursor: pointer; }
.status-tabs { display: flex; gap: 4px; padding: 0 14px 12px; border-bottom: 1px solid var(--line); }
.status-tabs a { text-decoration: none; color: #707e91; font-size: 11px; padding: 5px 9px; border: 1px solid transparent; border-radius: 4px; }
.status-tabs a:hover { background: #edf1f6; }
.status-tabs a[aria-current] { border-color: #dce2ea; background: #fff; color: #293e5b; font-weight: 600; }
.inbox-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.email-row { display: block; padding: 16px 16px 15px; text-decoration: none; border-bottom: 1px solid #e9edf2; border-left: 3px solid transparent; color: var(--ink); }
.email-row:hover { background: #f0f4f9; }
.email-row.selected { background: #eaf0f8; border-left-color: #597aa5; }
.email-row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sender-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; }
.email-row-top time { color: #8390a1; font-size: 10px; white-space: nowrap; }
.email-subject { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.55; margin: 6px 0 10px; color: #526076; }
.email-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.category-tag { font-size: 11px; font-weight: 500; color: var(--tone, #707e91); }
.tone-apudacta { --tone: #606e9b; }
.tone-plazopruebas { --tone: #a66650; }
.tone-gescol { --tone: #4c8069; }
.tone-registro { --tone: #4e828a; }
.tone-minuta { --tone: #91753c; }
.tone-sentencia { --tone: #876994; }
.tone-desconocido { --tone: #7c8694; }
.row-indicators { display: flex; align-items: center; gap: 9px; color: #8a95a4; font-size: 11px; }
.email-row.reviewed .sender-name { font-weight: 450; color: #69788d; }
.email-row.reviewed .email-subject { color: #8995a5; }
.deadline-label { display: inline-flex; align-items: center; gap: 5px; color: #6b7c90; font-size: 10px; margin-top: 7px; }
.deadline-label.overdue { color: #b3684e; }
.inbox-bottom { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 10px; color: #8b96a4; min-height: 40px; }
.list-pagination { display: flex; align-items: center; gap: 12px; }
.list-pagination a { padding: 2px; color: #657994; }
.detail-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.reader-toolbar { display: flex; align-items: center; gap: 12px; height: 53px; padding: 0 24px; border-bottom: 1px solid #edf0f4; flex-shrink: 0; }
.category-form { display: flex; align-items: center; gap: 8px; }
.category-form .form-select { font-size: 11px; padding: 5px 28px 5px 9px; max-width: 200px; border-color: #e0e5ec; color: #63738a; }
.js .no-js-submit { display: none; }
.message-navigation { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.message-navigation > span:first-child { color: #7c899b; font-size: 11px; margin-right: 9px; }
.mobile-back { display: none; }
.message-header { padding: 23px 26px 22px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.message-header h1 { font-size: 21px; line-height: 1.45; font-weight: 600; letter-spacing: -.3px; margin: 0 0 14px; overflow-wrap: anywhere; }
.message-metadata { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #66768a; font-size: 12px; }
.message-metadata > span { overflow-wrap: anywhere; }
.message-metadata strong { font-weight: 500; color: #40516b; }
.sender-email { font-size: 11px; color: #8390a3; margin-left: 4px; }
.message-metadata time { flex-shrink: 0; color: #8d99a9; font-size: 11px; }
.reader-tabs { display: none; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 335px; flex: 1; min-height: 0; }
.message-content { padding: 24px 26px; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.attachment-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.attachment-row { display: flex; align-items: center; gap: 9px; border: 1px solid #dfe5ec; border-radius: 5px; padding: 9px 11px; color: #536b8b; text-decoration: none; max-width: 100%; min-width: 160px; }
.attachment-row:hover { background: #f3f6fa; border-color: #a6b9d1; }
.attachment-row > i:first-child { font-size: 21px; color: #8b6974; }
.attachment-row > span { min-width: 0; font-size: 11px; overflow-wrap: anywhere; }
.attachment-row small { display: block; font-size: 10px; color: #8b96a6; margin-top: 3px; }
.attachment-row > i:last-child { font-size: 10px; color: #99a7b9; margin-left: auto; }
.original-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.85; color: #485970; }
.message-info { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 32px; font-size: 12px; color: #718198; }
.message-info summary { cursor: pointer; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin: 20px 0 0; }
.data-grid dt { font-size: 11px; color: #8b96a6; font-weight: 400; margin-bottom: 4px; }
.data-grid dd { font-size: 12px; color: #526782; margin: 0; overflow-wrap: anywhere; }
.data-grid .full-width { grid-column: 1 / -1; }
.action-panel { background: #fafbfd; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.review-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.action-fields { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 21px 20px 24px; }
.action-fields > h2 { font-size: 13px; font-weight: 600; margin: 0 0 22px; color: #3b506d; }
.action-panel .form-control, .action-panel .form-select { background-color: #fff; font-size: 13px; }
.action-panel textarea { min-height: 110px; resize: vertical; }
.action-preview { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.action-fields > h2 + .action-preview { margin-top: 0; padding-top: 0; border: 0; }
.action-preview h3, .saved-draft h3 { font-size: 11px; font-weight: 600; color: #8290a3; margin-bottom: 14px; }
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.plan-list > li { font-size: 13px; color: #586c87; line-height: 1.5; padding-left: 16px; position: relative; overflow-wrap: anywhere; }
.plan-list > li:before { content: ""; position: absolute; width: 5px; height: 5px; border: 1px solid #9dafc3; border-radius: 50%; left: 0; top: 6px; }
.plan-list small { display: block; color: #8b98ab; font-size: 11px; line-height: 1.5; margin-top: 4px; }
.skip-notice { font-size: 12px; color: #8b6f4e; margin: 0; }
.deadline-note { font-size: 11px; }
.deadline-note.overdue { color: #a85b45; }
.action-footer { padding: 14px 16px; border-top: 1px solid var(--line); background: #fafbfd; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.action-footer .btn { font-size: 12px; padding: 9px 10px; }
.save-draft { width: 100%; }
.simulate-group { width: 100%; }
.simulate-group > .btn:first-child { flex: 1; }
.simulate-group > .dropdown-toggle-split { flex: 0; padding-right: 10px; padding-left: 10px; border-left-color: #5a6d86; }
.action-footer .dropdown-menu { font-size: 12px; }
.review-complete { padding: 24px 20px; overflow-y: auto; }
.review-complete-heading { display: flex; gap: 11px; align-items: center; margin-bottom: 25px; }
.review-complete-heading > i { font-size: 22px; }
.review-complete h2 { font-size: 14px; margin: 0 0 5px; }
.review-complete time { font-size: 11px; color: #93a0b1; }
.review-complete > form { margin-top: 24px; }
.saved-draft { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 20px; }
.saved-draft p { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.empty-list, .detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 17px; text-align: center; color: #8e9bb0; padding: 50px 20px; }
.empty-list > i, .detail-empty > i { font-size: 27px; color: #b3bfce; }
.empty-list h3, .detail-empty h1 { font-size: 14px; font-weight: 450; margin: 0; }
.detail-empty { height: 100%; }
.modal-content { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 50px #172d4a20; overflow: hidden; }
.modal-header, .modal-footer { padding: 16px 20px; }
.modal-title { font-weight: 550; }
.modal-body { padding: 20px; }
.pdf-frame { display: block; width: 100%; height: 75vh; border: 0; background: #eef0f4; }
.pdf-modal .modal-content { border: 0; border-radius: 0; box-shadow: none; }
.pdf-modal .modal-dialog { margin: 0; width: 100vw; max-width: none; height: 100%; }
.pdf-modal .modal-header { min-height: 56px; padding: 10px 16px; gap: 12px; flex-wrap: nowrap; }
.pdf-modal .modal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pdf-modal .modal-header .btn { white-space: nowrap; flex-shrink: 0; }
.pdf-modal .modal-body { flex: 1; min-height: 0; }
.pdf-modal .pdf-frame { height: 100%; }
.empty-import { display: none; }
.skip-link { position: absolute; z-index: 2000; background: var(--navy); color: #fff; padding: 12px; }

@media (min-width: 1650px) {
    .mail-workspace { grid-template-columns: 350px minmax(0, 1fr); }
    .reader-layout { grid-template-columns: minmax(0, 1fr) 370px; }
    .message-header, .message-content { padding-left: 34px; padding-right: 34px; }
    .action-fields { padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 1199px) {
    .reader-layout { display: block; position: relative; }
    .reader-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); padding: 0 24px; flex-shrink: 0; }
    .reader-tabs button { padding: 11px 2px; color: #8491a3; font-size: 12px; background: none; border: 0; border-bottom: 2px solid transparent; }
    .reader-tabs button[aria-pressed="true"] { color: var(--navy); border-bottom-color: #48688f; font-weight: 600; }
    .reader-tabs button > span { margin-left: 5px; color: #9ba7b5; font-size: 10px; }
    .message-content { height: 100%; }
    .action-panel { height: 100%; border-left: 0; }
    .action-fields > .row, .action-preview { max-width: 540px; margin-left: auto; margin-right: auto; }
    .action-fields > h2 { display: none; }
    .action-fields > .row { margin-top: -1rem; }
    .action-footer { flex-direction: row; justify-content: flex-end; padding: 14px 22px; }
    .action-footer .save-draft, .action-footer .simulate-group { width: auto; }
    .reader-layout[data-reader-view="mail"] .action-panel { display: none; }
    .reader-layout[data-reader-view="action"] .message-content { display: none; }
    .message-metadata { display: block; }
    .message-metadata time { display: block; margin-top: 7px; }
    .account-name { display: none; }
}

@media (max-width: 767px) {
    .app-header { height: 57px; padding: 0 12px; gap: 9px; }
    .brand { font-size: 14px; gap: 7px; }
    .brand > i { font-size: 18px; }
    .brand-suffix, .header-count, .import-label, .sync-label, .microsoft-label { display: none; }
    .mode-label { font-size: 9px; padding: 2px 5px; }
    .header-actions { gap: 7px; }
    .header-actions .btn { font-size: 11px; padding: 7px 8px; }
    .btn-microsoft { gap: 6px; }
    .category-nav { padding: 0 8px; min-height: 44px; gap: 0; }
    .category-chip { font-size: 12px; padding: 12px 10px 10px; }
    .mail-workspace { display: flex; flex-direction: column; }
    .inbox-panel { border: 0; flex: 1; }
    .empty-import { display: inline-block; }
    .inbox-heading { padding: 19px 19px 15px; }
    .inbox-search { padding: 0 15px 12px; }
    .search-input input { font-size: 16px; padding-top: 10px; padding-bottom: 10px; }
    .status-tabs { padding-left: 15px; padding-bottom: 12px; }
    .status-tabs a { font-size: 12px; padding: 6px 10px; }
    .email-row { padding: 17px 17px 15px; }
    .sender-name { font-size: 14px; }
    .email-row-top time { font-size: 11px; }
    .email-subject { font-size: 13px; }
    .category-tag { font-size: 11px; }
    .inbox-bottom { min-height: 38px; }
    .app-shell[data-mobile-view="inbox"] .detail-panel { display: none; }
    .app-shell[data-mobile-view="message"] .inbox-panel, .app-shell[data-mobile-view="message"] > .category-nav { display: none; }
    .detail-panel { flex: 1; }
    .reader-toolbar { height: 49px; padding: 0 12px; gap: 9px; }
    .mobile-back { display: inline-flex; align-items: center; gap: 5px; padding: 6px 3px; color: #566c8b; font-size: 12px; }
    .category-form .form-select { font-size: 10px; max-width: 135px; padding-left: 7px; }
    .message-navigation { gap: 4px; }
    .message-navigation > span:first-child { display: none; }
    .message-navigation .btn-icon { width: 29px; height: 29px; }
    .message-header { padding: 17px 17px 15px; max-height: 230px; overflow-y: auto; }
    .message-header h1 { font-size: 17px; line-height: 1.45; margin-bottom: 12px; letter-spacing: -.2px; }
    .message-metadata { font-size: 12px; }
    .sender-email { font-size: 10px; }
    .message-metadata time { font-size: 10px; }
    .reader-tabs { padding: 0 17px; }
    .reader-tabs button { font-size: 13px; }
    .message-content { padding: 20px 17px; }
    .original-body { font-size: 14px; }
    .attachment-list { margin-bottom: 22px; }
    .attachment-row { width: 100%; }
    .attachment-row > span { font-size: 12px; }
    .action-fields { padding: 22px 17px; }
    .action-panel .form-control, .action-panel .form-select { font-size: 16px; }
    .form-label { font-size: 12px; }
    .action-footer { padding: 12px; gap: 8px; }
    .action-footer .btn { font-size: 11px; padding: 11px 9px; white-space: nowrap; }
    .action-footer .simulate-group { flex: 1; }
    .review-complete { padding: 23px 19px; }
    .notice-area .alert { padding-left: 14px; font-size: 11px; }
    .modal-dialog { margin: 10px; }
    .pdf-frame { height: 70dvh; }
    .modal-header { padding: 13px 16px; }
    .modal-footer { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
