:root {
    --bg: #f3f1ed;
    --surface: #ffffff;
    --surface-soft: #f8f7f4;
    --ink: #171612;
    --muted: #77736b;
    --line: #e3dfd7;
    --gold: #b18a45;
    --gold-dark: #89672d;
    --black: #11110f;
    --success: #237a57;
    --danger: #a33a37;
    --shadow: 0 18px 50px rgba(30, 27, 20, .07);
    --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { background: #eeeae2; padding: 2px 6px; border-radius: 5px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px; background: var(--black); color: #fff; display: flex; flex-direction: column; z-index: 30; }
.brand, .auth-brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 42px; height: 42px; border: 1px solid rgba(211,175,104,.7); display: grid; place-items: center; color: #d7b36e; font-family: Georgia, serif; font-size: 23px; }
.brand-mark.large { width: 58px; height: 58px; font-size: 31px; }
.brand strong, .auth-brand strong { display: block; letter-spacing: .24em; font-family: Georgia, serif; font-size: 18px; }
.brand small, .auth-brand small { display: block; margin-top: 3px; color: #aaa69d; font-size: 11px; letter-spacing: .08em; }
.nav-menu { display: grid; gap: 8px; margin-top: 48px; }
.nav-menu a { padding: 13px 14px; display: flex; align-items: center; gap: 12px; border-radius: 10px; color: #aaa69e; transition: .2s ease; }
.nav-menu a:hover, .nav-menu a.active { color: #fff; background: rgba(255,255,255,.07); }
.nav-menu a.active { box-shadow: inset 3px 0 #c39a51; }
.sidebar-user { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #c29a55; color: #111; font-weight: 800; }
.sidebar-user strong { display: block; font-size: 13px; }
.sidebar-user small { color: #8f8b83; font-size: 11px; }
.logout-link { color: #bdb8ae; font-size: 20px; }
.main-content { min-width: 0; }
.topbar { min-height: 112px; padding: 25px 42px; display: flex; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); background: rgba(243,241,237,.88); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(26px, 3vw, 36px); margin: 4px 0 0; }
.eyebrow { color: var(--gold-dark); text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 800; }
.topbar-action { margin-left: auto; }
.menu-button { display: none; border: 0; background: transparent; font-size: 24px; }
.page-body { padding: 34px 42px 48px; }
.footer { padding: 20px 42px 35px; color: var(--muted); font-size: 12px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 750; font-size: 13px; transition: .2s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--black); color: #fff; border-color: var(--black); }
.button-primary:hover { background: #27251f; }
.button-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.button-block { width: 100%; }
.button-small { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.text-link { color: var(--gold-dark); font-weight: 750; font-size: 13px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.card-header h2 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; min-height: 145px; padding: 22px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; right: -25px; bottom: -35px; width: 100px; height: 100px; border: 1px solid #e5d8c1; transform: rotate(45deg); }
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 10px 0 6px; font-family: Georgia, serif; font-size: 38px; font-weight: 500; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 22px; align-items: start; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 790px; }
th { padding: 0 14px 12px; border-bottom: 1px solid var(--line); text-align: left; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 15px 14px; border-bottom: 1px solid #eeeae3; vertical-align: middle; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfaf7; }
td strong, td span, td small { display: block; }
td small { color: var(--muted); margin-top: 4px; font-size: 11px; }
.case-code { color: var(--gold-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 800; }
.status-pill { display: inline-flex; width: fit-content; max-width: 240px; padding: 6px 9px; border-radius: 999px; background: #f1ece2; color: #725623; font-size: 11px; font-weight: 750; }
.status-pill.inactive { background: #f0e4e3; color: var(--danger); }
.status-pill.prominent { font-size: 12px; padding: 8px 12px; }
.empty-cell { text-align: center; color: var(--muted); padding: 40px; }
.bar-list { display: grid; gap: 17px; }
.bar-item > div:first-child { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; }
.bar-item strong { color: var(--gold-dark); }
.bar-track { height: 6px; background: #eeeae2; border-radius: 999px; overflow: hidden; margin-top: 7px; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8a672d, #d6b577); }
.alert { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin: 18px 42px 0; padding: 13px 16px; border-radius: 10px; font-size: 13px; border: 1px solid; }
.page-body > .alert { margin: 0 0 18px; }
.alert button { border: 0; background: transparent; font-size: 18px; }
.alert-success { background: #eaf5ef; border-color: #badbca; color: #1d6748; }
.alert-error { background: #f9eceb; border-color: #e4bfbc; color: #8e302d; }
.alert ul { margin: 7px 0 0 18px; padding: 0; }
label { display: grid; grid-auto-rows: max-content; align-content: start; align-self: start; gap: 7px; min-width: 0; font-size: 12px; font-weight: 700; }
label > span, .label-mini { color: #625e56; font-size: 11px; letter-spacing: .02em; }
label > small { display: block; margin: 0; color: #625e56; font-size: 10px; font-weight: 650; line-height: 1.35; }
input, select, textarea { width: 100%; border: 1px solid #d9d5cd; background: #fff; border-radius: 9px; color: var(--ink); padding: 11px 12px; outline: none; transition: .2s ease; }
input, select { height: 44px; min-height: 44px; max-height: 44px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #b18a45; box-shadow: 0 0 0 3px rgba(177,138,69,.12); }
.filters-card { margin-bottom: 22px; }
.filters-grid { display: grid; grid-template-columns: 1.5fr repeat(3, minmax(140px, .75fr)) repeat(2, minmax(130px, .65fr)); gap: 14px; align-items: end; }
.filter-actions { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }
.form-layout { display: grid; gap: 22px; }
.form-card { padding: 28px; }
.form-grid { display: grid; gap: 18px; align-items: start; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions.compact { margin-top: 15px; }
.narrow-form { max-width: 780px; }
.password-field { position: relative; min-height: 44px; }
.password-field input { height: 44px; min-height: 44px; max-height: 44px; padding-right: 72px; }
.password-field button { position: absolute; right: 7px; top: 7px; bottom: 7px; border: 0; background: #f0ede7; border-radius: 7px; padding: 0 10px; font-size: 11px; }
.case-hero { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-bottom: 22px; background: linear-gradient(125deg, #11110f, #2a2721); color: #fff; border-color: #2e2b25; }
.case-hero h2 { margin: 9px 0 5px; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.case-hero p { margin: 0; color: #bdb7ac; font-size: 13px; }
.large-code { font-size: 12px; color: #d4ae69; }
.case-hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.case-hero .button-ghost { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.18); }
.case-hero .button-primary { background: #d0aa67; color: #17130d; border-color: #d0aa67; }
.case-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .75fr); gap: 22px; align-items: start; }
.case-main, .case-side { display: grid; gap: 22px; }
.status-form { display: grid; gap: 15px; }
.timeline { position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 7px; bottom: 12px; width: 1px; background: #ded9cf; }
.timeline-item { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 16px; padding-bottom: 25px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { width: 13px; height: 13px; border-radius: 50%; background: #c9a35f; border: 3px solid #fff; box-shadow: 0 0 0 1px #c9a35f; z-index: 1; }
.timeline-content > div { display: flex; justify-content: space-between; gap: 15px; }
.timeline-content strong { font-size: 13px; }
.timeline-content time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.timeline-content p { margin: 7px 0; color: #57534c; line-height: 1.55; font-size: 13px; }
.timeline-content small { color: var(--muted); }
.details-list { display: grid; margin: 0; }
.details-list div { padding: 12px 0; border-bottom: 1px solid #eeeae3; }
.details-list div:first-child { padding-top: 0; }
.details-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.details-list dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.details-list dd { margin: 4px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.details-card form { display: grid; gap: 13px; }
.prose { color: #555149; font-size: 13px; line-height: 1.7; }
.details-card hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); font-size: 12px; }
.table-actions { display: flex; gap: 7px; }
.table-actions form { margin: 0; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: #fff; }
.auth-panel { min-height: 100vh; padding: 55px; background: linear-gradient(rgba(13,13,11,.84), rgba(13,13,11,.92)), radial-gradient(circle at 20% 20%, #765b2f, #171612 55%); color: #fff; display: flex; flex-direction: column; justify-content: space-between; }
.auth-copy { max-width: 600px; margin: auto 0 9vh; }
.auth-copy h1 { margin: 12px 0 18px; max-width: 650px; font-family: Georgia, serif; font-weight: 500; font-size: clamp(40px, 5vw, 72px); line-height: 1.02; }
.auth-copy p { max-width: 500px; color: #bdb7ac; line-height: 1.7; }
.auth-form-wrap { display: grid; place-items: center; padding: 38px; }
.auth-form { width: min(430px, 100%); display: grid; gap: 18px; }
.auth-form h2 { margin: 4px 0 -8px; font-family: Georgia, serif; font-size: 36px; font-weight: 500; }
.auth-form > p { color: var(--muted); margin: 0 0 8px; }
.auth-form .alert { margin: 0; }
.install-page { min-height: 100vh; padding: 40px 20px; background: linear-gradient(135deg, #11110f, #28241e); }
.install-container { width: min(780px, 100%); margin: 0 auto; }
.install-container .auth-brand { color: #fff; margin-bottom: 25px; }
.install-card { padding: 36px; }
.install-card h1 { margin: 8px 0 12px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.install-card > p { color: var(--muted); line-height: 1.65; }
.install-card .alert { margin: 18px 0; }
.install-form { display: grid; gap: 20px; margin-top: 28px; }
.install-form h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; }
.security-note { margin-top: 20px; font-size: 12px; color: var(--danger) !important; }
@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .case-layout { grid-template-columns: 1fr; }
    .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .25s ease; width: min(300px, 86vw); }
    .sidebar.open { transform: translateX(0); }
    .menu-button { display: block; }
    .topbar { min-height: 90px; padding: 18px 20px; }
    .topbar-action { display: none; }
    .page-body { padding: 22px 16px 35px; }
    .footer { padding: 18px 16px 30px; }
    .alert { margin: 15px 16px 0; }
    .stats-grid { gap: 12px; }
    .card { padding: 19px; border-radius: 14px; }
    .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .case-hero { align-items: flex-start; flex-direction: column; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-panel { display: none; }
    .auth-form-wrap { min-height: 100vh; padding: 24px; }
}
@media (max-width: 560px) {
    .stats-grid, .form-grid.two-columns, .filters-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 125px; }
    .card-header { align-items: flex-start; flex-direction: column; }
    .filter-actions, .form-actions { display: grid; grid-template-columns: 1fr; }
    .case-hero-actions { width: 100%; }
    .case-hero-actions .button { flex: 1; }
    .timeline-content > div { display: grid; }
    .install-card { padding: 24px 19px; }
}

/* Navegación móvil y portal de clientes */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-close { display: none; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.16); border-radius: 9px; background: rgba(255,255,255,.06); color: #fff; font-size: 25px; line-height: 1; }
.menu-overlay { display: none; position: fixed; inset: 0; background: rgba(8,8,7,.58); backdrop-filter: blur(2px); z-index: 29; }

.public-page { min-height: 100vh; background: var(--bg); }
.public-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px clamp(20px, 5vw, 68px); background: var(--black); color: #fff; }
.public-header .brand { color: #fff; }
.public-header-actions { display: flex; align-items: center; gap: 10px; }
.public-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 60px; }
.portal-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 28px; align-items: stretch; }
.portal-intro { padding: clamp(28px, 5vw, 56px); border-radius: 22px; color: #fff; background: linear-gradient(135deg, #11110f, #2c2821); box-shadow: var(--shadow); }
.portal-intro h1 { max-width: 700px; margin: 12px 0 18px; font-family: Georgia, serif; font-weight: 500; font-size: clamp(38px, 6vw, 68px); line-height: 1.02; }
.portal-intro p { max-width: 640px; color: #c7c1b6; line-height: 1.75; }
.portal-contact-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.portal-search-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 4vw, 38px); }
.portal-search-card h2 { margin: 7px 0 8px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.portal-search-card > p { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.portal-search-form { display: grid; gap: 16px; }
.portal-results { display: grid; gap: 20px; margin-top: 28px; }
.portal-results-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.portal-results-head h2 { margin: 6px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.client-case-card { overflow: hidden; padding: 0; }
.client-case-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px; color: #fff; background: linear-gradient(120deg, #151410, #302b23); }
.client-case-head h3 { margin: 8px 0 5px; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.client-case-head p { margin: 0; color: #bbb4a8; font-size: 13px; }
.client-case-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .65fr); gap: 24px; padding: 24px; }
.client-status-box { padding: 20px; border: 1px solid #e7dfd2; border-radius: 14px; background: #faf7f1; }
.client-status-box .status-pill { margin-top: 9px; }
.client-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.client-detail { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.client-detail span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.client-detail strong { display: block; margin-top: 6px; font-size: 13px; overflow-wrap: anywhere; }
.client-timeline { display: grid; gap: 13px; }
.client-update { padding-left: 15px; border-left: 2px solid #c7a25f; }
.client-update strong, .client-update time { display: block; }
.client-update strong { font-size: 13px; }
.client-update time { margin-top: 4px; color: var(--muted); font-size: 10px; }
.client-update p { margin: 7px 0 0; color: #5b574f; font-size: 12px; line-height: 1.55; }
.portal-empty { text-align: center; padding: 34px; }
.portal-empty h2 { margin: 8px 0; font-family: Georgia, serif; font-weight: 500; }
.portal-empty p { color: var(--muted); line-height: 1.6; }
.public-footer { padding: 22px 20px 35px; text-align: center; color: var(--muted); font-size: 12px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.checkbox-row input { width: 18px; height: 18px; min-height: 18px; max-height: 18px; margin-top: 1px; }
.checkbox-row span { color: #5f5b54; line-height: 1.45; }

@media (max-width: 850px) {
    body.menu-open { overflow: hidden; }
    body.menu-open .menu-overlay { display: block; }
    .sidebar-close { display: grid; place-items: center; flex: 0 0 auto; }
    .sidebar { overflow-y: auto; }
    .portal-hero, .client-case-body { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .table-wrap { overflow: visible; }
    table { min-width: 0; display: block; }
    table thead { display: none; }
    table tbody { display: grid; gap: 13px; }
    table tr { display: grid; padding: 8px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 8px 24px rgba(30,27,20,.04); }
    table td { display: grid; grid-template-columns: minmax(95px, .42fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eeeae3; overflow-wrap: anywhere; }
    table td:last-child { border-bottom: 0; }
    table td::before { content: attr(data-label); color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    table td .icon-button { justify-self: end; }
    table td .table-actions { justify-content: flex-end; flex-wrap: wrap; }
    table tr:hover { background: #fff; }
    table .empty-cell { display: block; padding: 26px 8px; }
    table .empty-cell::before { display: none; }
    .public-header { align-items: flex-start; }
    .public-header-actions { display: grid; }
    .client-case-head, .portal-results-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
    .topbar h1 { font-size: 24px; }
    .menu-button { flex: 0 0 auto; }
    .sidebar { width: min(320px, 90vw); }
    .public-header { padding: 16px; }
    .public-header .brand small { display: none; }
    .public-header-actions .button { min-height: 36px; padding: 8px 10px; font-size: 11px; }
    .public-shell { width: min(100% - 24px, 1120px); padding-top: 24px; }
    .portal-intro, .portal-search-card { border-radius: 16px; }
    .portal-contact-row, .client-case-head .case-hero-actions { display: grid; width: 100%; }
    .client-details-grid { grid-template-columns: 1fr; }
    .client-case-head, .client-case-body { padding: 19px; }
    table td { grid-template-columns: 88px minmax(0, 1fr); }
}

body { overflow-x: hidden; }
.app-shell, .main-content, .page-body, .card, .dashboard-grid, .case-layout { min-width: 0; max-width: 100%; }

/* v4: plazos de seguimiento + flujo Procurador */
.alert-info { background: #eef4f8; border-color: #c8dbe7; color: #315b70; }
.alert-warning { background: #fff6e6; border-color: #ead2a6; color: #7a571c; }
.button-danger { color: var(--danger); border-color: #dfbfbd; background: #fffafa; }
.button-danger:hover { background: #f9eceb; }
.status-pill.pending { background: #fff3d9; color: #845f17; }

.followup-text { display: block; margin-top: 4px; font-size: 10px; font-weight: 750; }
.followup-text.none, .followup-text.future { color: var(--muted); }
.followup-text.soon, .followup-text.today { color: #9a6810; }
.followup-text.overdue { color: var(--danger); }
.followup-badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.followup-badge.none, .followup-badge.future { background: #efede8; color: #716d65; }
.followup-badge.soon, .followup-badge.today { background: #fff0cc; color: #8a5e0b; }
.followup-badge.overdue { background: #f8e4e2; color: var(--danger); }
.followup-current { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; margin: -5px 0 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.followup-current strong { display: block; margin-top: 4px; font-size: 15px; }
.followup-current.followup-overdue { border-color: #e0b7b3; background: #fff8f7; }
.followup-current.followup-soon, .followup-current.followup-today { border-color: #e8d0a3; background: #fffbf2; }
.followup-clear { align-self: end; min-height: 44px; padding: 11px 0; }
.timeline-followup { display: inline-block; margin: 8px 0 3px; padding: 5px 8px; border-radius: 7px; background: #f3eee4; color: #745b2d; font-size: 10px; font-weight: 750; }

.deadline-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
.deadline-card { min-width: 0; }
.deadline-card-overdue { border-top: 3px solid #a33a37; }
.deadline-card-soon { border-top: 3px solid #c69231; }
.deadline-count { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-family: Georgia, serif; font-size: 21px; }
.deadline-count.danger { background: #f7e5e3; color: #8e302d; }
.deadline-count.warning { background: #fff0cf; color: #8a5e0b; }
.deadline-list { display: grid; gap: 2px; }
.deadline-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 13px 0; border-bottom: 1px solid #eeeae3; }
.deadline-item:last-child { border-bottom: 0; }
.deadline-item > div:first-child { min-width: 0; }
.deadline-item strong { display: block; margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.deadline-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.deadline-date { text-align: right; }
.deadline-date strong { margin: 0 0 5px; white-space: nowrap; }
.dashboard-approval-alert { margin: 0 0 22px; align-items: center; }

.filters-grid-wide { grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(135px, .75fr)) repeat(2, minmax(130px, .65fr)); }

.approvals-intro { margin-bottom: 22px; }
.approval-list { display: grid; gap: 18px; margin-bottom: 22px; }
.approval-card { padding: 0; overflow: hidden; }
.approval-card-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 22px 24px; background: #faf8f3; border-bottom: 1px solid var(--line); }
.approval-card-head h2 { margin: 6px 0; font-family: Georgia, serif; font-weight: 500; font-size: 21px; }
.approval-card-head p { margin: 0; color: var(--muted); font-size: 11px; }
.request-type { color: var(--gold-dark); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 850; }
.request-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.request-preview > div { min-width: 0; padding: 15px 18px; background: #fff; }
.request-preview > div.full { grid-column: 1 / -1; }
.request-preview span { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 9px; font-weight: 800; }
.request-preview strong { display: block; margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.request-preview p { margin: 6px 0 0; color: #565149; font-size: 12px; line-height: 1.5; }
.approval-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; padding: 18px 24px 22px; }
.approval-actions .form-actions { min-width: 245px; }
.approval-history { margin-top: 22px; }

@media (max-width: 1180px) {
    .filters-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filters-grid-wide .field-search { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .deadline-summary { grid-template-columns: 1fr; }
    .approval-actions { grid-template-columns: 1fr; }
    .approval-actions .form-actions { min-width: 0; }
}

@media (max-width: 700px) {
    .filters-grid-wide { grid-template-columns: 1fr; }
    .filters-grid-wide .field-search { grid-column: auto; }
    .deadline-item { grid-template-columns: 1fr; gap: 8px; }
    .deadline-date { text-align: left; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .deadline-date strong { margin: 0; }
    .approval-card-head { flex-direction: column; }
    .request-preview { grid-template-columns: 1fr; }
    .request-preview > div.full { grid-column: auto; }
    .approval-actions .form-actions { flex-direction: column-reverse; }
    .approval-actions .button { width: 100%; }
    .followup-current { align-items: flex-start; flex-direction: column; }
}

/* v5: materias libres, bitácora editable y filtros estables */
[hidden] { display: none !important; }
.inline-form { margin: 0; }
.custom-service-check { padding: 12px 14px; border: 1px dashed #d5c6a9; border-radius: 10px; background: #fbf8f1; }
.custom-service-check span { color: #514936; }
select:disabled, input:disabled { background: #f0eee9; color: #7a766e; cursor: not-allowed; }

.followup-current-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.timeline-entry-head { display: flex !important; justify-content: space-between; align-items: flex-start; gap: 14px; }
.timeline-entry-head > div:first-child { min-width: 0; }
.timeline-entry-head > div:first-child strong,
.timeline-entry-head > div:first-child time { display: block; }
.timeline-actions { display: flex !important; align-items: center; justify-content: flex-end; gap: 7px; flex: 0 0 auto; }
.timeline-edit-form { display: grid; gap: 11px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #faf9f6; }
.timeline-edit-form .form-actions { margin-top: 0; }

/* Mantiene el orden visual de los filtros en todos los anchos. */
.filters-grid-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.filters-grid-wide .field-search { grid-column: span 2; }
.filters-grid-wide > label,
.filters-grid-wide .filter-actions { min-width: 0; }

@media (max-width: 1180px) {
    .filters-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters-grid-wide .field-search { grid-column: span 2; }
}

@media (max-width: 700px) {
    .filters-grid-wide { grid-template-columns: 1fr; }
    .filters-grid-wide .field-search { grid-column: auto; }
    .filters-grid-wide .filter-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .timeline-entry-head { display: grid !important; }
    .timeline-actions { justify-content: flex-start; flex-wrap: wrap; }
    .followup-current-actions { justify-content: flex-start; }
}


/* v7 · campos sensibles dentro de la ficha */
.secret-display { max-width: 360px; }
.secret-display input[readonly] { background: #fbfaf7; color: var(--text); cursor: default; }
.compact-note { display: block; margin-top: 6px; font-size: 10px; line-height: 1.35; }
