:root {
    --municipal-green: #153e35;
    --municipal-green-deep: #102f29;
    --municipal-green-soft: #e8f0ed;
    --municipal-gold: #d3a54b;
    --ink: #1d2b27;
    --muted: #71807a;
    --line: #e6ebe8;
    --surface: #fff;
    --canvas: #f4f7f5;
    --sidebar-width: 264px;
}

* { box-sizing: border-box; }

body {
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a { color: var(--municipal-green); }

.btn-primary {
    --bs-btn-bg: var(--municipal-green);
    --bs-btn-border-color: var(--municipal-green);
    --bs-btn-hover-bg: var(--municipal-green-deep);
    --bs-btn-hover-border-color: var(--municipal-green-deep);
    --bs-btn-active-bg: var(--municipal-green-deep);
    --bs-btn-active-border-color: var(--municipal-green-deep);
    --bs-btn-focus-shadow-rgb: 21, 62, 53;
}

.form-control:focus,
.form-select:focus {
    border-color: #7eaa9b;
    box-shadow: 0 0 0 .2rem rgba(21, 62, 53, .12);
}

.app-body { min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
    background: var(--municipal-green);
    color: rgba(255,255,255,.82);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    left: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    padding: 1.25rem 1rem 1rem;
    position: fixed;
    top: 0;
    width: var(--sidebar-width);
    z-index: 1040;
}

.brand-lockup {
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.12);
    color: #fff;
    display: flex;
    gap: .75rem;
    margin: 0 -.15rem 1.55rem;
    padding: .3rem .4rem 1.35rem;
    text-decoration: none;
}

.brand-name { font-size: 1rem; font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
.brand-name small { color: rgba(255,255,255,.62); display: block; font-size: .73rem; font-weight: 400; margin-top: .2rem; }

.sidebar-section-label {
    color: rgba(255,255,255,.48);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .12em;
    padding: 0 .8rem .55rem;
    text-transform: uppercase;
}

.sidebar-section-spaced { padding-top: 1.65rem; }
.sidebar-nav {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: .25rem;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar-link {
    align-items: center;
    border-radius: .65rem;
    color: rgba(255,255,255,.75);
    display: flex;
    font-size: .9rem;
    gap: .8rem;
    min-height: 43px;
    padding: .65rem .8rem;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.sidebar-link i { font-size: 1.05rem; width: 1.15rem; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.sidebar-link.active::before { background: var(--municipal-gold); border-radius: 2px; content: ""; height: 22px; margin-left: -.8rem; margin-right: calc(.8rem - 3px); width: 3px; }

.sidebar-footer {
    align-items: center;
    border-top: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.82);
    display: flex;
    flex: 0 0 auto;
    font-size: .78rem;
    gap: .7rem;
    margin-top: auto;
    padding: 1rem .35rem .2rem;
}

.sidebar-footer-mark { align-items: center; background: rgba(255,255,255,.1); border-radius: .55rem; color: #f0d99f; display: inline-flex; height: 34px; justify-content: center; width: 34px; }
.sidebar-footer small { color: rgba(255,255,255,.5); display: block; font-size: .68rem; margin-top: .12rem; }

.app-main { display: flex; flex-direction: column; margin-left: var(--sidebar-width); min-height: 100vh; min-height: 100dvh; }
.app-topbar { align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; min-height: 76px; padding: .75rem 2rem; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-eyebrow { color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.topbar-system-name { color: var(--ink); font-size: .9rem; font-weight: 600; margin-top: .2rem; }
.topbar-user { align-items: center; display: flex; gap: 1rem; margin-left: auto; }
.notification-widget { position: relative; }
.notification-trigger { color: var(--municipal-green); font-size: 1.15rem; position: relative; }
.notification-badge { align-items: center; background: #b93b35; border: 2px solid var(--surface); border-radius: 999px; color: #fff; display: inline-flex; font-size: .62rem; font-weight: 700; height: 19px; justify-content: center; min-width: 19px; padding: 0 .25rem; position: absolute; right: -5px; top: -5px; }
.notification-panel { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 16px 42px rgba(19,45,38,.16); max-height: min(74vh, 560px); overflow-y: auto; padding: .8rem; position: absolute; right: 0; top: calc(100% + .65rem); width: min(390px, calc(100vw - 2rem)); z-index: 20; }
.notification-panel[hidden] { display: none; }
.notification-panel-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: .65rem; }
.notification-panel-heading strong { color: var(--ink); font-size: .9rem; }
.notification-sound-toggle { align-items: center; background: var(--municipal-green-soft); border: 1px solid transparent; border-radius: .55rem; color: var(--municipal-green); display: inline-flex; font-size: .75rem; gap: .4rem; padding: .42rem .6rem; }
.notification-sound-toggle:hover { border-color: #b8d2c7; }
.notification-sound-status { color: var(--muted); font-size: .68rem; margin: .35rem 0 .6rem; }
.notification-recent-list { list-style: none; margin: 0; padding: 0; }
.notification-item { border-top: 1px solid var(--line); padding: .7rem .25rem; }
.notification-item.is-unread { background: #f5faf7; }
.notification-message { color: var(--ink); display: block; font-size: .78rem; line-height: 1.4; text-decoration: none; }
.notification-message:hover { color: var(--municipal-green); }
.notification-meta { color: var(--muted); display: block; font-size: .66rem; margin-top: .3rem; }
.notification-text-button { background: transparent; border: 0; color: var(--municipal-green); cursor: pointer; font-size: .68rem; padding: .25rem 0 0; }
.notification-empty { color: var(--muted); font-size: .76rem; padding: .9rem .25rem; }
.notification-history-link { border-top: 1px solid var(--line); color: var(--municipal-green); display: block; font-size: .76rem; font-weight: 600; margin-top: .2rem; padding: .75rem .25rem .1rem; text-decoration: none; }
.notification-history-link:hover { color: var(--ink); }
.notification-history { padding: .25rem 1.1rem; }
.notification-history-item { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; padding: 1rem 0; }
.notification-history-item:last-child { border-bottom: 0; }
.notification-history-item.is-unread { border-left: 3px solid var(--municipal-green); padding-left: .75rem; }
.notification-history-copy { min-width: 0; }
.notification-history-copy strong { color: var(--municipal-green); font-size: .75rem; }
.notification-history-copy p { color: var(--ink); font-size: .86rem; margin-top: .25rem; }
.notification-history-actions { align-items: flex-end; display: flex; flex: 0 0 auto; flex-direction: column; gap: .45rem; }
.user-summary { align-items: center; display: flex; gap: .65rem; }
.user-avatar, .table-user-avatar { align-items: center; background: var(--municipal-green-soft); border-radius: 50%; color: var(--municipal-green); display: inline-flex; flex: 0 0 auto; font-size: .86rem; font-weight: 700; height: 38px; justify-content: center; width: 38px; }
.user-summary-text { display: flex; flex-direction: column; line-height: 1.25; max-width: 230px; }
.user-summary-text strong { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-summary-text small { color: var(--muted); font-size: .68rem; margin-top: .18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-logout { align-items: center; display: inline-flex; gap: .4rem; }
.btn-outline-secondary { --bs-btn-color: #53625c; --bs-btn-border-color: #d6dfda; --bs-btn-hover-bg: #edf2ef; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #c5d0ca; }
.btn-icon { align-items: center; display: inline-flex; height: 36px; justify-content: center; padding: 0; width: 36px; }
.sidebar-toggle { border: 0; color: var(--municipal-green); display: none; font-size: 1.45rem; margin-right: .65rem; }

.app-content { flex: 1; margin: 0 auto; max-width: 1540px; padding: 1.55rem 2rem 2rem; width: 100%; }
.breadcrumb-shell { margin-bottom: 1rem; }
.breadcrumb { font-size: .76rem; }
.breadcrumb-item + .breadcrumb-item::before { color: #a4b0aa; }
.breadcrumb-item a { color: #71807a; text-decoration: none; }
.breadcrumb-item a:hover { color: var(--municipal-green); }
.breadcrumb-item.active { color: #46564f; }
.app-alert { border: 0; border-radius: .7rem; box-shadow: 0 4px 12px rgba(21,62,53,.05); }

.page-heading { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin: .25rem 0 1.35rem; }
.page-heading h1 { font-size: clamp(1.45rem, 2vw, 1.8rem); font-weight: 700; letter-spacing: -.035em; margin: .18rem 0 .35rem; }
.page-heading p { color: var(--muted); font-size: .9rem; margin: 0; }
.eyebrow { color: #71877e; font-size: .69rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.role-pill { align-items: center; background: var(--municipal-green-soft); border: 1px solid #d5e4dc; border-radius: 999px; color: var(--municipal-green); display: inline-flex; font-size: .78rem; font-weight: 600; gap: .45rem; padding: .45rem .8rem; }

.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.2rem; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: .85rem; display: grid; grid-template-columns: 48px 1fr; min-height: 114px; padding: 1.05rem 1.2rem; }
.stat-icon { align-items: center; background: var(--municipal-green-soft); border-radius: .7rem; color: var(--municipal-green); display: inline-flex; font-size: 1.2rem; grid-row: span 2; height: 44px; justify-content: center; width: 44px; }
.stat-label { align-self: end; color: var(--muted); font-size: .78rem; }
.stat-value { align-self: start; font-size: 1.6rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; margin-top: .18rem; }

.content-card { background: #fff; border: 1px solid var(--line); border-radius: .9rem; box-shadow: 0 4px 16px rgba(29,43,39,.025); padding: 1.35rem; }
.dashboard-section { margin-top: 1.1rem; }
.section-heading { align-items: flex-start; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1.1rem; }
.section-heading h2, .form-section-heading h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .3rem; }
.section-heading p, .form-section-heading p { color: var(--muted); font-size: .81rem; margin: 0; }
.section-icon { align-items: center; background: #f4f7f5; border-radius: .65rem; color: var(--municipal-green); display: inline-flex; font-size: 1.05rem; height: 38px; justify-content: center; width: 38px; }
.shortcut-grid { display: grid; gap: .8rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shortcut-card { align-items: center; border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); display: flex; gap: .75rem; min-height: 85px; padding: .85rem; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.shortcut-card:hover { border-color: #bdd2c8; box-shadow: 0 6px 18px rgba(21,62,53,.07); color: var(--ink); transform: translateY(-1px); }
.shortcut-icon { align-items: center; background: var(--municipal-green-soft); border-radius: .65rem; color: var(--municipal-green); display: inline-flex; flex: 0 0 auto; font-size: 1.15rem; height: 42px; justify-content: center; width: 42px; }
.shortcut-card strong, .shortcut-card small { display: block; }
.shortcut-card strong { font-size: .8rem; }
.shortcut-card small { color: var(--muted); font-size: .68rem; line-height: 1.35; margin-top: .23rem; }
.shortcut-arrow { color: #9aa8a0; font-size: .85rem; margin-left: auto; }
.role-dashboard-card { margin-bottom: 1rem; }
.feature-list { display: grid; gap: .65rem; }
.feature-placeholder { align-items: center; background: #fbfcfb; border: 1px solid var(--line); border-radius: .7rem; display: flex; gap: .75rem; min-height: 64px; padding: .7rem .8rem; }
.feature-placeholder-icon { align-items: center; background: #f0f3f1; border-radius: .6rem; color: #798780; display: inline-flex; flex: 0 0 auto; font-size: 1rem; height: 38px; justify-content: center; width: 38px; }
.feature-placeholder strong, .feature-placeholder small { display: block; }
.feature-placeholder strong { font-size: .8rem; }
.feature-placeholder small { color: var(--muted); font-size: .7rem; margin-top: .15rem; }
.feature-placeholder .badge { margin-left: auto; }
.dashboard-note { align-items: center; color: var(--muted); display: flex; font-size: .75rem; gap: .5rem; margin-top: 1.1rem; }
.dashboard-note i { color: #9a7a35; font-size: .95rem; }

.filter-form { align-items: end; border-bottom: 1px solid var(--line); display: grid; gap: .75rem; grid-template-columns: minmax(210px, 1.4fr) repeat(3, minmax(130px, .75fr)) auto; padding-bottom: 1.2rem; }
.form-label { color: #46564f; font-size: .77rem; font-weight: 600; margin-bottom: .38rem; }
.form-control, .form-select { border-color: #dce4df; font-size: .86rem; min-height: 40px; }
.form-select { background-image: linear-gradient(45deg, transparent 50%, #68766f 50%), linear-gradient(135deg, #68766f 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-repeat: no-repeat; background-size: 5px 5px; padding-right: 2.2rem; }
.filter-form .form-control, .filter-form .form-select { font-size: .8rem; min-height: 38px; }
.filter-actions { display: flex; gap: .45rem; }
.filter-actions .btn { font-size: .78rem; white-space: nowrap; }
.expediente-filter-form { border-bottom: 1px solid var(--line); display: grid; gap: 1rem; padding-bottom: 1.2rem; }
.expediente-filter-section { min-width: 0; }
.expediente-filter-section h2 { color: #53645b; font-size: .75rem; font-weight: 700; letter-spacing: .04em; margin: 0 0 .6rem; text-transform: uppercase; }
.expediente-filter-grid { align-items: end; display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.expediente-filter-grid > div { min-width: 0; }
.expediente-filter-grid .filter-search { grid-column: 1 / -1; }
.expediente-filter-form .form-control, .expediente-filter-form .form-select { font-size: .8rem; min-height: 38px; }
.expediente-filter-form .filter-actions { justify-content: flex-end; }
.movement-date-filters { border-top: 1px solid #edf0ee; margin-top: .8rem; padding-top: .65rem; }
.movement-date-filters summary { color: var(--municipal-green); cursor: pointer; font-size: .76rem; font-weight: 600; margin-bottom: .75rem; }
.movement-date-filters:not([open]) summary { margin-bottom: 0; }
.active-filter-summary { background: #f7faf8; border: 1px solid #e8efeb; border-radius: .65rem; color: #55655d; font-size: .74rem; margin-top: 1rem; padding: .7rem .85rem; }
.active-filter-summary ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: .35rem 0 0; padding: 0; }
.active-filter-summary li { overflow-wrap: anywhere; }
.dashboard-area-overview { margin-top: 1.1rem; }
.dashboard-global-grid { display: grid; gap: .65rem; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 1.1rem; }
.dashboard-global-stat { background: #f7faf8; border: 1px solid #e8efeb; border-radius: .7rem; min-width: 0; padding: .7rem .8rem; }
.dashboard-global-stat span, .dashboard-global-stat strong { display: block; }
.dashboard-global-stat span { color: var(--muted); font-size: .68rem; }
.dashboard-global-stat strong { color: var(--municipal-green); font-size: 1.15rem; margin-top: .2rem; }
.dashboard-area-grid { display: grid; gap: .75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-area-card { background: #fff; border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); display: block; min-width: 0; padding: .85rem; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.dashboard-area-card:hover { border-color: #bdd2c8; box-shadow: 0 6px 18px rgba(21,62,53,.07); color: var(--ink); transform: translateY(-1px); }
.dashboard-area-card.is-inactive { background: #fafbfa; }
.dashboard-area-card-heading { align-items: flex-start; display: flex; gap: .6rem; justify-content: space-between; min-height: 2.7rem; }
.dashboard-area-card-heading strong { font-size: .8rem; line-height: 1.35; }
.dashboard-area-card-heading .status-badge { flex: 0 0 auto; font-size: .61rem; }
.dashboard-area-metrics { display: grid; gap: .4rem .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: .65rem; }
.dashboard-area-metrics div { min-width: 0; }
.dashboard-area-metrics span, .dashboard-area-metrics strong { display: block; }
.dashboard-area-metrics span { color: var(--muted); font-size: .63rem; line-height: 1.3; }
.dashboard-area-metrics strong { font-size: .92rem; margin-top: .12rem; }
.dashboard-area-link-note { color: var(--municipal-green); display: block; font-size: .66rem; font-weight: 600; margin-top: .65rem; }
.stat-card, .dashboard-global-stat, .dashboard-area-card { animation: dashboard-rise .38s ease-out both; }
.stat-card { box-shadow: 0 5px 18px rgba(29,43,39,.045); }
.dashboard-global-stat { align-items: center; border-left: 3px solid #c8d8d0; display: grid; grid-template-columns: 2rem minmax(0, 1fr); min-height: 78px; padding: .7rem .75rem; }
.dashboard-global-stat > span:not(.dashboard-global-icon) { align-self: end; }
.dashboard-global-stat > strong { align-self: start; font-size: 1.25rem; line-height: 1.2; margin-top: .1rem; }
.dashboard-global-icon { align-items: center; background: #f0f4f2; border-radius: .55rem; color: #536a60; display: inline-flex; grid-row: span 2; height: 30px; justify-content: center; width: 30px; }
.dashboard-global-stat--pending { border-left-color: #6a9b79; }
.dashboard-global-stat--progress { border-left-color: #6d8fb7; }
.dashboard-global-stat--complete { border-left-color: #388365; }
.dashboard-global-stat--soon { border-left-color: #d29d3f; }
.dashboard-global-stat--late { border-left-color: #c65e57; }
.dashboard-global-stat--pending .dashboard-global-icon { background: #edf5ef; color: #39704a; }
.dashboard-global-stat--progress .dashboard-global-icon { background: #edf2f8; color: #4b6c94; }
.dashboard-global-stat--complete .dashboard-global-icon { background: #e9f4ef; color: #26734f; }
.dashboard-global-stat--soon .dashboard-global-icon { background: #fbf3e5; color: #966a1e; }
.dashboard-global-stat--late .dashboard-global-icon { background: #fbefed; color: #a5413b; }
.dashboard-distribution { background: linear-gradient(120deg, #f8faf9, #fff); border: 1px solid #e8efeb; border-radius: .8rem; margin: 0 0 1.1rem; padding: .9rem 1rem; }
.dashboard-distribution-heading { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: .7rem; }
.dashboard-distribution-heading h3 { color: var(--ink); font-size: .8rem; font-weight: 700; margin: 0 0 .2rem; }
.dashboard-distribution-heading p { color: var(--muted); font-size: .68rem; margin: 0; }
.dashboard-distribution-heading > strong { color: #52635b; font-size: .72rem; white-space: nowrap; }
.dashboard-distribution-bar, .dashboard-area-workload-bar { background: #edf1ee; border-radius: 999px; display: flex; height: .58rem; overflow: hidden; width: 100%; }
.dashboard-distribution-segment { display: block; height: 100%; min-width: 2px; transition: width .45s ease; }
.dashboard-distribution-segment--pending { background: #719b7c; }
.dashboard-distribution-segment--progress { background: #7394b8; }
.dashboard-distribution-segment--complete { background: #318263; }
.dashboard-distribution-legend { color: #64736c; display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; margin-top: .7rem; }
.dashboard-distribution-legend > span { align-items: center; display: inline-flex; font-size: .67rem; gap: .35rem; }
.dashboard-distribution-legend strong { color: var(--ink); font-size: .7rem; }
.dashboard-legend-dot { border-radius: 50%; display: inline-block; height: .5rem; width: .5rem; }
.dashboard-legend-dot--pending { background: #719b7c; }
.dashboard-legend-dot--progress { background: #7394b8; }
.dashboard-legend-dot--complete { background: #318263; }
.dashboard-area-card { box-shadow: 0 3px 12px rgba(29,43,39,.035); }
.dashboard-area-card:nth-child(2) { animation-delay: .025s; }
.dashboard-area-card:nth-child(3) { animation-delay: .05s; }
.dashboard-area-card:nth-child(4) { animation-delay: .075s; }
.dashboard-area-card:nth-child(5) { animation-delay: .1s; }
.dashboard-area-card:nth-child(6) { animation-delay: .125s; }
.dashboard-area-card:nth-child(7) { animation-delay: .15s; }
.dashboard-area-card:nth-child(8) { animation-delay: .175s; }
.dashboard-area-card:focus-visible { outline: 3px solid rgba(54,118,86,.32); outline-offset: 2px; }
.dashboard-area-workload-bar { height: .4rem; margin: .55rem 0 .2rem; }
.dashboard-area-no-workload { color: #7d8983; display: block; font-size: .63rem; margin: .55rem 0 .2rem; }
.dashboard-area-metric { border-left: 2px solid #d8e3dc; padding-left: .45rem; }
.dashboard-area-metric--pending { border-left-color: #719b7c; }
.dashboard-area-metric--progress { border-left-color: #7394b8; }
.dashboard-area-metric--complete { border-left-color: #318263; }
.dashboard-area-metric--soon { border-left-color: #d29d3f; }
.dashboard-area-metric--late { border-left-color: #c65e57; }
.dashboard-area-card.is-inactive { border-style: dashed; box-shadow: none; }
.advanced-filter-group { background: #f8faf9; border: 1px solid #e6ede8; border-radius: .75rem; padding: .75rem .85rem; }
.advanced-filter-group > summary { align-items: center; color: var(--municipal-green); cursor: pointer; display: flex; font-size: .78rem; font-weight: 700; gap: .5rem; list-style: none; }
.advanced-filter-group > summary::-webkit-details-marker { display: none; }
.advanced-filter-group > summary::before { content: "\F282"; font-family: "bootstrap-icons"; font-size: .72rem; transition: transform .18s ease; }
.advanced-filter-group[open] > summary::before { transform: rotate(90deg); }
.advanced-filter-content { display: grid; gap: 1rem; margin-top: 1rem; }
.advanced-filter-content .expediente-filter-section + .expediente-filter-section { border-top: 1px solid #e6ede8; padding-top: .85rem; }
.advanced-filter-group .movement-date-filters { border-top: 1px solid #e6ede8; }
.expediente-filter-form .form-control:focus, .expediente-filter-form .form-select:focus { border-color: #84aa94; box-shadow: 0 0 0 .2rem rgba(54,118,86,.12); }
.expediente-filter-form .btn-primary { box-shadow: 0 3px 9px rgba(36,96,66,.16); }
.expediente-table tbody tr { transition: background-color .15s ease; }
.expediente-table tbody tr:hover { background: #f8faf9; }
@keyframes dashboard-rise {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}
.input-icon-wrap { position: relative; }
.input-icon-wrap > i { color: #94a29a; left: .75rem; pointer-events: none; position: absolute; top: 50%; transform: translateY(-50%); }
.input-icon-wrap .form-control { padding-left: 2.15rem; }
.table-toolbar { align-items: center; color: #55655d; display: flex; font-size: .79rem; justify-content: space-between; padding: 1rem 0 .65rem; }
.table { --bs-table-bg: transparent; --bs-table-border-color: #edf0ee; color: var(--ink); font-size: .8rem; margin-bottom: 0; }
.table thead th { background: #f8faf8; border-bottom: 1px solid var(--line); color: #6a7972; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: .75rem .7rem; text-transform: uppercase; white-space: nowrap; }
.table tbody td { padding: .72rem .7rem; }
.table-user { align-items: center; display: flex; gap: .6rem; min-width: 180px; }
.table-user-avatar { font-size: .74rem; height: 34px; width: 34px; }
.table-user strong, .table-user small { display: block; }
.table-user strong { font-size: .78rem; }
.table-user small { color: var(--muted); font-size: .7rem; margin-top: .12rem; }
.role-badge, .status-badge { align-items: center; border-radius: 999px; display: inline-flex; font-size: .68rem; font-weight: 600; gap: .35rem; padding: .32rem .58rem; white-space: nowrap; }
.role-admin { background: #f7f0df; color: #7c6125; }
.role-mesa { background: #e9f1ed; color: #285d48; }
.role-funcionario { background: #edf0f7; color: #475b86; }
.status-badge > span { background: currentColor; border-radius: 50%; height: 6px; width: 6px; }
.status-active { background: #e9f5ee; color: #287044; }
.status-inactive { background: #f1f2f2; color: #78827d; }
.table-actions { align-items: center; display: inline-flex; gap: .35rem; }
.table-actions form { display: inline-flex; }
.btn-light-danger { background: #fff1ef; color: #a63d33; }
.btn-light-danger:hover { background: #ffe3df; color: #8d2a22; }
.btn-light-success { background: #e9f5ee; color: #287044; }
.btn-light-success:hover { background: #d8eddf; color: #1e5c34; }
.empty-state { color: var(--muted); padding: 2.5rem 1rem !important; text-align: center; }
.empty-state i, .empty-state strong, .empty-state span { display: block; }
.empty-state i { color: #9ba8a1; font-size: 1.6rem; margin-bottom: .5rem; }
.empty-state strong { color: #4b5c53; }
.empty-state span { font-size: .74rem; margin-top: .2rem; }
.table-pagination { display: flex; justify-content: flex-end; padding-top: 1rem; }
.pagination { --bs-pagination-color: var(--municipal-green); --bs-pagination-active-bg: var(--municipal-green); --bs-pagination-active-border-color: var(--municipal-green); }
.pagination .page-link { font-size: .78rem; }

.form-card { max-width: 980px; }
.form-section-heading { align-items: center; border-bottom: 1px solid #edf0ee; display: flex; gap: .7rem; margin-bottom: 1rem; padding-bottom: .75rem; }
.form-section-heading h2 { font-size: .95rem; }
.form-section-heading p { font-size: .74rem; }
.form-section-icon { align-items: center; background: var(--municipal-green-soft); border-radius: .6rem; color: var(--municipal-green); display: inline-flex; font-size: 1rem; height: 36px; justify-content: center; width: 36px; }
.required-mark { color: #b13d34; }
.form-text { color: #7c8a83; font-size: .7rem; }
.form-actions { border-top: 1px solid #edf0ee; display: flex; gap: .55rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; }
.permission-chip { background: #edf4ef; border-radius: 999px; color: #2e6448; display: inline-flex; font-size: .68rem; gap: .25rem; margin: .15rem; padding: .3rem .55rem; white-space: nowrap; }
.permission-note { align-items: flex-start; background: #f7f9f8; border-radius: .65rem; color: #64746c; display: flex; font-size: .75rem; gap: .55rem; margin-top: 1rem; padding: .8rem; }
.permission-note i { color: #9a7a35; }
.mesa-shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.record-code { color: var(--municipal-green); font-size: .76rem; white-space: nowrap; }
.table-subtext { color: var(--muted); display: block; font-size: .68rem; margin-top: .2rem; white-space: nowrap; }
.subject-cell { max-width: 260px; min-width: 180px; }
.expediente-form-card { max-width: 1050px; }
.registration-meta { background: #f7faf8; border: 1px solid #e8efeb; border-radius: .75rem; display: flex; gap: 1.5rem; margin-bottom: 1.35rem; padding: .9rem 1rem; }
.registration-meta > span { align-items: center; display: grid; grid-template-columns: 30px 1fr; }
.registration-meta i { color: var(--municipal-green); font-size: 1.1rem; grid-row: span 2; }
.registration-meta strong { font-size: .75rem; }
.registration-meta small { color: var(--muted); font-size: .68rem; margin-top: .13rem; }
.upload-dropzone { background: #fbfcfb; border: 1px dashed #cbd9d1; border-radius: .7rem; padding: .9rem; }
.upload-dropzone .form-control { background: #fff; }
.heading-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.detail-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid > .content-card { min-width: 0; }
.detail-grid .detail-main-card { grid-column: 1 / -1; }
.detail-card-heading { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1rem; padding-bottom: .95rem; }
.detail-card-heading h2 { font-size: 1.2rem; font-weight: 700; margin: .25rem 0 0; }
.detail-fields { display: grid; gap: .9rem 1.2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-fields > div { min-width: 0; }
.detail-fields dt { color: var(--muted); font-size: .68rem; font-weight: 600; margin-bottom: .22rem; }
.detail-fields dd { font-size: .81rem; margin: 0; overflow-wrap: anywhere; }
.detail-fields-single { grid-template-columns: 1fr; }
.detail-field-wide { grid-column: 1 / -1; }
.route-summary { align-items: center; background: #f7faf8; border-radius: .7rem; display: flex; gap: .8rem; justify-content: space-between; padding: .85rem; }
.route-summary > div { min-width: 0; }
.route-summary span, .route-summary strong { display: block; }
.route-summary span { color: var(--muted); font-size: .66rem; }
.route-summary strong { font-size: .78rem; margin-top: .18rem; overflow-wrap: anywhere; }
.route-summary > i { color: var(--municipal-gold); flex: 0 0 auto; }
.movement-list { margin-top: 1rem; }
.movement-item { display: flex; gap: .7rem; padding: .75rem 0; }
.movement-item + .movement-item { border-top: 1px solid #edf0ee; }
.movement-marker { align-items: center; background: var(--municipal-green-soft); border-radius: 50%; color: var(--municipal-green); display: inline-flex; flex: 0 0 auto; height: 32px; justify-content: center; width: 32px; }
.movement-copy { min-width: 0; }
.movement-copy strong, .movement-copy small { display: block; }
.movement-copy strong { font-size: .77rem; }
.movement-copy small { color: var(--muted); font-size: .68rem; margin-top: .15rem; }
.movement-copy p { font-size: .75rem; margin: .4rem 0 0; overflow-wrap: anywhere; }
.attachment-list { display: grid; gap: .55rem; }
.attachment-item { align-items: center; border: 1px solid var(--line); border-radius: .65rem; color: var(--ink); display: flex; gap: .6rem; min-width: 0; padding: .65rem; text-decoration: none; }
.attachment-item:hover { background: #f8faf8; border-color: #cbd9d1; color: var(--municipal-green); }
.attachment-icon { align-items: center; background: var(--municipal-green-soft); border-radius: .55rem; color: var(--municipal-green); display: inline-flex; flex: 0 0 auto; height: 36px; justify-content: center; width: 36px; }
.attachment-copy { min-width: 0; }
.attachment-copy strong, .attachment-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-copy strong { font-size: .73rem; }
.attachment-copy small { color: var(--muted); font-size: .66rem; margin-top: .15rem; }
.attachment-download { color: #87958d; margin-left: auto; }
.app-footer { border-top: 1px solid var(--line); color: #849089; display: flex; font-size: .67rem; justify-content: space-between; margin: auto 2rem 0; padding: .8rem 0 1rem; }
.app-backdrop { display: none; }

.login-page {
    align-items: center;
    background-color: var(--municipal-green-deep);
    background-image:
        linear-gradient(145deg, rgba(13, 47, 41, .72), rgba(13, 47, 41, .56)),
        url("../img/fondo-matanza.jpg");
    background-position: center, center 46%;
    background-repeat: no-repeat;
    background-size: cover;
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    padding: 2.5rem;
}
.login-shell { background: #fff; border: 1px solid #e8eeea; border-radius: 1.1rem; box-shadow: 0 24px 70px rgba(17,48,41,.12); display: grid; grid-template-columns: minmax(320px, .9fr) 1.1fr; margin: 0 auto; max-width: 1040px; min-height: 620px; overflow: hidden; width: 100%; }
.login-brand-panel { background: radial-gradient(circle at 85% 20%, rgba(211,165,75,.22), transparent 28%), linear-gradient(145deg, #1d5144, var(--municipal-green-deep)); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; position: relative; }
.login-brand-panel::after { border: 1px solid rgba(255,255,255,.08); border-radius: 50%; bottom: -155px; content: ""; height: 410px; position: absolute; right: -120px; width: 410px; }
.login-brand-kicker { color: #d6c08d; font-size: .7rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.login-brand-copy h1 { font-size: clamp(2.4rem, 4vw, 3.5rem); font-weight: 700; letter-spacing: -.06em; margin: .7rem 0 .35rem; }
.login-brand-copy p { color: rgba(255,255,255,.68); font-size: 1rem; }
.login-brand-footer { align-items: center; color: rgba(255,255,255,.65); display: flex; font-size: .75rem; gap: .6rem; position: relative; z-index: 1; }
.login-brand-footer i { color: #e0c47e; font-size: 1.25rem; }
.login-form-panel { align-items: center; display: flex; justify-content: center; padding: 3rem; }
.login-form-content { max-width: 400px; width: 100%; }
.login-form-content h2 { font-size: 2rem; font-weight: 700; letter-spacing: -.04em; margin: .35rem 0 .45rem; }
.login-form .form-label { font-size: .8rem; }
.login-form .form-control { background: #fcfdfc; font-size: .9rem; min-height: 50px; }
.login-submit { font-size: .9rem; font-weight: 600; min-height: 50px; }
.login-help { color: #829087; font-size: .72rem; margin: 1.25rem 0 0; text-align: center; }
.login-mobile-brand { color: var(--municipal-green); display: none; font-size: 1rem; font-weight: 700; margin-bottom: 2rem; }
.login-mobile-brand span { color: var(--muted); display: block; font-size: .7rem; font-weight: 400; margin-top: .2rem; }

@media (min-width: 801px) and (max-height: 800px) {
    .login-page { padding: 1rem 2rem; }
    .login-shell {
        min-height: min(600px, calc(100vh - 2rem));
        min-height: min(600px, calc(100svh - 2rem));
    }
    .login-brand-panel, .login-form-panel { padding: clamp(1.5rem, 4vh, 2.4rem); }
    .login-form .form-control, .login-submit { min-height: 46px; }
    .login-help { margin-top: .9rem; }
}

@media (max-width: 1100px) {
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-search { grid-column: span 2; }
    .filter-actions { grid-column: span 2; }
    .expediente-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-global-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .shortcut-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .app-sidebar { box-shadow: 14px 0 32px rgba(15,35,29,.18); transform: translateX(-105%); transition: transform .22s ease; }
    .sidebar-open .app-sidebar { transform: translateX(0); }
    .app-backdrop { background: rgba(10,27,22,.42); inset: 0; position: fixed; z-index: 1030; }
    .sidebar-open .app-backdrop { display: block; }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .app-topbar { min-height: 66px; padding: .65rem 1rem; }
    .app-content { padding: 1.15rem 1rem 1.5rem; }
    .app-footer { margin: auto 1rem 0; }
    .stat-grid { gap: .65rem; grid-template-columns: 1fr; }
    .stat-card { min-height: 92px; }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .detail-grid .detail-main-card { grid-column: auto; }
    .login-page { background-position: center, 53% center; padding: 1rem; }
    .login-shell { grid-template-columns: 1fr; min-height: 0; max-width: 560px; }
    .login-brand-panel { display: none; }
    .login-form-panel { padding: 2rem 1.4rem; }
    .login-mobile-brand { display: block; }
}

@media (max-width: 520px) {
    .topbar-title { max-width: 145px; }
    .topbar-system-name { font-size: .76rem; }
    .user-summary-text, .topbar-logout span { display: none; }
    .topbar-user { gap: .45rem; }
    .notification-panel { right: -3rem; }
    .notification-history-item { flex-direction: column; }
    .notification-history-actions { align-items: flex-start; flex-direction: row; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading > .btn { align-self: stretch; }
    .role-pill { align-self: flex-start; }
    .filter-form { grid-template-columns: 1fr; }
    .filter-search, .filter-actions { grid-column: auto; }
    .filter-actions > * { flex: 1; }
    .expediente-filter-grid { grid-template-columns: 1fr; }
    .expediente-filter-grid .filter-search { grid-column: auto; }
    .expediente-filter-form .filter-actions { flex-direction: column; }
    .dashboard-area-grid { grid-template-columns: 1fr; }
    .dashboard-global-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-distribution { padding: .8rem; }
    .dashboard-distribution-heading { align-items: flex-start; }
    .dashboard-distribution-heading > strong { margin-top: .1rem; }
    .content-card { padding: 1rem; }
    .app-footer { gap: .5rem; }
    .app-footer span:last-child { text-align: right; }
    .feature-placeholder { align-items: flex-start; flex-wrap: wrap; }
    .feature-placeholder .badge { margin-left: 3rem; }
    .registration-meta { flex-direction: column; gap: .8rem; }
    .detail-fields { grid-template-columns: 1fr; }
    .detail-field-wide { grid-column: auto; }
    .heading-actions { align-self: stretch; }
    .heading-actions > * { flex: 1; }
    .mesa-shortcut-grid { grid-template-columns: 1fr; }
    .login-form-panel { padding: 1.5rem 1.1rem; }
}
.assistant-card { display: flex; flex-direction: column; gap: 1rem; max-width: 980px; }
.assistant-log { background: var(--canvas); border: 1px solid var(--line); border-radius: .75rem; display: flex; flex-direction: column; gap: .75rem; max-height: 55vh; min-height: 240px; overflow-y: auto; padding: 1rem; }
.assistant-message { display: flex; }
.assistant-message.is-user { justify-content: flex-end; }
.assistant-bubble { background: #fff; border: 1px solid var(--line); border-radius: .85rem; font-size: .92rem; max-width: 88%; overflow-wrap: anywhere; padding: .7rem .9rem; white-space: pre-wrap; }
.assistant-message.is-user .assistant-bubble { background: var(--municipal-green); border-color: var(--municipal-green); color: #fff; }
.assistant-bubble.is-error { background: #fdecec; border-color: #f3c4c4; color: #8a1f1f; }
.assistant-lead { font-weight: 600; margin: 0 0 .5rem; }
.assistant-data { background: var(--municipal-green-soft); border-radius: .6rem; display: flex; flex-direction: column; gap: .3rem; padding: .65rem .75rem; white-space: normal; }
.assistant-field { display: flex; flex-wrap: wrap; gap: .4rem; }
.assistant-field-name { color: var(--muted); font-size: .8rem; min-width: 8.5rem; }
.assistant-field-value { font-weight: 500; }
.assistant-group-title { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #52665e; }
.assistant-item { display: flex; flex-direction: column; }
.assistant-item-code { font-weight: 700; }
.assistant-item-meta { color: var(--muted); font-size: .82rem; }
.assistant-ai { border-left: 3px solid var(--municipal-gold); margin-top: .65rem; padding-left: .7rem; white-space: normal; }
.assistant-ai-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #7a5d1f; }
.assistant-ai-text { margin: .2rem 0 0; }
.assistant-note { color: var(--muted); font-size: .8rem; margin: .6rem 0 0; white-space: normal; }
.assistant-examples { align-items: center; display: flex; flex-wrap: wrap; gap: .4rem; }
.assistant-examples-label { color: var(--muted); font-size: .8rem; }
.assistant-examples .btn { text-align: left; }
.assistant-form { display: flex; gap: .5rem; }
.assistant-form .form-control { flex: 1; }
.assistant-disclaimer { color: var(--muted); font-size: .78rem; margin: 0; }
@media (max-width: 575.98px) {
    .assistant-bubble { max-width: 96%; }
    .assistant-field-name { min-width: 100%; }
    .assistant-form { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .stat-card, .dashboard-global-stat, .dashboard-area-card { animation: none; }
    .dashboard-distribution-segment, .dashboard-area-card, .shortcut-card,
    .expediente-table tbody tr, .advanced-filter-group > summary::before { transition: none; }
}
