:root {
    /* Paleta despacho: autoridad y estabilidad */
    --color-midnight: #1E293B;
    --color-institutional: #3B82F6;
    --color-stone: #F8FAFC;
    --color-gold-matte: #B59410;

    --primary: var(--color-midnight);
    --action: var(--color-institutional);
    --accent: #f59e0b;
    --gold: var(--color-gold-matte);
    --bg: var(--color-stone);
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --danger: #b91c1c;
    --shadow-soft: 0 8px 26px rgba(30, 41, 59, 0.06);
    --shadow-strong: 0 14px 40px rgba(30, 41, 59, 0.08);
    --shell-bg: var(--color-stone);
    --shell-surface: #ffffff;
    --shell-border: #e2e8f0;
    --shell-text: #1e293b;
    --shell-muted: #64748b;
}

* { box-sizing: border-box; }

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.app-shell {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 268px 1fr;
    position: relative;
    background: var(--color-stone);
    overflow: hidden;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 82px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, #1E293B 0%, #172033 100%);
    color: #cbd5e1;
    padding: 1rem .65rem 1rem;
    border-right: 1px solid rgba(15, 23, 42, 0.35);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
    transition: transform .22s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: .15rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: .85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .45rem;
}

.sidebar-logout-btn {
    flex-shrink: 0;
    width: 2.15rem;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.sidebar-logout-btn:hover {
    background: rgba(185, 28, 28, 0.22);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.sidebar-tour-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    width: 100%;
    padding: .35rem .45rem;
    border: none;
    border-radius: .45rem;
    background: transparent;
    color: #94a3b8;
    font-size: .78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.sidebar-tour-link:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.08);
}

.brand-block {
    margin: .15rem .35rem 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.brand-kalex-mark {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .55rem;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.55) 0%, rgba(30, 58, 138, 0.45) 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.brand-kalex-mark img {
    width: 28px;
    height: 28px;
    display: block;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: .55rem;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
}

.brand-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--color-institutional) 0%, #1d4ed8 100%);
    font-weight: 700;
    font-size: .72rem;
}

.brand-copy {
    display: grid;
    line-height: 1.15;
    min-width: 0;
}

.brand-name {
    color: #f8fafc;
    font-size: .88rem;
    font-weight: 700;
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-sub {
    color: #a5b4fc;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
}

.brand-slogan {
    color: rgba(248, 250, 252, 0.78);
    font-size: .6rem;
    font-weight: 500;
    letter-spacing: .04em;
    font-style: italic;
}

.sidebar a {
    color: #cbd5e1;
    text-decoration: none;
    padding: .58rem .65rem;
    border-radius: .55rem;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .55rem;
    position: relative;
}

.sidebar a:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #fff;
}

.sidebar a.active {
    background: rgba(59, 130, 246, 0.18);
    color: #f8fafc;
    box-shadow: inset 3px 0 0 var(--color-institutional);
}

.sidebar a.active .nav-icon {
    color: #93c5fd;
}

.nav-link-settings {
    margin-top: .65rem;
    padding-top: .75rem !important;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    font-size: .86rem !important;
    opacity: 0.92;
}

/* Submenú Configuración */
.nav-group {
    margin-top: .35rem;
    display: flex;
    flex-direction: column;
    gap: .08rem;
}

.nav-group-toggle {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #cbd5e1;
    padding: .58rem .65rem;
    border-radius: .55rem;
    font-size: .9rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: .55rem;
    cursor: pointer;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: .75rem;
}

.nav-group-toggle:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #fff;
}

.nav-chevron {
    margin-left: auto;
    display: inline-flex;
    opacity: .75;
    transition: transform .22s ease;
}

.nav-group.is-open .nav-chevron {
    transform: rotate(180deg);
}

.nav-sub {
    display: flex;
    flex-direction: column;
    gap: .06rem;
    padding: .15rem 0 .35rem .35rem;
    margin-left: .85rem;
    border-left: 2px solid rgba(148, 163, 184, 0.18);
}

.nav-sub a {
    font-size: .86rem !important;
    padding: .48rem .55rem !important;
}

.nav-icon--sub {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    opacity: .9;
}

.nav-icon--sub .lucide-icon,
.nav-icon--sub svg {
    width: 16px;
    height: 16px;
}

.nav-link-settings-inner {
    opacity: 0.95;
}

.nav-badge {
    margin-left: auto;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 .32rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
    color: #fff;
}

.nav-badge--warn {
    background: var(--accent);
}

.nav-badge--danger {
    background: var(--danger);
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
}

.nav-icon svg,
.nav-icon .lucide-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.app-shell .icon-btn .lucide-icon {
    display: block;
}

.nav-label {
    white-space: nowrap;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    padding: 0 .15rem;
}

.sidebar-user-text {
    min-width: 0;
}

.user-avatar--gold {
    width: 36px;
    height: 36px;
    font-size: .75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #1e293b;
    background: linear-gradient(145deg, #e8ddba 0%, #d4b84a 40%, var(--color-gold-matte) 100%);
    box-shadow: 0 0 0 2px rgba(181, 148, 16, 0.35);
    flex-shrink: 0;
}

.user-avatar-img,
.topbar-user-avatar img,
.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.app-shell .sidebar .sidebar-footer .user-name {
    font-size: .84rem;
    font-weight: 600;
    color: #f1f5f9;
}

.app-shell .sidebar .sidebar-footer .user-role {
    font-size: .7rem;
    color: var(--shell-muted);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    border: 0;
    z-index: 15;
    cursor: pointer;
}

.content {
    padding: 0;
    min-width: 0;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-stone);
}

.app-shell .content {
    padding: 0;
    min-width: 0;
}

.content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.35rem 1.75rem;
    -webkit-overflow-scrolling: touch;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 30;
}

.topbar--app {
    height: 3.5rem;
    padding: 0 1.15rem 0 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.topbar--slim {
    height: 44px;
}

.topbar.sticky {
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.topbar-right {
    margin-left: auto;
}

.topbar-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .55rem;
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.topbar-icon-btn:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
}

.topbar-notify-btn {
    position: relative;
}

.topbar-notify-dot {
    position: absolute;
    top: .42rem;
    right: .42rem;
    width: .45rem;
    height: .45rem;
    border-radius: 999px;
    background: var(--color-institutional);
    box-shadow: 0 0 0 2px #fff;
}

.topbar-notify-wrap {
    position: relative;
}

.topbar-notify-btn.is-open {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.topbar-notify-badge {
    position: absolute;
    top: -.15rem;
    right: -.2rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 .28rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.topbar-notify-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    border: 0;
    background: transparent;
    cursor: default;
}

.topbar-notify-panel {
    position: absolute;
    top: calc(100% + .45rem);
    right: 0;
    z-index: 50;
    width: min(22rem, calc(100vw - 1.5rem));
    max-height: min(24rem, 70vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.topbar-notify-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .75rem .85rem;
    border-bottom: 1px solid #e2e8f0;
}

.topbar-notify-panel-head h3 {
    margin: 0;
    font-size: .92rem;
    font-weight: 700;
    color: #0f172a;
}

.topbar-notify-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.topbar-notify-item {
    padding: .7rem .85rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background .12s ease;
}

.topbar-notify-item:hover {
    background: #f8fafc;
}

.topbar-notify-item.is-unread {
    background: #eff6ff;
}

.topbar-notify-item-title {
    font-size: .86rem;
    font-weight: 600;
    color: #0f172a;
}

.topbar-notify-item-body {
    margin: .25rem 0 0;
    font-size: .8rem;
    line-height: 1.35;
}

.topbar-notify-item-time {
    display: block;
    margin-top: .3rem;
    font-size: .7rem;
    color: #94a3b8;
}

.topbar-notify-empty {
    padding: 1.25rem .85rem;
    margin: 0;
    text-align: center;
}

.topbar-user-wrap {
    position: relative;
    margin-left: .15rem;
}

.topbar-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    max-width: min(240px, 42vw);
    padding: .28rem .45rem .28rem .28rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.topbar-user-trigger:hover,
.topbar-user-trigger.is-open {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    background: #f8fafc;
}

.topbar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    color: #1e293b;
    background: linear-gradient(145deg, #e8ddba 0%, #d4b84a 40%, var(--color-gold-matte) 100%);
    flex-shrink: 0;
    overflow: hidden;
}

.topbar-user-avatar--lg {
    width: 2.35rem;
    height: 2.35rem;
    font-size: .8rem;
}

.topbar-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
}

.topbar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #0f172a;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-role {
    font-size: .68rem;
    color: #64748b;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-chevron {
    display: inline-flex;
    color: #94a3b8;
    transition: transform .2s ease;
}

.topbar-user-trigger.is-open .topbar-user-chevron {
    transform: rotate(180deg);
}

.topbar-user-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    border: 0;
    background: transparent;
    cursor: default;
}

.topbar-user-menu {
    position: absolute;
    top: calc(100% + .45rem);
    right: 0;
    z-index: 50;
    width: min(17.5rem, calc(100vw - 1.5rem));
    padding: .45rem;
    border-radius: .75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.topbar-user-menu-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .55rem .65rem;
}

.topbar-user-menu-name {
    font-size: .88rem;
    font-weight: 700;
    color: #0f172a;
}

.topbar-user-menu-role {
    margin-top: .15rem;
    font-size: .72rem;
    color: #64748b;
    line-height: 1.35;
}

.topbar-user-menu-item {
    width: 100%;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .52rem .55rem;
    border: none;
    border-radius: .5rem;
    background: transparent;
    color: #334155;
    font-size: .86rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.topbar-user-menu-item:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.topbar-user-menu-item:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.topbar-user-menu-item--danger {
    color: #b91c1c;
}

.topbar-user-menu-item--danger:hover:not(:disabled) {
    background: #fef2f2;
    color: #991b1b;
}

.topbar-user-menu-divider {
    height: 1px;
    margin: .35rem .35rem;
    background: #e2e8f0;
}

.app-shell .icon-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
}

.app-shell .icon-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.app-shell .notification-dot {
    border-color: #fff;
    background: var(--color-institutional);
}

.mobile-only { display: none; }
.desktop-only { display: inline-flex; }

/* ============================================================
   Page hero (estándar global): cabecera con título serif + acción
   Se aplica a: /clients, /expedients, /tasks, /calendar, etc.
   ============================================================ */
.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-hero-sub {
    margin: .35rem 0 0;
    font-size: .92rem;
}

.page-title-serif {
    margin: 0;
    font-family: "Cormorant Garamond", "Georgia", serif;
    font-weight: 600;
    font-size: 1.9rem;
    letter-spacing: .02em;
    color: var(--color-midnight);
    line-height: 1.15;
}

.page-hero-date {
    margin: .35rem 0 0;
    font-size: .88rem;
    color: var(--muted);
    text-transform: capitalize;
}

.app-shell .header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.app-shell h2,
.app-shell h3,
.app-shell h4 {
    color: var(--color-midnight);
}

.app-shell .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .85rem;
    padding: 1.05rem 1.1rem;
    box-shadow: var(--shadow-soft);
}

.app-shell .muted {
    color: var(--muted);
}

.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.dash-kpi-card {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .85rem;
    padding: 1rem 1rem 1rem .95rem;
    box-shadow: var(--shadow-soft);
}

.dash-kpi-card--border-danger {
    border-color: rgba(185, 28, 28, 0.45);
    box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.12) inset;
}

.dash-kpi-card--border-alert {
    border-color: rgba(124, 58, 237, 0.28);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.08) inset;
}

.dash-kpi-card--border-warn {
    border-color: rgba(180, 83, 9, 0.45);
    box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.1) inset;
}

.dash-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-kpi-icon svg,
.dash-kpi-icon .lucide-icon {
    width: 22px;
    height: 22px;
}

.dash-kpi-icon--blue {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.dash-kpi-icon--danger {
    background: rgba(185, 28, 28, 0.2);
    color: #f87171;
}

.dash-kpi-icon--alert {
    background: rgba(167, 139, 250, 0.18);
    color: #7c3aed;
}

.dash-kpi-icon--warn {
    background: rgba(180, 83, 9, 0.22);
    color: #fb923c;
}

.dash-kpi-icon--money {
    background: rgba(181, 148, 16, 0.12);
    color: var(--color-gold-matte);
}

.dash-kpi-body {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.dash-kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--color-midnight);
    line-height: 1.1;
}

.dash-kpi-value--danger {
    color: #fca5a5;
}

.dash-kpi-value--alert {
    color: #6d28d9;
}

.dash-kpi-value--warn {
    color: #fdba74;
}

.dash-kpi-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
}

.dash-kpi-sub {
    font-size: .78rem;
}

.dash-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dash-panel-head {
    margin-bottom: .75rem;
}

.dash-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-midnight);
}

.dash-alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-alert-item {
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}

.dash-alert-item:last-child {
    border-bottom: none;
}

.dash-alert-item--split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}

.dash-alert-title {
    font-size: .9rem;
    color: var(--text);
}

.dash-alert-meta {
    font-size: .78rem;
    margin-top: .2rem;
}

.dash-inact-badge {
    font-size: .78rem;
    font-weight: 700;
    padding: .2rem .45rem;
    border-radius: .4rem;
    background: rgba(180, 83, 9, 0.2);
    color: #fdba74;
}

.dash-panel-link {
    display: inline-block;
    margin-top: .75rem;
    font-size: .86rem;
    font-weight: 600;
    color: var(--color-gold-matte);
    text-decoration: none;
}

.dash-panel-link:hover {
    text-decoration: underline;
    color: #92700d;
}

.dash-matter-card {
    margin-top: .25rem;
}

.dash-matter-hint {
    font-size: .82rem;
    margin: .25rem 0 .85rem;
}

.dash-matter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .65rem;
}

.dash-matter-block {
    border-radius: .65rem;
    padding: .75rem .55rem;
    text-align: center;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

.dash-matter-name {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .35rem;
}

.dash-matter-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--matter-color);
}

.kpi {
    display: grid;
    gap: .2rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-label {
    font-size: .82rem;
    color: var(--muted);
}

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.app-shell .table th {
    color: var(--muted);
    background: #f1f5f9;
    border-bottom-color: var(--border);
}

.app-shell .table td {
    color: var(--text);
    border-bottom-color: var(--border);
}

.app-shell .table tbody tr:hover {
    background: #f8fafc;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    text-align: left;
    font-size: .78rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
    background: #f6f9fe;
    border-bottom: 1px solid var(--border);
    padding: .7rem .75rem;
}

.table td {
    text-align: left;
    padding: .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .92rem;
}

.table tbody tr:hover { background: #f8fafc; }

.badge {
    display: inline-block;
    font-size: .72rem;
    padding: .22rem .5rem;
    border-radius: 999px;
    border: 1px solid #d1fae5;
    color: #065f46;
    background: #ecfdf5;
}

.badge.danger {
    border-color: #fecaca;
    color: var(--danger);
    background: #fef2f2;
}

.empty-state,
.error-state {
    border: 1px dashed var(--border);
    border-radius: .75rem;
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    background: #f9fbff;
    box-shadow: var(--shadow-soft);
}

.app-shell .empty-state,
.app-shell .error-state {
    background: #fff;
    border-color: var(--border);
    color: var(--muted);
}

.error-state {
    border-style: solid;
    border-color: #fecaca;
    color: #991b1b;
    background: #fff7f7;
}

.app-shell .error-state {
    border-color: #fecaca;
    color: #991b1b;
    background: #fff7f7;
}

.input, .select, .btn {
    width: 100%;
    padding: .62rem .72rem;
    border: 1px solid var(--border);
    border-radius: .55rem;
    background: #fff;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--color-institutional);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn {
    cursor: pointer;
    font-weight: 600;
    transition: all .16s ease;
}

.btn svg {
    margin-right: .35rem;
    vertical-align: -2px;
}

.btn.primary {
    border-color: #2563eb;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.28);
}

.btn.primary:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.btn.ghost {
    border-color: var(--border);
    background: #fff;
}

.btn:disabled { opacity: .8; cursor: not-allowed; }

.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-right: .45rem;
    vertical-align: text-bottom;
    animation: spin .7s linear infinite;
}

.toolbar { display: flex; gap: .75rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }

.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.kanban-col {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: .75rem;
    box-shadow: var(--shadow-soft);
}

.kanban-card {
    border: 1px solid var(--border);
    border-radius: .55rem;
    padding: .65rem;
    margin-bottom: .6rem;
    background: #fff;
    transition: transform .14s ease, box-shadow .14s ease;
}

.kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.app-shell .kanban-col {
    background: var(--surface);
    border-color: var(--border);
}

.app-shell .kanban-card {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

/* ── Expedientes (lista) ─────────────────────────────────── */
.expedients-page {
    max-width: 1280px;
    margin: 0 auto;
}

.exped-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.exped-hero-title {
    font-size: 1.9rem;
}

.exped-hero-sub {
    margin: .35rem 0 0;
    font-size: .92rem;
}

.exped-btn-new {
    width: auto;
    white-space: nowrap;
    padding: .62rem 1.1rem;
    border-radius: .65rem;
}

.exped-toolbar {
    margin-bottom: 1rem;
}

.exped-search-wrap {
    position: relative;
    margin-bottom: .75rem;
}

.exped-search-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.exped-search-input {
    padding-left: 2.5rem !important;
    width: 100%;
    max-width: 100%;
}

.exped-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.exped-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: .38rem .85rem;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.exped-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.exped-chip.is-active {
    border-color: var(--color-institutional);
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.exped-table-card {
    padding: 0;
    overflow: hidden;
}

.exped-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.exped-table {
    min-width: 920px;
}

.exped-table th {
    font-size: .72rem;
    letter-spacing: .06em;
}

.exped-th-actions {
    width: 48px;
}

.exped-row {
    cursor: pointer;
    transition: background .12s ease;
}

.exped-row:hover {
    background: #f8fafc;
}

.exped-cell-expediente {
    max-width: 260px;
}

.exped-case-id {
    display: block;
    font-weight: 700;
    font-size: .82rem;
    color: var(--color-gold-matte);
    letter-spacing: .02em;
}

.exped-case-title {
    display: block;
    font-size: .88rem;
    color: var(--text);
    margin-top: .2rem;
    line-height: 1.35;
}

.exped-stage-line {
    font-size: .78rem;
    margin-top: .35rem;
}

.exped-matter-pill {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.exped-matter-pill--civil {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.25);
}

.exped-matter-pill--mercantil {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9;
    border-color: rgba(124, 58, 237, 0.22);
}

.exped-matter-pill--amparo {
    background: rgba(181, 148, 16, 0.14);
    color: #92700d;
    border-color: rgba(181, 148, 16, 0.3);
}

.exped-matter-pill--laboral {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.22);
}

.exped-matter-pill--familiar {
    background: rgba(219, 39, 119, 0.1);
    color: #be185d;
    border-color: rgba(219, 39, 119, 0.2);
}

.exped-matter-pill--penal {
    background: rgba(185, 28, 28, 0.1);
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.22);
}

.exped-matter-pill--admin {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.25);
}

.exped-status-pill {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 999px;
}

.exped-status-pill--progress {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.exped-status-pill--open {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.exped-status-pill--pending {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.exped-status-pill--closed {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.exped-status-pill--archived {
    background: rgba(71, 85, 105, 0.1);
    color: #64748b;
}

.exped-cell-deadline {
    font-size: .86rem;
    white-space: nowrap;
}

.exped-deadline-urgent {
    font-size: .72rem;
    font-weight: 700;
    color: var(--danger);
    margin-top: .25rem;
}

.exped-badge-alert {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .45rem;
    border-radius: .4rem;
    background: rgba(185, 28, 28, 0.1);
    color: #b91c1c;
}

.exped-cell-actions {
    text-align: right;
    vertical-align: middle;
}

.exped-btn-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: .55rem;
    background: #fff;
    color: var(--primary);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.exped-btn-view:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

@media (max-width: 1200px) {
    .dash-matter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* Drawer fuera del flujo: el contenido principal usa todo el ancho del viewport */
    .app-shell > .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(272px, 88vw);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        border-right: 1px solid rgba(30, 41, 59, 0.5);
        border-bottom: none;
        z-index: 25;
        grid-column: 1;
        grid-row: 1;
    }

    .app-shell > .sidebar.is-open {
        transform: translateX(0);
    }

    .app-shell > main.content {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .sidebar-backdrop {
        grid-column: 1;
        grid-row: 1;
        z-index: 18;
    }

    .content-scroll {
        padding: .75rem .65rem 1.25rem;
    }

    .content-scroll:has(.exped-detail-page) {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .topbar--app {
        padding: 0 .65rem;
        height: 3.25rem;
    }

    .exped-detail-page {
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .exped-detail-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 1rem 3.75rem 1rem 1rem;
        border-radius: .75rem;
    }

    .exped-detail-hero-main {
        min-width: 0;
    }

    .exped-detail-hero-actions {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        margin-top: 1rem;
        padding-top: 1rem;
        padding-right: 0;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
        gap: .55rem;
    }

    .exped-detail-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 0;
        margin: 0 -0.15rem;
        padding: 0 0 .15rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .exped-detail-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: .8rem;
        padding: .55rem .65rem;
    }

    .exped-detail-meta-grid {
        gap: .6rem;
    }

    .exped-detail-panel.card {
        padding: .85rem .65rem;
    }

    .grid-4, .grid-2, .kanban { grid-template-columns: 1fr; }
    .dash-kpi-row { grid-template-columns: 1fr; }
    .dash-two-col { grid-template-columns: 1fr; }
    .dash-matter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mobile-only { display: inline-flex; }
    .desktop-only { display: none; }
}

@media (min-width: 981px) {
    .app-shell.sidebar-collapsed .sidebar .nav-label {
        display: none;
    }
    .app-shell.sidebar-collapsed .sidebar .brand-copy {
        display: none;
    }
    .app-shell.sidebar-collapsed .sidebar .brand-block {
        justify-content: center;
    }
    .app-shell.sidebar-collapsed .sidebar .brand-kalex-mark {
        display: none;
    }
    .app-shell.sidebar-collapsed .sidebar .sidebar-user-row {
        flex-direction: column;
        align-items: center;
        gap: .35rem;
    }
    .app-shell.sidebar-collapsed .sidebar .sidebar-user {
        justify-content: center;
    }
    .app-shell.sidebar-collapsed .sidebar .sidebar-user-text,
    .app-shell.sidebar-collapsed .sidebar .sidebar-tour-link span {
        display: none;
    }
    .app-shell.sidebar-collapsed .sidebar .sidebar-tour-link {
        justify-content: center;
        padding: .4rem;
    }
    .app-shell.sidebar-collapsed .nav-badge {
        display: none;
    }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Expediente detalle (panel tipo modal / mock) ─────────── */
.exped-detail-page {
    max-width: 960px;
    margin: 0 auto;
}

.exped-detail-hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--color-midnight) 0%, #172033 100%);
    color: #f1f5f9;
    border-radius: 1rem;
    padding: 1.35rem 4.25rem 1.35rem 1.35rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-strong);
}

.exped-detail-hero-main {
    flex: 1 1 240px;
    min-width: 0;
}

.exped-detail-case-id {
    margin: 0 0 .35rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--color-gold-matte);
    letter-spacing: .04em;
}

.exped-detail-title {
    margin: 0 0 .6rem;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.exped-detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
    margin-bottom: 0;
}

.exped-detail-stage-pill {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
}

.exped-detail-close {
    position: absolute;
    top: .85rem;
    right: .85rem;
    z-index: 2;
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .5rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.35);
    color: #cbd5e1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.exped-detail-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.exped-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.exped-detail-meta-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: .85rem 1rem;
    box-shadow: var(--shadow-soft);
}

.exped-detail-meta-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .35rem;
}

.exped-detail-meta-value {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.exped-detail-link-btn {
    margin-top: .45rem;
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 600;
    font-size: .82rem;
    padding: 0;
    cursor: pointer;
}

.exped-detail-link-btn:hover {
    text-decoration: underline;
}

.exped-detail-authority-editor {
    margin-top: .7rem;
    border-top: 1px dashed var(--border);
    padding-top: .65rem;
}

.exped-detail-authority-actions {
    margin-top: .6rem;
    display: flex;
    gap: .55rem;
    justify-content: flex-end;
}

.exped-detail-authority-actions .btn {
    width: auto;
}

.exped-detail-fatal--urgent {
    color: #b91c1c;
    font-weight: 700;
}

.exped-detail-tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    padding: 0 .15rem;
}

.exped-detail-tab {
    position: relative;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: .9rem;
    padding: .65rem .95rem;
    cursor: pointer;
    border-radius: .5rem .5rem 0 0;
}

.exped-detail-tab:hover {
    color: var(--text);
    background: rgba(30, 41, 59, 0.04);
}

.exped-detail-tab.is-active {
    color: var(--text);
}

.exped-detail-tab.is-active::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: -1px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--color-gold-matte), #f59e0b);
}

.exped-detail-panel.card {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding: 1.1rem 1.15rem;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.exped-detail-act-list,
.exped-detail-task-list,
.exped-detail-doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.exped-detail-act-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: .85rem;
}

.exped-boletin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.exped-boletin-toggle.is-active {
    border-color: #0ea5e9;
}

.exped-boletin-toggle.is-open {
    background: #f0f9ff;
}

.exped-boletin-toggle-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
}

.exped-boletin-panel-head-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.exped-boletin-panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
}

.exped-boletin-panel-close:hover {
    background: #f8fafc;
    color: #334155;
}

.exped-boletin-benefits {
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    background: #fff;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #334155;
}

.exped-boletin-benefits strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #0c4a6e;
}

.exped-boletin-benefits p {
    margin: 0;
}

.exped-boletin-prefill-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
}

.exped-boletin-last-sync {
    margin: 0 0 0.15rem;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #64748b;
}

.exped-boletin-last-sync strong {
    font-weight: 600;
    color: #475569;
}

.exped-boletin-auto-hint {
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.4;
    color: #94a3b8;
}

.exped-boletin-unavailable {
    padding: 0.85rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 0.9rem;
    line-height: 1.55;
}

.exped-boletin-unavailable p {
    margin: 0 0 0.75rem;
}

.exped-boletin-toggle-badge.is-unavailable {
    background: #fee2e2;
    color: #b91c1c;
}

.exped-detail-btn-create {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    width: auto;
    padding: .55rem 1.05rem;
    border-radius: .6rem;
}

/* === Botón de acción "Crear" unificado (plano, alineado con Guardar/Cancelar) === */
.btn-create {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1.25rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #e8ddba 0%, #d4b84a 45%, var(--color-gold-matte) 100%);
    color: #1f2937;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .02em;
    line-height: 1;
    cursor: pointer;
    box-shadow:
        0 6px 14px rgba(181, 148, 16, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-create svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

.btn-create:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow:
        0 10px 22px rgba(181, 148, 16, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-create:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(.97);
}

.btn-create:disabled {
    cursor: not-allowed;
    opacity: .6;
    box-shadow: none;
    transform: none;
    filter: grayscale(.2);
}

.btn-create--sm {
    font-size: .78rem;
    padding: .45rem 1rem;
}

/* === Variante "hero" con badge flotante. Usar SOLO en empty states === */
.btn-create--hero {
    position: relative;
    margin-top: 18px;
    padding: .7rem 1.5rem .6rem;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.btn-create--hero .btn-create-badge {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(180deg, #e8ddba 0%, #d4b84a 45%, var(--color-gold-matte) 100%);
    border: 3px solid #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    box-shadow: 0 5px 12px rgba(181, 148, 16, 0.35);
    pointer-events: none;
}

.btn-create--hero .btn-create-badge svg {
    width: 16px;
    height: 16px;
}

/* === Botones Guardar / Cancelar unificados === */
.btn-save,
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1.25rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: .85rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-save svg,
.btn-cancel svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Guardar: pill azul institucional */
.btn-save {
    border: none;
    color: #fff;
    letter-spacing: .03em;
    background: linear-gradient(180deg, #3B82F6 0%, #1d4ed8 100%);
    box-shadow:
        0 6px 14px rgba(59, 130, 246, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-save:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 10px 20px rgba(59, 130, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: brightness(1.04);
}

.btn-save:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(.97);
}

.btn-save:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(.15);
}

/* Cancelar: outline neutro */
.btn-cancel {
    background: transparent;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    box-shadow: none;
}

.btn-cancel:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
}

.btn-cancel:active:not(:disabled) {
    background: #f1f5f9;
}

.btn-cancel:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Variante compacta para barras pequeñas */
.btn-save--sm,
.btn-cancel--sm {
    font-size: .78rem;
    padding: .45rem 1rem;
}

.btn-create--sm svg,
.btn-save--sm svg,
.btn-cancel--sm svg {
    width: 14px;
    height: 14px;
}

.exped-detail-act-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: -.15rem 0 .75rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}

.exped-detail-act-form-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.exped-detail-act-form-close {
    width: auto;
    min-width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    border-radius: .5rem;
    cursor: pointer;
    transition: all .16s ease;
}

.exped-detail-act-form-close:hover {
    color: #111827;
    border-color: #cbd5e1;
    background: #f8fafc;
}

.exped-detail-btn-cancel {
    flex-shrink: 0;
    min-height: 2.35rem;
    padding: .45rem .9rem;
    border-radius: .5rem;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    font-weight: 600;
}

.exped-detail-btn-cancel:hover {
    background: #ffe4e6;
    border-color: #fda4af;
    color: #991b1b;
}

.exped-detail-act-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: flex-end;
    align-items: center;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.exped-detail-act-form-actions .btn {
    width: auto;
}

.exped-detail-act-form-actions .exped-detail-btn-secondary {
    min-height: 2.35rem;
    padding: .45rem .95rem;
    border-radius: .5rem;
    margin-right: auto;
}

.exped-detail-act-form-actions .exped-detail-btn-save {
    min-height: 2.35rem;
    padding: .45rem 1.15rem;
    border-radius: .5rem;
}

.exped-detail-act-form {
    border: 1px solid var(--border);
    border-radius: .7rem;
    padding: .85rem;
    margin-bottom: .9rem;
    background: #fbfdff;
}

.exped-detail-act-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem .9rem;
    margin-bottom: .65rem;
}

.exped-detail-label {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: .35rem;
}

.exped-detail-textarea {
    min-height: 92px;
    resize: vertical;
    margin-bottom: .65rem;
}

.exped-detail-inline-error {
    margin-bottom: .55rem;
    border-radius: .5rem;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: .5rem .65rem;
    font-size: .82rem;
}

.exped-detail-status-boletin-warn {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin: .65rem 0;
    padding: .55rem .65rem;
    border-radius: .5rem;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: .82rem;
    line-height: 1.45;
}

.exped-detail-status-boletin-warn svg {
    flex: 0 0 15px;
    margin-top: 1px;
}

.exped-detail-preview {
    margin: .5rem 0;
}

.exped-detail-preview.is-updated {
    padding: .5rem .65rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: .5rem;
}

.exped-detail-deadline-card {
    margin: .5rem 0;
    border: 1px solid #dbe7f5;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
    border-radius: .6rem;
    padding: .6rem .75rem;
}

.exped-detail-deadline-card.is-updated {
    border-color: #bfdbfe;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08) inset;
}

.exped-detail-deadline-title {
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    margin-bottom: .2rem;
}

.exped-detail-deadline-main {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: .35rem;
}

.exped-detail-deadline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    font-size: .82rem;
    color: #334155;
}

.exped-detail-deadline-note {
    margin-top: .35rem;
    font-size: .8rem;
    color: #64748b;
}

.exped-detail-preview-loading {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: .2rem 0 .5rem;
    color: var(--muted);
    font-size: .82rem;
}

.exped-detail-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid #cbd5e1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.exped-detail-history-table-wrap {
    overflow-x: auto;
}

.exped-detail-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}

.exped-detail-history-table th,
.exped-detail-history-table td {
    text-align: left;
    vertical-align: top;
    padding: .55rem .5rem;
    border-bottom: 1px solid var(--border);
}

.exped-detail-history-table th {
    color: var(--muted);
    font-size: .77rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.exped-detail-act-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
}

.exped-detail-act-row:last-child {
    border-bottom: none;
}

.exped-detail-act-date {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 600;
}

.exped-detail-act-date-sub {
    font-size: .72rem;
    font-weight: 500;
    margin-top: .15rem;
}

.exped-detail-act-synthesis-row {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
}

.exped-detail-act-source {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    margin-top: .1rem;
    cursor: help;
}

.exped-detail-act-source.is-boletin {
    background: #e0f2fe;
    color: #0369a1;
}

.exped-detail-act-source.is-manual {
    background: #fef3c7;
    color: #b45309;
}

.exped-detail-act-synthesis {
    font-size: .9rem;
    color: var(--text);
}

.exped-detail-act-meta {
    font-size: .78rem;
    margin-top: .25rem;
}

.exped-detail-task-card {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    padding: .8rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: .7rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    margin-bottom: .55rem;
}

.exped-detail-task-card:last-of-type {
    margin-bottom: 0;
}

.exped-detail-task-card--closed {
    opacity: .92;
    background: #fafbfc;
}

.exped-detail-task-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 .85rem;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.exped-detail-task-toolbar .exped-detail-task-subtabs {
    border-bottom: none;
    margin: 0;
}

.exped-detail-btn-new-task {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    font-size: .82rem;
    margin-bottom: .35rem;
}

.exped-detail-task-subtabs {
    display: flex;
    gap: .35rem;
    margin: 0 0 .85rem;
    padding: 0;
    border-bottom: 1px solid #e2e8f0;
}

.exped-detail-task-subtab {
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: .82rem;
    padding: .45rem .75rem .6rem;
    cursor: pointer;
    border-radius: .4rem .4rem 0 0;
    margin-bottom: -1px;
}

.exped-detail-task-subtab:hover {
    color: var(--text);
    background: rgba(30, 41, 59, 0.04);
}

.exped-detail-task-subtab.is-active {
    color: var(--color-institutional);
    box-shadow: inset 0 -2px 0 var(--color-institutional);
}

.exped-detail-task-loading {
    margin: .35rem 0 .75rem;
}

.exped-detail-task-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .65rem;
    margin-top: .4rem;
    font-size: .78rem;
}

.exped-detail-task-status {
    display: inline-block;
    font-weight: 700;
    padding: .12rem .4rem;
    border-radius: .3rem;
    font-size: .72rem;
    letter-spacing: .01em;
}

.exped-detail-task-status--pending {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.exped-detail-task-status--progress {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
}

.exped-detail-task-status--done {
    background: rgba(22, 163, 74, 0.14);
    color: #15803d;
}

.exped-detail-task-status--cancelled {
    background: rgba(71, 85, 105, 0.14);
    color: #475569;
}

.exped-detail-task-status--overdue {
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
}

.exped-detail-task-cierre {
    font-size: .75rem;
}

.exped-detail-task-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .55rem;
}

.exped-detail-task-action {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    border-radius: .45rem;
    padding: .25rem .55rem;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.exped-detail-task-action:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text);
}

.exped-detail-task-action:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.exped-detail-task-action--ok {
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.4);
}

.exped-detail-task-action--ok:hover:not(:disabled) {
    background: rgba(22, 163, 74, 0.08);
    border-color: #16a34a;
    color: #166534;
}

.exped-detail-task-action--danger {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.4);
}

.exped-detail-task-action--danger:hover:not(:disabled) {
    background: rgba(185, 28, 28, 0.08);
    border-color: #b91c1c;
    color: #991b1b;
}

.exped-detail-task-main {
    flex: 1;
    min-width: 0;
    padding-right: .35rem;
}

.exped-detail-task-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--text);
}

.exped-detail-task-assignee {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    margin-top: .3rem;
}

.exped-detail-task-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: .5rem;
    flex-shrink: 0;
    text-align: right;
    padding-left: .25rem;
}

.exped-detail-priority {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    padding: .18rem .45rem;
    border-radius: .35rem;
}

.exped-detail-priority--critical {
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
}

.exped-detail-priority--high {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
}

.exped-detail-priority--medium {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.exped-detail-priority--low {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.exped-detail-due {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    margin-top: .35rem;
    font-weight: 600;
    color: var(--muted);
}

.exped-detail-task-aside .exped-detail-due {
    margin-top: 0;
}

.exped-detail-due--neutral {
    color: #94a3b8;
    font-weight: 500;
}

.exped-detail-due--urgent {
    color: #c2410c;
}

.exped-detail-due--soon {
    color: var(--color-gold-matte);
}

.exped-detail-new-task {
    width: 100%;
    margin-top: 1rem;
    padding: .75rem;
    border: 2px dashed #cbd5e1;
    border-radius: .65rem;
    background: transparent;
    color: var(--color-institutional);
    font-weight: 600;
    font-size: .88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.exped-detail-new-task:hover {
    background: rgba(30, 41, 59, 0.04);
    border-color: var(--color-institutional);
}

.exped-detail-new-task:disabled {
    cursor: not-allowed;
    opacity: .65;
}

.exped-detail-task-form {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: .7rem;
    background: #fff;
    padding: .95rem 1rem 1.05rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.exped-detail-task-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem .85rem;
    margin-bottom: .65rem;
}

@media (max-width: 640px) {
    .exped-detail-task-form-grid {
        grid-template-columns: 1fr;
    }
}

.exped-detail-task-empty {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: .65rem;
    padding: .65rem .8rem;
}

.exped-detail-doc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .65rem .25rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.exped-detail-doc-row:last-child {
    border-bottom: none;
}

.exped-detail-doc-main {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
    flex: 1;
}

.exped-detail-doc-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-doc-meta {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.exped-detail-doc-actions {
    flex-shrink: 0;
}

.exped-detail-doc-badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    text-transform: uppercase;
}

.exped-detail-doc-row.is-archived .exped-detail-doc-name {
    color: #6b7280;
}

.exped-detail-error-inline {
    margin-top: .75rem;
    padding: .5rem .75rem;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: .85rem;
}

.exped-detail-doc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* ============================================================
   Lista compacta de documentos (vista densa)
   ============================================================ */
.exped-detail-doc-list {
    list-style: none;
    margin: .5rem 0 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.exped-detail-doc-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: .85rem;
    padding: .55rem .85rem;
    border-bottom: 1px solid #eef2f7;
    transition: background .12s ease;
}

.exped-detail-doc-row:last-child {
    border-bottom: none;
}

.exped-detail-doc-row:hover {
    background: #f8fafc;
}

.exped-detail-doc-row.is-archived {
    background: #fbfaf6;
}

.exped-detail-doc-row.is-archived:hover {
    background: #f6f3eb;
}

.exped-detail-doc-row-thumb {
    width: 44px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.exped-detail-doc-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.exped-detail-doc-row-thumb-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #94a3b8;
}

.exped-detail-doc-row-thumb-fallback svg {
    width: 22px;
    height: 22px;
}

.exped-detail-doc-row-thumb-fallback span {
    font-size: .56rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #475569;
    text-transform: uppercase;
}

.exped-detail-doc-row-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exped-detail-doc-row-name {
    margin: 0;
    font-weight: 600;
    color: #111827;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-doc-row-filename {
    margin: 0;
    font-size: .72rem;
    color: #94a3b8;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-doc-row-desc {
    margin: 0;
    font-size: .76rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-doc-row-meta {
    margin: 0;
    font-size: .76rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

.exped-detail-doc-row-meta .dot {
    color: #cbd5e1;
}

.exped-detail-doc-pill {
    padding: .05rem .45rem;
    border-radius: 999px;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.4;
}

.exped-detail-doc-pill.is-cold {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.exped-detail-doc-pill.is-fast {
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.exped-detail-doc-row-actions {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
}

.exped-detail-doc-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #475569;
    cursor: pointer;
    padding: 0;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.exped-detail-doc-icon-btn:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
}

.exped-detail-doc-icon-btn:disabled {
    opacity: .55;
    cursor: wait;
}

.exped-detail-doc-icon-btn svg {
    width: 18px;
    height: 18px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   Sub-pestañas Documentos / Papelera
   ============================================================ */
.exped-detail-doc-subtabs {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.exped-detail-doc-subtab {
    background: transparent;
    border: 0;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: background .12s ease, color .12s ease;
}

.exped-detail-doc-subtab:hover {
    color: #0f172a;
}

.exped-detail-doc-subtab.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.exped-detail-doc-subtab-icon {
    width: 14px;
    height: 14px;
}

.exped-detail-doc-subtab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: #e2e8f0;
    color: #334155;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
}

.exped-detail-doc-subtab.is-active .exped-detail-doc-subtab-count {
    background: #cbd5e1;
}

.exped-detail-doc-subtab-count.is-warn {
    background: #fef3c7;
    color: #92400e;
}

/* ============================================================
   Kebab menu
   ============================================================ */
.exped-detail-doc-kebab-wrap {
    position: relative;
}

.exped-detail-doc-kebab-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: transparent;
}

.exped-detail-doc-kebab-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
    padding: 4px;
    z-index: 50;
    animation: kebabFadeIn .12s ease;
}

@keyframes kebabFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.exped-detail-doc-kebab-item {
    width: 100%;
    background: transparent;
    border: 0;
    padding: .5rem .65rem;
    text-align: left;
    font-size: .82rem;
    color: #334155;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: .55rem;
    transition: background .1s ease;
}

.exped-detail-doc-kebab-item:hover {
    background: #f1f5f9;
}

.exped-detail-doc-kebab-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #64748b;
}

.exped-detail-doc-kebab-item.is-danger {
    color: #b91c1c;
}

.exped-detail-doc-kebab-item.is-danger svg {
    color: #b91c1c;
}

.exped-detail-doc-kebab-item.is-danger:hover {
    background: #fef2f2;
}

.exped-detail-doc-kebab-sep {
    height: 1px;
    background: #eef2f7;
    margin: 4px 0;
}

.exped-detail-doc-icon-btn.is-danger:hover {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

/* ============================================================
   Papelera
   ============================================================ */
.exped-detail-doc-trash-info {
    margin: .25rem 0 .65rem;
    padding: .55rem .75rem;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 8px;
    color: #92400e;
    font-size: .82rem;
}

.exped-detail-doc-trash-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: #94a3b8;
}

.exped-detail-doc-trash-empty svg {
    width: 56px;
    height: 56px;
    margin-bottom: .75rem;
    color: #cbd5e1;
}

.exped-detail-doc-trash-empty p {
    margin: .25rem 0;
    font-size: .9rem;
    color: #475569;
}

.exped-detail-doc-list.is-trash .exped-detail-doc-row {
    background: #fafaf9;
}

.exped-detail-doc-list.is-trash .exped-detail-doc-row-thumb {
    opacity: .65;
    filter: grayscale(.4);
}

.exped-detail-doc-row.is-deleted .exped-detail-doc-row-name {
    color: #64748b;
}

/* ============================================================
   Modales de confirmación (eliminar / purgar / editar)
   ============================================================ */
.exped-detail-confirm-modal {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .35);
    animation: slideUpModal .18s ease;
}

.exped-detail-confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
}

.exped-detail-confirm-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.exped-detail-confirm-header.is-danger {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}

.exped-detail-confirm-header.is-danger h3 {
    color: #b91c1c;
}

.exped-detail-confirm-header .exped-detail-preview-iconbtn {
    color: #64748b;
}

.exped-detail-confirm-header .exped-detail-preview-iconbtn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.exped-detail-confirm-header.is-danger .exped-detail-preview-iconbtn:hover {
    background: #fee2e2;
    color: #991b1b;
}

.exped-detail-confirm-body {
    padding: 1rem 1.1rem;
    overflow-y: auto;
    color: #334155;
    font-size: .88rem;
    line-height: 1.5;
}

.exped-detail-confirm-body p {
    margin: 0 0 .65rem;
}

.exped-detail-confirm-doc {
    margin: .4rem 0 .85rem;
    padding: .55rem .75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.exped-detail-confirm-doc-name {
    margin: 0;
    font-weight: 600;
    color: #0f172a;
    font-size: .9rem;
}

.exped-detail-confirm-doc-meta {
    margin: 2px 0 0;
    font-size: .76rem;
    color: #64748b;
}

.exped-detail-confirm-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: .55rem .75rem;
    border-radius: 8px;
    font-size: .85rem;
}

.exped-detail-confirm-hint {
    font-size: .78rem;
    margin-top: -.25rem;
}

.exped-detail-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .8rem 1.1rem;
    border-top: 1px solid #eef2f7;
    background: #fafbfc;
}

/* Campos de formulario dentro de los modales de confirmación / edición */
.exped-detail-confirm-body .field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .85rem;
    font-size: .85rem;
    color: #334155;
}

.exped-detail-confirm-body .field:last-child {
    margin-bottom: 0;
}

.exped-detail-confirm-body .field > span {
    font-weight: 600;
    color: #1f2937;
    font-size: .8rem;
}

.exped-detail-confirm-body .field input[type="text"],
.exped-detail-confirm-body .field input[type="number"],
.exped-detail-confirm-body .field select,
.exped-detail-confirm-body .field textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .55rem .7rem;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    color: #111827;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.exped-detail-confirm-body .field textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.4;
}

.exped-detail-confirm-body .field input:hover,
.exped-detail-confirm-body .field select:hover,
.exped-detail-confirm-body .field textarea:hover {
    border-color: #94a3b8;
}

.exped-detail-confirm-body .field input:focus,
.exped-detail-confirm-body .field select:focus,
.exped-detail-confirm-body .field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    background: #fff;
}

.exped-detail-confirm-body .field input::placeholder,
.exped-detail-confirm-body .field textarea::placeholder {
    color: #94a3b8;
}

.exped-detail-confirm-body .field-wide {
    width: 100%;
}

.exped-detail-confirm-body .field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .6rem center;
    background-size: 14px;
    padding-right: 2rem;
    cursor: pointer;
}

.exped-detail-confirm-body .field .required {
    color: #dc2626;
    margin-left: 2px;
}

.required {
    color: #dc2626;
}

/* Botones rojo (peligro) coherentes con btn-save/btn-cancel */
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
    border-radius: 8px;
    padding: .5rem 1rem;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    transition: background .15s ease, border-color .15s ease;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-danger:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-danger--sm {
    padding: .4rem .75rem;
    font-size: .82rem;
}

.btn-danger svg,
.btn-danger--sm svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* ============================================================
   Modal de vista previa de documentos
   ============================================================ */
.exped-detail-preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeInBackdrop .15s ease;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.exped-detail-preview-modal {
    background: #1e293b;
    border-radius: 10px;
    width: 100%;
    max-width: 1100px;
    height: calc(100vh - 3rem);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .35);
    animation: slideUpModal .18s ease;
}

@keyframes slideUpModal {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.exped-detail-preview-modal.is-image {
    background: #0f172a;
}

.exped-detail-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1rem;
    background: #1e293b;
    color: #f1f5f9;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.exped-detail-preview-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.exped-detail-preview-name {
    margin: 0;
    font-weight: 600;
    font-size: .92rem;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-preview-meta {
    margin: 0;
    font-size: .74rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
}

.exped-detail-preview-meta .dot {
    color: #475569;
}

.exped-detail-preview-filename {
    font-style: italic;
    color: #cbd5e1;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: bottom;
}

.exped-detail-preview-desc {
    margin: 2px 0 0;
    font-size: .76rem;
    color: #cbd5e1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exped-detail-preview-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
}

.exped-detail-preview-iconbtn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.exped-detail-preview-iconbtn:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .12);
    color: #f8fafc;
}

.exped-detail-preview-iconbtn.is-close:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.exped-detail-preview-iconbtn svg {
    width: 18px;
    height: 18px;
}

.exped-detail-preview-body {
    flex: 1;
    min-height: 0;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.exped-detail-preview-modal.is-image .exped-detail-preview-body {
    background: #0b1220;
}

.exped-detail-preview-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.exped-detail-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .35);
}

.exped-detail-preview-loading {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #cbd5e1;
    font-size: .9rem;
}

@media (max-width: 720px) {
    .exped-detail-preview-backdrop {
        padding: 0;
        align-items: stretch;
    }
    .exped-detail-preview-modal {
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        max-width: none;
    }
    .exped-detail-preview-header {
        flex-wrap: wrap;
        row-gap: .5rem;
        padding: calc(.65rem + env(safe-area-inset-top, 0px)) .75rem .65rem;
    }
    .exped-detail-preview-title {
        flex: 1 1 auto;
        min-width: 0;
    }
    .exped-detail-preview-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .exped-detail-preview-filename {
        max-width: 100%;
    }
    .exped-detail-preview-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .exped-detail-doc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .exped-detail-doc-toolbar .btn-create,
    .exped-detail-doc-toolbar .btn-create--sm {
        width: 100%;
        justify-content: center;
    }
    .exped-detail-doc-subtabs {
        width: 100%;
        justify-content: stretch;
    }
    .exped-detail-doc-subtab {
        flex: 1 1 auto;
        justify-content: center;
    }
    .exped-detail-doc-row {
        grid-template-columns: 44px 1fr auto;
        gap: .6rem;
        padding: .5rem .65rem;
    }
    .exped-detail-doc-row-thumb {
        width: 36px;
        height: 46px;
    }
}

@media (max-width: 600px) {
    .exped-detail-doc-row {
        grid-template-columns: 48px minmax(0, 1fr);
        grid-template-rows: auto auto;
        align-items: start;
    }
    .exped-detail-doc-row-thumb {
        grid-column: 1;
        grid-row: 1;
        width: 48px;
        height: 60px;
    }
    .exped-detail-doc-row-info {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }
    .exped-detail-doc-row-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: .35rem;
        padding-top: .45rem;
        margin-top: .15rem;
        border-top: 1px solid #eef2f7;
    }
    .exped-detail-doc-icon-btn {
        min-width: 40px;
        min-height: 40px;
    }
    .exped-detail-doc-form {
        padding: .85rem .75rem;
    }
    .exped-detail-doc-dropzone {
        padding: 1.35rem .85rem;
        min-height: 10.5rem;
    }
    .exped-detail-doc-dropzone-title {
        white-space: normal;
        line-height: 1.35;
        hyphens: auto;
    }
    .exped-detail-doc-dropzone-hint {
        max-width: none;
        white-space: normal;
    }
    .exped-detail-doc-row-name,
    .exped-detail-doc-row-filename,
    .exped-detail-doc-row-desc {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
    }
    .exped-detail-doc-row-meta {
        flex-wrap: wrap;
    }
}

.exped-detail-doc-form {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.exped-detail-doc-dropzone {
    position: relative;
    border: 2px dashed #cbd5e1;
    background: #fff;
    border-radius: 12px;
    padding: 1.75rem 1.25rem;
    text-align: center;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
    cursor: pointer;
}

.exped-detail-doc-dropzone:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.exped-detail-doc-dropzone.is-dragover {
    border-color: var(--accent, #2563eb);
    background: #eff6ff;
    transform: scale(1.005);
}

.exped-detail-doc-dropzone.is-busy {
    opacity: .65;
    pointer-events: none;
}

.exped-detail-doc-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
    color: transparent;
}

.exped-detail-doc-dropzone-input::file-selector-button {
    visibility: hidden;
    width: 0;
    padding: 0;
    border: 0;
}

.exped-detail-doc-dropzone-inner {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
}

.exped-detail-doc-dropzone-icon {
    width: 38px;
    height: 38px;
    color: #64748b;
    margin-bottom: .25rem;
}

.exped-detail-doc-dropzone.is-dragover .exped-detail-doc-dropzone-icon {
    color: var(--accent, #2563eb);
}

.exped-detail-doc-dropzone-title {
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.exped-detail-doc-dropzone-hint {
    font-size: .82rem;
    color: #64748b;
    margin: 0;
    max-width: 540px;
}

.exped-detail-doc-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem 1rem;
}

.exped-detail-doc-form-grid .field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .85rem;
    color: #334155;
}

.exped-detail-doc-form-grid .field input,
.exped-detail-doc-form-grid .field select,
.exped-detail-doc-form-grid .field textarea {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .5rem .65rem;
    font-size: .9rem;
    background: #fff;
    color: #111827;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.exped-detail-doc-form-grid .field input:focus,
.exped-detail-doc-form-grid .field select:focus,
.exped-detail-doc-form-grid .field textarea:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.exped-detail-doc-form-grid .field-wide {
    grid-column: 1 / -1;
}

.exped-detail-doc-saving-info {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    border-radius: 8px;
    padding: .55rem .75rem;
    font-size: .85rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.exped-detail-doc-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
}

@media (max-width: 640px) {
    .exped-detail-doc-form-grid {
        grid-template-columns: 1fr;
    }
}

.exped-detail-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

@media (max-width: 720px) {
    .exped-detail-meta-grid {
        grid-template-columns: 1fr;
    }
    .exped-detail-act-row {
        grid-template-columns: 1fr;
    }
    .exped-detail-act-grid {
        grid-template-columns: 1fr;
    }

    .exped-detail-panel.card,
    .exped-boletin-panel {
        padding: 0.85rem 0.75rem;
    }

    .exped-detail-act-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-detail-act-actions .exped-boletin-toggle,
    .exped-detail-act-actions .btn-create {
        width: 100%;
        justify-content: center;
    }

    .exped-boletin-panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-boletin-panel-head-text {
        min-width: 0;
    }

    .exped-boletin-panel-head-actions {
        width: 100%;
        justify-content: space-between;
    }

    .exped-boletin-linked-row {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-boletin-linked-meta {
        flex: 1 1 auto;
        width: 100%;
    }

    .exped-boletin-actions--end {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        flex-shrink: 1;
    }

    .exped-boletin-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-boletin-btn {
        width: 100%;
        white-space: normal;
        text-align: center;
        padding: 0.55rem 0.85rem;
    }

    .exped-boletin-form-footer {
        justify-content: stretch;
    }

    .exped-boletin-form-footer .exped-boletin-btn--link {
        width: 100%;
    }

    .exped-team-card {
        padding: 14px 12px;
    }

    .exped-team-header {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-team-header .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .exped-team-table-wrap {
        overflow-x: visible;
    }

    .exped-team-table thead {
        display: none;
    }

    .exped-team-table tbody tr {
        display: block;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 8px;
        background: #fff;
    }

    .exped-team-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .exped-team-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        padding: 5px 0;
        border-bottom: none;
    }

    .exped-team-table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: .68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: #64748b;
        padding-top: 2px;
    }

    .exped-team-table td[data-label="Usuario"] {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid #f1f5f9;
    }

    .exped-team-table td[data-label="Usuario"]::before {
        margin-bottom: 2px;
    }

    .exped-team-editor-row {
        flex-direction: column;
        align-items: stretch;
    }

    .exped-team-editor-row .input--sm {
        max-width: none;
        width: 100%;
    }
}

/* ============================================================
   Calendar page (/calendar/me)
   ============================================================ */

.text-display-upper {
    text-transform: uppercase;
}

.calendar-page-hero {
    margin-bottom: 1.25rem;
}

.calendar-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 1.25rem;
    align-items: start;
}

.calendar-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calendar-card--agenda {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(15, 23, 42, .06);
}

.calendar-card--subscribe {
    padding: 1rem 1.1rem;
    font-size: .92rem;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(15, 23, 42, .04);
}

.calendar-card-head {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}

.calendar-card-head--agenda {
    padding: 1.15rem 1.25rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #334155 100%);
    color: #f8fafc;
    margin: 0;
}

.calendar-card-head--agenda h3 {
    color: #fff;
    font-size: 1.15rem;
    margin: 0 0 .2rem;
}

.calendar-card-head--agenda .muted {
    color: rgba(248, 250, 252, .72);
    font-size: .84rem;
}

.calendar-card-head--subscribe h3 {
    margin: 0 0 .15rem;
    font-size: .95rem;
}

.calendar-card-head--subscribe .muted {
    margin: 0;
    font-size: .78rem;
    line-height: 1.35;
}

.calendar-card-head-icon {
    flex: 0 0 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.calendar-card-head-icon--subscribe {
    flex: 0 0 32px;
    height: 32px;
    border-radius: 8px;
    background: #eef2ff;
    color: #4338ca;
}

.calendar-card--agenda .calendar-filters {
    margin: 0 1.25rem;
}

.calendar-card--agenda .agenda-list,
.calendar-card--agenda .agenda-empty,
.calendar-card--agenda .empty-state-mini {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
    margin-bottom: 1.25rem;
}

.calendar-grid {
    align-items: start;
}

.calendar-card-head h3 {
    margin: 0 0 .25rem;
    font-size: 1.05rem;
}

.calendar-card-head .muted {
    margin: 0;
    font-size: .85rem;
    line-height: 1.45;
}

.calendar-url-label {
    display: block;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .35rem;
    font-weight: 600;
}

.calendar-url-row {
    display: flex;
    gap: .5rem;
    align-items: stretch;
}

.calendar-url-input {
    flex: 1;
    font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
    font-size: .72rem;
    background: #f8fafc;
    color: var(--text);
    cursor: text;
    min-width: 0;
}

.calendar-url-hint {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    margin-top: .55rem;
    padding: .55rem .65rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: .78rem;
    color: #92400e;
    line-height: 1.4;
}

.calendar-url-hint svg {
    flex: 0 0 13px;
    margin-top: 1px;
}

.calendar-instructions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .35rem;
}

.calendar-instructions details {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.calendar-instructions summary {
    padding: .5rem .65rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .8rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .5rem;
    list-style: none;
}

.calendar-instructions summary::-webkit-details-marker {
    display: none;
}

.calendar-instructions summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--muted);
    font-size: .8rem;
    transition: transform .15s ease;
}

.calendar-instructions details[open] summary::after {
    transform: rotate(-180deg);
}

.calendar-instructions details[open] summary {
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.calendar-instructions ol {
    margin: 0;
    padding: .5rem 1.15rem .65rem;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text);
}

.calendar-instructions ol li + li {
    margin-top: .25rem;
}

.calendar-card-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .25rem;
    padding-top: .85rem;
    border-top: 1px dashed var(--border);
    flex-wrap: wrap;
}

.calendar-created-at {
    font-size: .78rem;
}

/* Filtros de rango */
.calendar-filters {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    padding: .35rem;
    background: #f1f5f9;
    border-radius: 10px;
    align-self: flex-start;
}

.calendar-filter {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
    padding: .4rem .8rem;
    border-radius: 7px;
    cursor: pointer;
    transition: all .15s ease;
}

.calendar-filter:hover {
    color: var(--text);
}

.calendar-filter.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

/* Agenda list */
.empty-state-mini {
    color: var(--muted);
    font-size: .88rem;
    padding: 1rem 0;
    text-align: center;
}

.agenda-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.agenda-empty svg {
    opacity: .5;
    margin-bottom: .35rem;
}

.agenda-empty p {
    margin: 0;
    font-size: .88rem;
}

.agenda-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    max-height: 640px;
    overflow-y: auto;
    padding-right: .35rem;
}

.agenda-day-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .5rem;
}

.agenda-day-badge {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(145deg, #0f172a, #334155);
    color: #fff;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
}

.agenda-day-num {
    font-size: 1.05rem;
    font-weight: 700;
}

.agenda-day-mon {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .85;
    margin-top: 1px;
}

.agenda-day-name {
    font-size: .88rem;
    color: var(--text);
    font-weight: 600;
}

.agenda-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.agenda-item {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .65rem .85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    border-left-width: 4px;
    transition: box-shadow .15s ease, transform .15s ease;
}

.agenda-item:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, .07);
    transform: translateY(-1px);
}

.agenda-item--critical { border-left-color: #b91c1c; }
.agenda-item--high     { border-left-color: #b45309; }
.agenda-item--medium   { border-left-color: var(--gold); }
.agenda-item--low      { border-left-color: #15803d; }
.agenda-item--info     { border-left-color: #3b82f6; }

.agenda-kind {
    flex: 0 0 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.agenda-kind--deadline { background: #b91c1c; }
.agenda-kind--hearing  { background: #7c3aed; }
.agenda-kind--task     { background: #0f766e; }
.agenda-kind--default  { background: #64748b; }

.agenda-item-body {
    flex: 1;
    min-width: 0;
}

.agenda-item-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-item-meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--muted);
    margin-top: .15rem;
}

.agenda-item-sep {
    opacity: .5;
}

.agenda-exp-link {
    color: var(--action);
    text-decoration: none;
    font-weight: 600;
}

.agenda-exp-link:hover {
    text-decoration: underline;
}

/* ============================================================
   Dashboard: widget "Mi agenda"
   ============================================================ */

.dash-empty-onboard {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 1rem;
}

.dash-empty-onboard h3 {
    margin: .75rem 0 .35rem;
}

.dash-empty-onboard svg {
    color: var(--gold);
    opacity: .85;
}

/* ============================================================
   Onboarding tour (D3)
   ============================================================ */

.onboard-root {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
}

.onboard-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
    pointer-events: auto;
}

.onboard-spotlight {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.52);
    z-index: 12001;
    pointer-events: none;
    transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}

.onboard-card {
    position: fixed;
    z-index: 12002;
    width: min(340px, calc(100vw - 24px));
    padding: 1.15rem 1.2rem 1rem;
    border-radius: var(--radius-md, 12px);
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
    pointer-events: auto;
    transition: top .2s ease, left .2s ease;
}

.onboard-card.is-centered {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
}

.onboard-progress {
    margin: 0 0 .35rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted, #64748b);
}

.onboard-title {
    margin: 0 0 .5rem;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--text, #0f172a);
}

.onboard-body {
    margin: 0 0 1rem;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--text-muted, #64748b);
}

.onboard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.onboard-actions-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

.onboard-actions-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    margin-left: auto;
}

.dash-hero-tour-btn {
    flex-shrink: 0;
    align-self: center;
}

.dash-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.dash-quick-actions--inline {
    justify-content: flex-start;
    margin: 0 0 1rem;
}

.dash-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.dash-quick-chip:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text);
}

.dash-quick-chip--warn {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.dash-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-recent-item {
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
}

.dash-recent-item:last-child {
    border-bottom: none;
}

.dash-recent-item:hover {
    background: #f8fafc;
    margin: 0 -.85rem;
    padding-left: .85rem;
    padding-right: .85rem;
    border-radius: .5rem;
}

.dash-recent-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .2rem;
}

.dash-recent-case {
    font-weight: 700;
    font-size: .88rem;
}

.dash-recent-title {
    font-size: .88rem;
    color: var(--text);
}

.dash-recent-meta {
    font-size: .8rem;
}

.dash-recent-deadline {
    color: #b45309;
    font-weight: 600;
}

.dash-agenda-panel {
    margin-bottom: 1rem;
}

.dash-panel-head--split {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-agenda-sub {
    margin: .15rem 0 0;
    font-size: .82rem;
}

.dash-panel-link--inline {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .85rem;
    margin-top: .2rem;
    text-decoration: none;
    color: var(--action);
    font-weight: 600;
}

.dash-panel-link--inline:hover {
    text-decoration: underline;
}

.dash-agenda-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--muted);
}

.dash-agenda-empty svg {
    opacity: .5;
    margin-bottom: .25rem;
}

.dash-agenda-empty p {
    margin: 0;
    font-size: .88rem;
}

.dash-agenda-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.dash-agenda-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .65rem .8rem;
    background: #fff;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 8px;
}

.dash-agenda-item--critical { border-left-color: #b91c1c; }
.dash-agenda-item--high     { border-left-color: #b45309; }
.dash-agenda-item--medium   { border-left-color: var(--gold); }
.dash-agenda-item--low      { border-left-color: #15803d; }
.dash-agenda-item--info     { border-left-color: #3b82f6; }

.dash-agenda-date {
    flex: 0 0 50px;
    text-align: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .3rem .25rem;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.dash-agenda-date-num {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.dash-agenda-date-mon {
    font-size: .7rem;
    color: var(--muted);
    letter-spacing: .04em;
    margin-top: .15rem;
}

.dash-agenda-body {
    flex: 1;
    min-width: 0;
}

.dash-agenda-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-agenda-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    color: var(--muted);
    margin-top: .2rem;
    flex-wrap: wrap;
}

.dash-agenda-kind {
    display: inline-flex;
    align-items: center;
    padding: .12rem .45rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dash-agenda-kind--deadline {
    background: #fef2f2;
    color: #b91c1c;
}

.dash-agenda-kind--hearing {
    background: #f5f3ff;
    color: #6d28d9;
}

.dash-agenda-kind--task {
    background: #ecfeff;
    color: #0e7490;
}

.dash-agenda-kind--default {
    background: #f1f5f9;
    color: var(--muted);
}

.dash-agenda-exp {
    color: var(--action);
    text-decoration: none;
    font-weight: 600;
}

.dash-agenda-exp:hover {
    text-decoration: underline;
}

.agenda-item-time {
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 960px) {
    .calendar-page-layout {
        grid-template-columns: 1fr;
    }

    .calendar-card--subscribe {
        order: 2;
    }
}

@media (max-width: 900px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dash-agenda-item {
        flex-wrap: wrap;
    }
    .agenda-list {
        max-height: none;
    }
}

/* ============================================================
   Cliente: barra de acciones y menú de cambio de estado
   ============================================================ */

.client-tab-badge {
    font-size: .7rem;
    margin-left: .35rem;
    padding: .1rem .4rem;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.08);
}

.client-doc-exped-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent, #2563eb);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}


.client-person-type-row {
    margin-bottom: 1rem;
}
.client-person-type-label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .45rem;
}
.client-person-type-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.client-person-pill {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .12rem .45rem;
    border-radius: 999px;
}
.client-person-pill--fisica {
    background: rgba(14, 116, 144, 0.12);
    color: #0e7490;
}
.client-person-pill--moral {
    background: rgba(79, 70, 229, 0.12);
    color: #4338ca;
}
.clients-name-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
    margin-top: .2rem;
}

.client-doc-exped-link:hover {
    color: var(--accent-hover, #1d4ed8);
}

.client-doc-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 1rem;
    align-items: stretch;
    min-height: 28rem;
}

.client-doc-split-list {
    min-height: 0;
    max-height: 32rem;
    overflow: auto;
    border: 1px solid rgba(30, 41, 59, 0.08);
    border-radius: var(--radius-md, 10px);
    padding: .35rem;
}

.client-doc-split-viewer {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid rgba(30, 41, 59, 0.08);
    border-radius: var(--radius-md, 10px);
    background: rgba(248, 250, 252, 0.65);
    overflow: hidden;
}

.client-doc-viewer-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--text-muted, #64748b);
}

.client-doc-viewer-empty p {
    margin: 0;
    font-size: .9rem;
}

.client-doc-viewer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.08);
    background: #fff;
}

.client-doc-viewer-name {
    margin: 0;
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.35;
}

.client-doc-viewer-exped {
    margin: .25rem 0 0;
    font-size: .82rem;
}

.client-doc-viewer-actions {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
}

.client-doc-viewer-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #f1f5f9;
}

.client-doc-viewer-iframe {
    width: 100%;
    height: 100%;
    min-height: 22rem;
    border: none;
    background: #fff;
}

.client-doc-split .exped-detail-doc-row.is-clickable {
    cursor: pointer;
}

.client-doc-split .exped-detail-doc-row.is-selected {
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius-sm, 8px);
}

@media (max-width: 960px) {
    .client-doc-split {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .client-doc-split-list {
        max-height: 16rem;
    }

    .client-doc-viewer-iframe {
        min-height: 18rem;
    }
}

.client-detail-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.client-detail-actions {
    display: flex;
    gap: .55rem;
    margin: .35rem 0 1.25rem;
    flex-wrap: wrap;
}

/* Botón secundario neutro: para cosas que no son guardar / no son peligrosas */
.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem .85rem;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-secondary:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-secondary svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Menú emergente de cambio de estado */
.client-status-menu-wrap {
    position: relative;
    display: inline-flex;
}

.client-status-menu-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    border: 0;
    z-index: 40;
    cursor: default;
}

.client-status-menu {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-strong);
    padding: .35rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.client-status-menu-item {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 7px;
    padding: .55rem .65rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    transition: background .12s ease;
}

.client-status-menu-item:hover {
    background: #f1f5f9;
}

.client-status-menu-item .muted {
    font-size: .78rem;
}

/* Pills de estado de cliente (las 4) — solo si no existían ya */
/* Toolbar de /clients: misma estética que /expedients */
.clients-toolbar {
    margin-bottom: 1rem;
}

.clients-search-wrap {
    position: relative;
    margin-bottom: .75rem;
}

.clients-search-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.clients-search-input {
    padding-left: 2.5rem !important;
    width: 100%;
    max-width: 100%;
}

.clients-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.clients-status-pill {
    display: inline-flex;
    align-items: center;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.clients-status-pill--active   { background: #dcfce7; color: #15803d; }
.clients-status-pill--inactive { background: #f1f5f9; color: #475569; }
.clients-status-pill--prospect { background: #fef3c7; color: #92400e; }
.clients-status-pill--archived { background: #fee2e2; color: #991b1b; }

.clients-taxid-pill {
    display: inline-flex;
    align-items: center;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    background: #f1f5f9;
    color: var(--muted);
    font-weight: 600;
}

/* ============================================================
   Nuevo expediente / formularios largos
   ============================================================ */
.exped-new-wrap {
    max-width: 980px;
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}

.exped-new-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.exped-new-eyebrow {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .72rem;
    font-weight: 600;
    margin: 0 0 .25rem;
}

.exped-new-card {
    padding: 0;
    overflow: hidden;
}

.exped-new-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: 1rem 1.6rem;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    align-items: center;
}

.exped-new-step {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .8rem;
    font-weight: 600;
    color: #94a3b8;
}

.exped-new-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #64748b;
}

.exped-new-step.is-active {
    color: #0f172a;
}

.exped-new-step.is-active .exped-new-step-num {
    background: var(--primary, #1e40af);
    color: #fff;
}

.exped-new-step.is-done {
    color: #334155;
}

.exped-new-step.is-done .exped-new-step-num {
    background: #cbd5e1;
    color: #1e293b;
}

.exped-new-summary {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: .88rem;
    line-height: 1.55;
}

.exped-new-summary dt {
    margin: 0;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
}

.exped-new-summary dd {
    margin: 0 0 .65rem;
    color: #0f172a;
}

.exped-new-summary dd:last-child {
    margin-bottom: 0;
}

.exped-assign-readonly {
    background: #f8fafc;
    color: #334155;
    cursor: default;
    user-select: none;
}

.exped-new-section {
    padding: 1.4rem 1.6rem;
    border-bottom: 1px solid #eef2f7;
}

.exped-new-section:last-of-type {
    border-bottom: 0;
}

.exped-new-section-title {
    font-size: .82rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 1rem;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
    margin-bottom: 1rem;
}

.field-row:last-child {
    margin-bottom: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1rem;
}

.field-row .field {
    margin-bottom: 0;
}

/* Una sola columna de ancho completo dentro de grillas de dos columnas */
.field-row .field-wide {
    grid-column: 1 / -1;
}

.field > label {
    font-size: .78rem;
    font-weight: 600;
    color: #334155;
    letter-spacing: .01em;
}

.field small.muted {
    font-size: .72rem;
}

.field small a {
    color: var(--primary, #1e40af);
    text-decoration: none;
    font-weight: 600;
}

.field small a:hover {
    text-decoration: underline;
}

.exped-new-inline-error {
    margin: 1rem 1.6rem 0;
}

.exped-new-duplicate-banner {
    margin: 0 1.6rem 1rem;
    padding: .85rem 1rem;
    border-radius: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: .86rem;
    color: #78350f;
}

.exped-new-duplicate-banner ul {
    margin: .35rem 0 .35rem 1.1rem;
    padding: 0;
}

.exped-new-duplicate-banner a {
    color: #92400e;
    font-weight: 600;
    text-decoration: none;
}

.exped-new-duplicate-banner a:hover {
    text-decoration: underline;
}

.exped-new-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    padding: 1rem 1.6rem 1.2rem;
    background: #fafbfd;
    border-top: 1px solid #eef2f7;
}

.exped-new-actions-spacer {
    flex: 1;
    min-width: .5rem;
}

@media (max-width: 720px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .exped-new-head {
        flex-direction: column;
    }
}

/* ============================================================
   Topbar: botón de búsqueda global (Ctrl+K)
   ============================================================ */
.topbar-search-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-width: 11rem;
    max-width: 22rem;
    flex: 1 1 auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: .42rem .85rem .42rem .65rem;
    font-size: .82rem;
    color: #64748b;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    line-height: 1;
}

.topbar-search-btn:hover {
    background: #fff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.topbar-search-btn svg {
    flex-shrink: 0;
}

.topbar-search-label {
    font-weight: 500;
}

.topbar-search-kbd {
    display: inline-flex;
    gap: 2px;
    margin-left: .25rem;
}

.topbar-search-kbd kbd {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .68rem;
    padding: 1px 5px;
    color: #475569;
    line-height: 1;
}

@media (max-width: 720px) {
    .topbar-search-label,
    .topbar-search-kbd {
        display: none;
    }
    .topbar-search-btn {
        padding: .42rem;
    }
}

/* ============================================================
   Global Search Palette (Cmd+K)
   ============================================================ */
.gsp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1300;
    animation: gspFade .12s ease;
}

@keyframes gspFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gsp-modal {
    position: fixed;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1310;
    width: min(640px, calc(100vw - 2rem));
    max-height: 70vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: gspSlide .15s ease;
}

@keyframes gspSlide {
    from { transform: translate(-50%, -8px); opacity: 0; }
    to   { transform: translate(-50%, 0);    opacity: 1; }
}

.gsp-input-wrap {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #eef2f7;
}

.gsp-input-icon {
    color: #94a3b8;
    line-height: 0;
}

.gsp-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 1rem;
    color: #0f172a;
    padding: 0;
}

.gsp-input::placeholder {
    color: #94a3b8;
}

.gsp-input-hint {
    background: #f1f5f9;
    color: #64748b;
    font-size: .7rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.gsp-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--color-gold-matte, #c8a04c);
    border-radius: 50%;
    animation: gspSpin .7s linear infinite;
}

@keyframes gspSpin {
    to { transform: rotate(360deg); }
}

.gsp-results {
    flex: 1;
    overflow-y: auto;
    padding: .35rem 0;
}

/* tips */
.gsp-tips {
    padding: 1.25rem;
    color: #475569;
}

.gsp-tips h4 {
    margin: 0 0 .65rem;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.gsp-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    font-size: .87rem;
}

.gsp-tips-list em {
    background: #f1f5f9;
    color: #0f172a;
    padding: 1px 6px;
    border-radius: 4px;
    font-style: normal;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8rem;
}

.gsp-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    margin-right: .55rem;
    vertical-align: middle;
}

.gsp-tip-icon--exped  { background: #fef3c7; color: #92400e; }
.gsp-tip-icon--client { background: #dbeafe; color: #1d4ed8; }
.gsp-tip-icon--task   { background: #dcfce7; color: #15803d; }
.gsp-tip-icon--auth   { background: #ede9fe; color: #6d28d9; }

/* empty */
.gsp-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #94a3b8;
}

.gsp-empty p {
    margin: .55rem 0 .25rem;
    color: #475569;
}

/* grupos */
.gsp-group {
    padding: .25rem 0;
}

.gsp-group + .gsp-group {
    border-top: 1px solid #f1f5f9;
    margin-top: .35rem;
}

.gsp-group-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem .35rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.gsp-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
}

.gsp-group-icon--exped  { background: #fef3c7; color: #92400e; }
.gsp-group-icon--client { background: #dbeafe; color: #1d4ed8; }
.gsp-group-icon--task   { background: #dcfce7; color: #15803d; }
.gsp-group-icon--auth   { background: #ede9fe; color: #6d28d9; }

.gsp-group-title {
    font-weight: 700;
    color: #475569;
}

.gsp-group-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: .68rem;
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: auto;
}

/* hits */
.gsp-hit {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .55rem 1rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    border-radius: 0;
    transition: background .1s;
}

.gsp-hit:hover,
.gsp-hit.is-active {
    background: #f8fafc;
}

.gsp-hit.is-active {
    background: #f1f5f9;
}

.gsp-hit-main {
    min-width: 0;
}

.gsp-hit-title {
    font-size: .92rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gsp-hit-subtitle {
    font-size: .76rem;
    color: #64748b;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gsp-hit-detail {
    font-size: .72rem;
    color: #94a3b8;
    text-align: right;
    flex-shrink: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gsp-hit-go {
    color: #cbd5e1;
    line-height: 0;
}

.gsp-hit.is-active .gsp-hit-go {
    color: var(--color-gold-matte, #c8a04c);
}

.gsp-mark {
    background: #fef08a;
    color: #713f12;
    border-radius: 3px;
    padding: 0 1px;
}

.gsp-footer {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .55rem 1rem;
    background: #fafbfd;
    border-top: 1px solid #eef2f7;
    font-size: .72rem;
    color: #94a3b8;
}

.gsp-sep {
    color: #cbd5e1;
}

.gsp-kbd {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .7rem;
    padding: 1px 5px;
    color: #475569;
    line-height: 1;
}

@media (max-width: 720px) {
    .gsp-modal {
        top: 4vh;
        max-height: 88vh;
    }
    .gsp-hit-detail { display: none; }
}

/* ============================================================
   Página /tasks (rediseño: lista agrupada por urgencia)
   ============================================================ */
.tasks-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 900px) {
    .tasks-toolbar {
        grid-template-columns: minmax(280px, 1fr) auto;
        align-items: center;
    }
    .tasks-filters {
        grid-column: 1 / -1;
    }
}

.tasks-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tasks-search-icon {
    position: absolute;
    left: .75rem;
    color: #94a3b8;
    pointer-events: none;
    line-height: 0;
}

.tasks-search-input {
    width: 100%;
    padding-left: 2.35rem;
}

.tasks-scope-tabs {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.tasks-scope-tab {
    border: 0;
    background: transparent;
    padding: .42rem .9rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: background .15s, color .15s;
}

.tasks-scope-tab:hover {
    color: #0f172a;
}

.tasks-scope-tab.is-active {
    background: #fff;
    color: var(--color-midnight, #0f172a);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.tasks-scope-count {
    background: #e2e8f0;
    color: #475569;
    font-size: .7rem;
    padding: 1px 7px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
}

.tasks-scope-tab.is-active .tasks-scope-count {
    background: var(--color-gold-matte, #c8a04c);
    color: #fff;
}

.tasks-filters {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .25rem 0;
}

.tasks-filter-label {
    font-size: .72rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tasks-filter-select {
    width: auto;
    padding: .35rem .55rem;
    font-size: .82rem;
}

.tasks-filter-clear {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: .3rem .65rem;
    font-size: .72rem;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.tasks-filter-clear:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ----------------- empty state -------------------- */
.tasks-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 1rem !important;
    color: #94a3b8;
}

.tasks-empty h3 {
    margin: .5rem 0 .2rem;
    color: #475569;
    font-weight: 600;
}

/* ----------------- grupos por urgencia ------------ */
.tasks-group {
    margin-bottom: 1.25rem;
}

.tasks-group-head {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0 0 .55rem;
}

.tasks-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
}

.tasks-group-icon--overdue { background: #fee2e2; color: #b91c1c; }
.tasks-group-icon--today   { background: #fef3c7; color: #b45309; }
.tasks-group-icon--week    { background: #dbeafe; color: #1d4ed8; }
.tasks-group-icon--later   { background: #ede9fe; color: #6d28d9; }
.tasks-group-icon--none    { background: #f1f5f9; color: #64748b; }
.tasks-group-icon--done    { background: #dcfce7; color: #15803d; }

.tasks-group-title {
    margin: 0;
    font-size: .85rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tasks-group-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: .72rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
}

/* ----------------- task card ---------------------- */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.task-card {
    display: grid;
    grid-template-columns: 4px 1fr auto;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .05s;
}

.task-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px -6px rgba(15, 23, 42, .12);
}

.task-card:active {
    transform: translateY(1px);
}

.task-card--overdue {
    background: #fff7f7;
    border-color: #fecaca;
}

.task-card--done {
    opacity: .68;
}

.task-card--done .task-card-title {
    text-decoration: line-through;
    color: #64748b;
}

.task-card--cancelled {
    opacity: .55;
}

.task-card-side {
    width: 4px;
    background: #cbd5e1;
}

.task-card-side.task-priority--critical { background: #dc2626; }
.task-card-side.task-priority--high     { background: #ea580c; }
.task-card-side.task-priority--medium   { background: #d97706; }
.task-card-side.task-priority--low      { background: #94a3b8; }

.task-card-main {
    padding: .75rem 1rem;
    min-width: 0;
}

.task-card-row1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .35rem;
}

.task-priority-pill {
    display: inline-flex;
    align-items: center;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.task-priority-pill.task-priority--critical { background: #fee2e2; color: #991b1b; }
.task-priority-pill.task-priority--high     { background: #ffedd5; color: #9a3412; }
.task-priority-pill.task-priority--medium   { background: #fef3c7; color: #854d0e; }
.task-priority-pill.task-priority--low      { background: #e2e8f0; color: #475569; }

.task-due-pill {
    display: inline-flex;
    align-items: center;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
}

.task-due-pill--overdue   { background: #fee2e2; color: #b91c1c; }
.task-due-pill--today     { background: #fef3c7; color: #b45309; }
.task-due-pill--soon      { background: #fef9c3; color: #854d0e; }
.task-due-pill--later     { background: #dbeafe; color: #1d4ed8; }
.task-due-pill--none      { background: #f1f5f9; color: #64748b; }
.task-due-pill--done      { background: #dcfce7; color: #15803d; }
.task-due-pill--cancelled { background: #f1f5f9; color: #64748b; }

.task-status-pill {
    display: inline-flex;
    align-items: center;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.task-status-pill--done      { background: #dcfce7; color: #15803d; }
.task-status-pill--cancelled { background: #f1f5f9; color: #64748b; }
.task-status-pill--overdue   { background: #fee2e2; color: #b91c1c; }
.task-status-pill--progress  { background: #dbeafe; color: #1d4ed8; }
.task-status-pill--pending   { background: #fef3c7; color: #854d0e; }

.task-card-title {
    margin: 0 0 .25rem;
    font-size: .98rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.task-card-desc {
    margin: 0 0 .4rem;
    font-size: .85rem;
    color: #475569;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem;
    font-size: .78rem;
    color: #64748b;
}

.task-card-meta-sep {
    color: #cbd5e1;
}

.task-card-exped-link {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--color-midnight, #0f172a);
    font-weight: 600;
    font-size: .78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.task-card-exped-link:hover {
    text-decoration: underline;
}

.task-card-exped-link svg {
    color: #94a3b8;
}

.task-card-client {
    font-weight: 400;
    color: #64748b;
}

.task-card-no-exped {
    font-size: .78rem;
    font-style: italic;
}

.task-card-assignee {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.task-card-assignee svg {
    color: #94a3b8;
}

.task-card-done-at {
    font-size: .75rem;
}

.task-card-actions {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: 0 .75rem;
    border-left: 1px solid #f1f5f9;
}

.task-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s, color .15s;
}

.task-action:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.task-action--complete:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.task-action--cancel:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.task-action--reopen:hover:not(:disabled) {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

@media (max-width: 720px) {
    .task-card {
        grid-template-columns: 4px 1fr;
    }
    .task-card-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        padding: .5rem .75rem;
        border-left: 0;
        border-top: 1px solid #f1f5f9;
        background: #fafbfd;
    }
}

/* ============================================================
   Expedient status pills - agregamos Cancelled
   ============================================================ */
.expedients-status-pill--cancelled,
.client-status-pill--cancelled,
.exped-status-pill--cancelled {
    background: #fce7f3;
    color: #9d174d;
}

/* ============================================================
   Hero del detalle de expediente: zona de acciones (cambiar estado, etc.)
   ============================================================ */
.exped-detail-hero-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-shrink: 1;
    flex-wrap: wrap;
    max-width: calc(100% - 3rem);
    padding-right: .25rem;
}

.exped-detail-hero .btn-secondary {
    padding: .38rem .72rem;
    font-size: .8rem;
    font-weight: 600;
    border-radius: .5rem;
    gap: .35rem;
}

.exped-detail-hero .btn-secondary svg {
    width: 13px;
    height: 13px;
}

@media (min-width: 981px) {
    .exped-detail-hero-actions {
        margin-right: 2.75rem;
        max-width: min(28rem, 52%);
    }
}

/* ============================================================
   Modal genérico para confirmar cambio de estado del expediente
   ============================================================ */
.exped-detail-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1150;
    animation: fadeInBackdrop .15s ease;
}

.exped-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1160;
    background: #fff;
    border-radius: 12px;
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    animation: slideUpModal .18s ease;
}

.exped-detail-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef2f7;
}

.exped-detail-modal-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.exped-detail-modal-close {
    background: transparent;
    border: 0;
    color: #64748b;
    padding: .25rem;
    border-radius: 6px;
    cursor: pointer;
    line-height: 0;
}

.exped-detail-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.exped-detail-modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.exped-detail-modal-body .exped-detail-label {
    display: block;
    margin: .7rem 0 .3rem;
}

.exped-detail-modal-body textarea.input {
    width: 100%;
    resize: vertical;
}

.exped-detail-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .55rem;
    padding: .85rem 1.25rem;
    background: #fafbfd;
    border-top: 1px solid #eef2f7;
}

.exped-detail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
    flex-shrink: 0;
}

.exped-detail-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.exped-detail-modal-header.is-centered {
    position: relative;
    justify-content: center;
}

.exped-detail-modal-header.is-centered h3 {
    text-align: center;
    flex: 1;
    padding: 0 2.25rem;
}

.exped-detail-modal-header.is-centered .exped-detail-modal-close {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
}

.workspace-upload-modal .exped-detail-doc-dropzone {
    margin-top: .35rem;
}

.workspace-upload-modal .exped-detail-doc-dropzone-icon {
    width: 38px;
    height: 38px;
    color: #64748b;
}

/* ============================================================
   Notas internas (tab "Notas") y Bitácora (timeline unificado)
   ============================================================ */

/* ----- Composer ----- */
.notes-composer {
    background: linear-gradient(180deg, #fdfcf8 0%, #ffffff 100%);
    border: 1px solid #e6e3d8;
    border-radius: 14px;
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.notes-composer-input {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: .95rem;
    line-height: 1.45;
    color: #0f172a;
    padding: .25rem 0;
    outline: none;
    min-height: 1.7rem;
}

.notes-composer-input::placeholder {
    color: #94a3b8;
}

.notes-composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .6rem;
    padding-top: .55rem;
    border-top: 1px dashed #e6e3d8;
}

.notes-composer-hint {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #94a3b8;
    font-size: .75rem;
}

/* ----- Lista de notas ----- */
.notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.note-card {
    display: flex;
    gap: .75rem;
    background: #ffffff;
    border: 1px solid #eef0e9;
    border-radius: 12px;
    padding: .9rem 1rem;
    transition: border-color .15s, box-shadow .15s;
}

.note-card:hover {
    border-color: #d8d6c8;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .04);
}

.note-card.is-pinned {
    background: linear-gradient(180deg, #fffaf0 0%, #fffefb 100%);
    border-color: #e2c98a;
}

.note-avatar {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #b08a4d, #8c6a37);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .02em;
}

.note-body-wrap {
    flex: 1;
    min-width: 0;
}

.note-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}

.note-author {
    font-weight: 600;
    color: #0f172a;
    font-size: .9rem;
}

.note-time {
    color: #94a3b8;
    font-size: .78rem;
}

.note-edited {
    color: #94a3b8;
    font-size: .75rem;
    font-style: italic;
}

.note-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: #fff1d6;
    color: #8c6a37;
    border-radius: 999px;
    padding: .1rem .5rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.note-actions {
    margin-left: auto;
    display: inline-flex;
    gap: .2rem;
    opacity: 0;
    transition: opacity .15s;
}

.note-card:hover .note-actions,
.note-card:focus-within .note-actions {
    opacity: 1;
}

.note-action-btn {
    width: 1.8rem;
    height: 1.8rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}

.note-action-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #e2e8f0;
}

.note-action-btn--danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.note-action-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.note-body {
    color: #1e293b;
    font-size: .92rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.note-inline-tag {
    color: #8c6a37;
    background: #fff1d6;
    padding: 0 .35rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: .85em;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .55rem;
}

.note-tag {
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: .1rem .55rem;
    font-size: .72rem;
    font-weight: 500;
}

.note-edit-input {
    width: 100%;
    font-size: .92rem;
    line-height: 1.55;
}

.note-edit-actions {
    margin-top: .5rem;
    display: flex;
    justify-content: flex-end;
    gap: .4rem;
}

.notes-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
}

.notes-empty h4 {
    margin: .75rem 0 .35rem;
    color: #475569;
    font-weight: 600;
}

/* ----- Botones pequeños reutilizables ----- */
.btn-save--sm,
.btn-cancel--sm {
    padding: .35rem .75rem !important;
    font-size: .78rem !important;
    height: auto !important;
}

/* ============================================================
   Timeline unificado (tab "Bitácora")
   ============================================================ */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-day {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 1rem;
    align-items: start;
}

.timeline-day-head {
    text-align: right;
    padding-top: .2rem;
    border-right: 2px solid #eef0e9;
    padding-right: .85rem;
}

.timeline-day-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.timeline-day-mon {
    display: block;
    color: #94a3b8;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: .15rem;
}

.timeline-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.timeline-item {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}

.timeline-dot {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #e2e8f0;
    margin-top: .1rem;
}

.timeline-dot--note          { background: #fdf6e3; color: #8c6a37; box-shadow: 0 0 0 1px #e2c98a; }
.timeline-dot--actuation     { background: #ede9fe; color: #5b21b6; box-shadow: 0 0 0 1px #c4b5fd; }
.timeline-dot--status        { background: #dbeafe; color: #1d4ed8; box-shadow: 0 0 0 1px #93c5fd; }
.timeline-dot--auth          { background: #fce7f3; color: #9d174d; box-shadow: 0 0 0 1px #f9a8d4; }
.timeline-dot--task          { background: #fef3c7; color: #92400e; box-shadow: 0 0 0 1px #fcd34d; }
.timeline-dot--task-done     { background: #dcfce7; color: #166534; box-shadow: 0 0 0 1px #86efac; }

.timeline-content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #eef0e9;
    border-radius: 10px;
    padding: .65rem .9rem;
    transition: border-color .15s;
}

.timeline-content:hover {
    border-color: #d8d6c8;
}

.timeline-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
}

.timeline-title {
    font-weight: 600;
    color: #0f172a;
    font-size: .88rem;
}

.timeline-time {
    color: #94a3b8;
    font-size: .75rem;
    white-space: nowrap;
}

.timeline-body {
    margin: .35rem 0 0;
    color: #475569;
    font-size: .85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.timeline-actor {
    margin: .25rem 0 0;
    font-size: .75rem;
}

@media (max-width: 640px) {
    .timeline-day {
        grid-template-columns: 3.5rem 1fr;
        gap: .75rem;
    }
}

/* ============================================================
   Time tracking + Billing
   ============================================================ */

/* ----- Cronómetro ----- */
.time-timer-card {
    background: linear-gradient(180deg, #ffffff 0%, #fdfcf8 100%);
    border: 1px solid #e6e3d8;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
    transition: border-color .2s, box-shadow .2s;
}

.time-timer-card.is-running {
    background: linear-gradient(180deg, #fffaf0 0%, #fff7e0 100%);
    border-color: #e2c98a;
    box-shadow: 0 4px 16px rgba(176, 138, 77, .15);
}

.time-timer-clock {
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: .02em;
    line-height: 1;
}

.time-timer-card.is-running .time-timer-clock {
    color: #8c6a37;
}

.time-timer-meta {
    margin-top: .35rem;
    font-size: .85rem;
    display: flex;
    gap: .5rem;
    align-items: center;
}

.time-timer-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #166534;
    font-weight: 600;
    font-size: .82rem;
}

.time-timer-pulse {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
    50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.time-timer-fields {
    display: grid;
    grid-template-columns: 2fr 1.5fr auto;
    gap: .75rem;
    align-items: end;
}

.time-timer-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.btn-large {
    padding: .75rem 1.25rem !important;
    font-size: .95rem !important;
}

.btn-danger {
    background: linear-gradient(180deg, #ef4444, #b91c1c);
    color: #fff;
    border: 1px solid #991b1b;
    padding: .55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(180deg, #f87171, #dc2626);
}

@media (max-width: 900px) {
    .time-timer-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .time-timer-fields { grid-template-columns: 1fr; }
    .time-timer-actions { flex-direction: row; }
}

/* ----- Resumen ----- */
.time-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.time-summary-card {
    background: #fff;
    border: 1px solid #eef0e9;
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.time-summary-card.is-amount {
    background: linear-gradient(135deg, #fdf6e3, #fff);
    border-color: #e2c98a;
}

.time-summary-label {
    margin: 0;
    color: #94a3b8;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}

.time-summary-value {
    margin: .35rem 0 .15rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

.time-summary-card.is-amount .time-summary-value {
    color: #8c6a37;
}

@media (max-width: 700px) {
    .time-summary { grid-template-columns: 1fr; }
}

/* ----- Listado / tabla ----- */
.time-list-section { margin-top: 1rem; }

.time-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .75rem;
}

.time-list-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #0f172a;
    font-weight: 600;
}

.time-list-filters {
    display: inline-flex;
    align-items: end;
    gap: .5rem;
    flex-wrap: wrap;
}

.field-inline {
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
    font-size: .78rem;
    color: #64748b;
}

.input-sm {
    padding: .35rem .55rem !important;
    font-size: .85rem !important;
}

.time-table-wrap {
    overflow-x: auto;
    border: 1px solid #eef0e9;
    border-radius: 10px;
    background: #fff;
}

.time-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.time-table th {
    background: #fafbfd;
    text-align: left;
    padding: .65rem .85rem;
    font-weight: 600;
    color: #475569;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #eef0e9;
}

.time-table td {
    padding: .65rem .85rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.time-table tr:hover { background: #fdfcf8; }

.time-table .nowrap { white-space: nowrap; }
.time-table .text-right { text-align: right; }
.time-table .cursor-pointer { cursor: pointer; }

.time-row-actions {
    text-align: right;
    white-space: nowrap;
}

.time-row-actions .btn-icon {
    width: 1.85rem;
    height: 1.85rem;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: .2rem;
    transition: background .15s, color .15s;
}

.time-row-actions .btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.time-row-actions .btn-icon--danger:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ----- Pills de estado ----- */
.time-status-pill {
    display: inline-flex;
    align-items: center;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.time-status-pill.is-draft     { background: #f1f5f9; color: #475569; }
.time-status-pill.is-confirmed { background: #dbeafe; color: #1d4ed8; }
.time-status-pill.is-invoiced  { background: #fef3c7; color: #92400e; }
.time-status-pill.is-cancelled { background: #fee2e2; color: #b91c1c; }
.time-status-pill.is-paid      { background: #dcfce7; color: #166534; }

/* ----- Empty state ----- */
.time-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
}

.time-empty h4 {
    margin: .75rem 0 .35rem;
    color: #475569;
    font-weight: 600;
}

/* ----- Tarifas ----- */
.rates-section { margin-top: 1rem; }

.rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.rates-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #0f172a;
}

.is-past-row { opacity: .55; }
.is-active-row { background: #fdfcf8; }

/* ----- Invoices ----- */
.invoices-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
}

.invoices-filters {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
}

.invoice-detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.invoice-detail-actions {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.invoice-new-card {
    background: #fff;
    border: 1px solid #eef0e9;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.invoice-preview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.invoice-preview-card {
    background: #fafbfd;
    border: 1px solid #eef0e9;
    border-radius: 10px;
    padding: 1rem;
}

.invoice-preview-card.is-amount {
    background: linear-gradient(135deg, #fdf6e3, #fff);
    border-color: #e2c98a;
}

.invoice-new-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1rem;
}

.invoice-print {
    background: #fff;
    border: 1px solid #eef0e9;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-top: 1rem;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.invoice-items-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.invoice-blank-lines-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: .5rem 0;
}

.invoice-blank-lines-table {
    min-width: 560px;
}

.invoice-items-table th,
.invoice-items-table td {
    padding: .55rem .85rem;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-items-table th {
    background: #fafbfd;
    text-align: left;
    color: #475569;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.invoice-items-table tfoot td {
    border-bottom: none;
    padding: .35rem .85rem;
    color: #475569;
}

.invoice-items-table tfoot .invoice-total-row td {
    border-top: 2px solid #e2c98a;
    padding-top: .65rem;
    color: #0f172a;
    font-size: 1.05rem;
}

.invoice-notes {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #e6e3d8;
}

.invoice-notes h4 {
    margin: 0 0 .5rem;
    color: #475569;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.exped-detail-inline-warn {
    margin: .75rem 0;
    padding: .55rem .85rem;
    background: #fff7e0;
    border-left: 3px solid #e2c98a;
    color: #8c6a37;
    border-radius: 6px;
    font-size: .85rem;
}

/* ----- Tab "Tiempo" en expediente ----- */
.exped-detail-time-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.exped-detail-time-summary {
    display: inline-flex;
    gap: 1.5rem;
    font-size: .88rem;
}

.exped-detail-time-summary > div {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.exped-detail-time-summary strong {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    color: #0f172a;
}

/* ----- Print styles for invoice ----- */
@media print {
    .topbar, .sidebar, .invoice-detail-actions, .invoice-new-actions { display: none !important; }
    .content { padding: 0 !important; }
    .invoice-print { border: none; padding: 0; }
    .page-hero { background: none; padding: 0 0 1rem; }
    body { background: #fff; }
}

/* ============================================================
   PWA: install banner, offline pill, splash, responsive
   ============================================================ */

/* Splash mientras Blazor levanta */
.pwa-splash {
    min-height: 100vh;
    display: grid;
    place-items: center;
    gap: 1rem;
    background: linear-gradient(180deg, #fdfcf8 0%, #fff7e0 100%);
    color: #8c6a37;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.pwa-splash-logo {
    width: 4rem; height: 4rem;
    display: grid; place-items: center;
    animation: pwa-pulse 2.4s ease-in-out infinite;
}
@keyframes pwa-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.06); opacity: .8; }
}

/* Banner de instalación */
.pwa-install-banner {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 28rem;
    margin-left: auto;
    background: #fff;
    border: 1px solid #e6e3d8;
    border-radius: 14px;
    padding: .85rem 1rem;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .12);
    display: flex;
    align-items: center;
    gap: .85rem;
    z-index: 1100;
    animation: pwa-slide-up .35s ease;
}

@keyframes pwa-slide-up {
    from { transform: translateY(120%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.pwa-install-banner.is-dismissed { display: none; }

.pwa-install-icon {
    width: 2.5rem; height: 2.5rem;
    background: linear-gradient(135deg, #b08a4d, #8c6a37);
    color: #fff;
    border-radius: 10px;
    display: grid; place-items: center;
    flex-shrink: 0;
}

.pwa-install-body { flex: 1; min-width: 0; }
.pwa-install-title { margin: 0; font-weight: 600; color: #0f172a; font-size: .92rem; }
.pwa-install-desc  { margin: .1rem 0 0; color: #64748b; font-size: .8rem; line-height: 1.4; }

.pwa-install-actions { display: inline-flex; gap: .35rem; flex-shrink: 0; }

.btn-ghost-sm {
    background: transparent;
    color: #64748b;
    border: none;
    padding: .4rem .65rem;
    cursor: pointer;
    font-size: .82rem;
    border-radius: 6px;
}

.btn-ghost-sm:hover { background: #f1f5f9; color: #0f172a; }

/* Pill de offline */
.pwa-offline-pill {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #f87171, #b91c1c);
    color: #fff;
    padding: .4rem .85rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    box-shadow: 0 4px 12px rgba(185, 28, 28, .25);
    z-index: 1200;
    animation: pwa-slide-down .25s ease;
}

@keyframes pwa-slide-down {
    from { transform: translate(-50%, -120%); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
}

/* ============================================================
   Responsive: hit-targets, drawer, tablas → cards
   ============================================================ */

/* iOS safe area */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .topbar { padding-top: max(0.5rem, env(safe-area-inset-top)); }
    .pwa-install-banner { bottom: max(1rem, env(safe-area-inset-bottom)); }
}

/* Hit targets táctiles >= 44px en móvil */
@media (max-width: 768px) {
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-save,
    .btn-cancel,
    .btn-danger,
    .nav-link,
    .icon-btn,
    .topbar-search-btn,
    button:not(.btn-icon):not(.note-action-btn):not(.btn-ghost-sm) {
        min-height: 44px;
    }

    .input,
    select.input,
    textarea.input {
        font-size: 16px !important; /* evita zoom de iOS */
        min-height: 44px;
    }

    /* Layout main */
    .content {
        padding: .85rem !important;
    }

    /* Hero compact */
    .page-hero {
        padding: 1rem .25rem .75rem !important;
    }
    .page-title-serif {
        font-size: 1.65rem !important;
    }
    .page-hero-sub {
        font-size: .85rem !important;
    }

    /* Tablas: scroll horizontal + tipografía algo más compacta */
    .time-table { font-size: .82rem; }
    .time-table th, .time-table td { padding: .55rem .65rem; }

    /* Toolbar de tiempo en columna */
    .exped-detail-time-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .exped-detail-time-summary {
        justify-content: space-between;
        gap: .75rem;
    }
    .exped-detail-time-summary strong { font-size: 1.15rem; }

    /* Invoice: vista recibo + nuevo recibo en móvil */
    .invoice-preview {
        grid-template-columns: 1fr !important;
        gap: .75rem;
    }

    .invoice-new-card {
        padding: 1rem !important;
        border-radius: 10px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .modalidad-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: .35rem;
        padding-bottom: .35rem;
        margin: 0 -0.15rem .85rem;
        padding-left: .15rem;
        padding-right: .15rem;
        scrollbar-width: thin;
    }

    .modalidad-pill {
        flex-shrink: 0;
    }

    .page-hero.invoice-detail-hero > div:first-child {
        min-width: 0;
    }

    .invoice-detail-hero .page-hero-sub {
        word-break: break-word;
    }

    .invoice-detail-actions {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
        width: 100%;
    }

    .invoice-detail-actions .time-status-pill {
        align-self: flex-start;
    }

    .invoice-detail-actions .btn-primary,
    .invoice-detail-actions .btn-secondary,
    .invoice-detail-actions .btn-danger {
        width: 100%;
        justify-content: center;
    }

    .invoice-new-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: .5rem;
    }

    .invoice-new-actions .btn-cancel,
    .invoice-new-actions .btn-save {
        width: 100%;
        justify-content: center;
    }

    .invoice-items-table {
        min-width: 520px;
    }

    .invoice-lines-head {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    .invoice-lines-head .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .invoice-lines-totals {
        flex-direction: column;
        align-items: flex-end;
        gap: .35rem;
    }

    .invoice-detail-hero {
        flex-direction: column;
        align-items: stretch;
    }

    /* Reduce el padding del recibo impreso */
    .invoice-print { padding: 1rem; }
    .invoice-items-table { font-size: .82rem; }
    .invoice-items-table th, .invoice-items-table td { padding: .45rem .55rem; }

    /* Modal: ancho casi total */
    .exped-detail-modal,
    .gsp-modal {
        width: calc(100vw - 1.5rem) !important;
        max-width: none !important;
        margin: 0 auto;
    }

    /* Cronómetro compacto */
    .time-timer-card { padding: 1rem !important; }
    .time-timer-clock { font-size: 1.85rem; }
    .btn-large { padding: .85rem 1rem !important; font-size: .9rem !important; }

    /* Notas: avatar más pequeño */
    .note-card { padding: .75rem .85rem; }
    .note-avatar { width: 2rem; height: 2rem; font-size: .72rem; }
    .note-body { font-size: .9rem; }

    /* Timeline: día más compacto */
    .timeline-day-num { font-size: 1.25rem; }
    .timeline-day-mon { font-size: .65rem; }

    /* Cards/Tablas → forzar scroll horizontal en lugar de romper */
    .time-table-wrap,
    .invoice-items-table-wrap,
    .invoice-blank-lines-wrap { -webkit-overflow-scrolling: touch; }

    /* Acciones del invoice en una línea */
    .invoices-toolbar { flex-direction: column; align-items: stretch; }
    .invoices-filters { width: 100%; }

    /* Composer de notas más cómodo */
    .notes-composer-actions { flex-direction: column-reverse; align-items: stretch; gap: .5rem; }
    .notes-composer-actions .btn-save { width: 100%; justify-content: center; }
}

/* Tablet refinements */
@media (min-width: 769px) and (max-width: 1024px) {
    .time-summary { grid-template-columns: repeat(3, 1fr); }
    .time-timer-fields { grid-template-columns: 1fr 1fr; }
}

/* Indicador útil cuando el usuario está en modo PWA (sin chrome) */
@media (display-mode: standalone) {
    /* Espacio extra superior en iOS para no chocar con el notch */
    .topbar { padding-top: max(0.5rem, env(safe-area-inset-top)); }

    /* En desktop standalone, ocultamos botones redundantes */
    .pwa-install-banner { display: none !important; }
}

/* Reduce motion para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ============================================================
   SaaS Billing — pricing público, dashboard, banner
   ============================================================ */

/* ----- Pricing (página pública /pricing) ----- */
.pricing-hero {
    padding: 3.5rem 1rem 1.5rem;
    text-align: center;
    background: linear-gradient(180deg, #fdfcf8 0%, #fff7e0 60%, #ffffff 100%);
}

.pricing-hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.pricing-sub {
    margin: .35rem 0 1.5rem;
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.55;
}

.pricing-cycle-switch {
    display: inline-flex;
    background: #fff;
    border: 1px solid #e6e3d8;
    border-radius: 999px;
    padding: .25rem;
    gap: .15rem;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}

.pricing-cycle-switch.in-settings {
    margin: 0 0 1.25rem;
}

.pricing-cycle-btn {
    border: none;
    background: transparent;
    padding: .5rem 1rem;
    font-size: .9rem;
    color: #475569;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.pricing-cycle-btn:hover  { background: #fdfcf8; color: #0f172a; }
.pricing-cycle-btn.is-active {
    background: linear-gradient(180deg, #b08a4d, #8c6a37);
    color: #fff;
    box-shadow: 0 4px 10px rgba(176,138,77,.25);
}

.pricing-cycle-badge {
    background: rgba(255,255,255,.25);
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
}

.pricing-cycle-btn:not(.is-active) .pricing-cycle-badge {
    background: #fef3c7;
    color: #92400e;
}

.pricing-grid,
.change-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 1.25rem;
    padding: 2rem 1.25rem;
    max-width: 1280px;
    margin: 0 auto;
}

.plan-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e6e3d8;
    border-radius: 16px;
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(15,23,42,.04);
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.plan-card:hover {
    transform: translateY(-2px);
    border-color: #d8d6c8;
    box-shadow: 0 6px 18px rgba(15,23,42,.07);
}

.plan-card.is-highlight {
    border-color: #b08a4d;
    box-shadow: 0 8px 24px rgba(176,138,77,.16);
    background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.plan-card.is-current {
    border-color: #1d4ed8;
    box-shadow: 0 6px 18px rgba(29,78,216,.12);
}

.plan-card-tag {
    position: absolute;
    top: -.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #b08a4d, #8c6a37);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .25rem .65rem;
    border-radius: 999px;
    box-shadow: 0 3px 8px rgba(176,138,77,.3);
}

.plan-card.is-current .plan-card-tag {
    background: linear-gradient(180deg, #1d4ed8, #1e40af);
    box-shadow: 0 3px 8px rgba(29,78,216,.25);
}

.plan-card-head h2 {
    margin: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.6rem;
    color: #0f172a;
}

.plan-card-desc {
    margin: .25rem 0 0;
    color: #475569;
    font-size: .85rem;
    line-height: 1.45;
    min-height: 2.5em;
}

.plan-card-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .25rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid #f1f0e8;
}

.plan-price-currency {
    color: #64748b;
    font-size: .85rem;
    font-weight: 600;
}

.plan-price-amount {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.plan-price-cycle {
    color: #94a3b8;
    font-size: .8rem;
}

.plan-price-list {
    width: 100%;
    color: #94a3b8;
    font-size: .75rem;
    margin-top: .25rem;
}

.plan-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    font-size: .85rem;
    color: #334155;
}

.plan-features-list li {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.plan-feat-yes { color: #166534; }
.plan-feat-no  { color: #cbd5e1; }

.plan-feat-yes svg { color: #16a34a; }
.plan-feat-no  svg { color: #cbd5e1; }

.plan-card-foot {
    margin-top: auto;
}

.plan-card-foot .btn-primary,
.plan-card-foot .btn-secondary,
.plan-card-foot .btn-ghost {
    width: 100%;
    justify-content: center;
}

.pricing-fine {
    text-align: center;
    color: #94a3b8;
    font-size: .8rem;
    max-width: 760px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
    line-height: 1.55;
}

.pricing-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

/* ----- Dashboard /settings/billing ----- */
.billing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.billing-card {
    background: #fff;
    border: 1px solid #eef0e9;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.billing-card-plan {
    background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
    border-color: #e2c98a;
}

.billing-card-plan.is-warn {
    background: linear-gradient(180deg, #fff7e0 0%, #ffffff 100%);
    border-color: #e2c98a;
}

.billing-card-plan.is-error {
    background: linear-gradient(180deg, #fff1f0 0%, #ffffff 100%);
    border-color: #fca5a5;
}

.billing-card-plan.is-muted {
    background: #fafbfd;
    border-color: #e2e8f0;
}

.billing-status-pill {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .65rem;
}

.billing-status-pill.st-trial      { background: #fef3c7; color: #92400e; }
.billing-status-pill.st-active     { background: #dcfce7; color: #166534; }
.billing-status-pill.st-pastdue    { background: #fed7aa; color: #9a3412; }
.billing-status-pill.st-suspended  { background: #fee2e2; color: #b91c1c; }
.billing-status-pill.st-cancelled  { background: #e2e8f0; color: #475569; }

.billing-status-pill.inv-paid       { background: #dcfce7; color: #166534; }
.billing-status-pill.inv-pending    { background: #fef3c7; color: #92400e; }
.billing-status-pill.inv-failed     { background: #fee2e2; color: #b91c1c; }
.billing-status-pill.inv-refunded   { background: #dbeafe; color: #1d4ed8; }
.billing-status-pill.inv-cancelled  { background: #e2e8f0; color: #475569; }

.billing-plan-name {
    margin: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2rem;
    color: #0f172a;
    line-height: 1.1;
}

.billing-cycle {
    margin: .15rem 0 0;
    color: #64748b;
    font-size: .85rem;
}

.billing-price {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    border-bottom: 1px dashed #e6e3d8;
    padding-bottom: .85rem;
}

.billing-price-currency {
    color: #64748b;
    font-weight: 600;
}

.billing-price-amount {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.billing-price-cycle {
    color: #94a3b8;
    font-size: .85rem;
}

.billing-trial-banner {
    background: #fff7e0;
    border-left: 3px solid #e2c98a;
    padding: .65rem .85rem;
    border-radius: 8px;
    color: #8c6a37;
    font-size: .88rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.billing-trial-banner.is-warn  { background: #fed7aa; border-color: #ea580c; color: #9a3412; }
.billing-trial-banner.is-error { background: #fee2e2; border-color: #b91c1c; color: #7f1d1d; }

.billing-trial-banner svg { flex-shrink: 0; margin-top: .15rem; }

.billing-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.billing-cancel-pending {
    color: #92400e;
    background: #fef3c7;
    padding: .35rem .65rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
}

/* Usage card */
.billing-card-usage h3 {
    margin: 0 0 .5rem;
    color: #0f172a;
    font-size: 1.05rem;
}

.usage-bar-row { margin-bottom: 1rem; }

.usage-bar-head {
    display: flex;
    justify-content: space-between;
    font-size: .82rem;
    color: #475569;
    margin-bottom: .35rem;
}

.usage-bar-label  { font-weight: 600; }
.usage-bar-value  { color: #64748b; }

.usage-bar-track {
    height: .55rem;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .35s ease;
}

.usage-bar-fill.is-ok      { background: linear-gradient(90deg, #16a34a, #22c55e); }
.usage-bar-fill.is-warn    { background: linear-gradient(90deg, #d97706, #f59e0b); }
.usage-bar-fill.is-danger  { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.billing-usage-tip {
    font-size: .76rem;
    margin: .35rem 0 0;
}

.billing-invoices header {
    margin-bottom: .75rem;
}

.billing-invoices h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.05rem;
}

.ta-right { text-align: right; }

/* ----- Banner global (BillingStatusBanner) ----- */
.billing-banner {
    margin: -.25rem 0 1rem;
    padding: .65rem .85rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .88rem;
    border: 1px solid;
}

.billing-banner-info  { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.billing-banner-warn  { background: #fff7e0; border-color: #e2c98a; color: #8c6a37; }
.billing-banner-error { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

.billing-banner-text { flex: 1; line-height: 1.4; }
.billing-banner-text strong { font-weight: 700; }

.billing-banner-cta {
    background: rgba(255,255,255,.7);
    border: 1px solid currentColor;
    color: inherit;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.billing-banner-cta:hover { background: #fff; }

.billing-banner-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 .35rem;
    opacity: .6;
}

.billing-banner-close:hover { opacity: 1; }

.change-plan-msg {
    text-align: center;
    margin: 1.5rem auto;
    max-width: 640px;
    color: #475569;
}

/* ----- Responsive ----- */
@media (max-width: 900px) {
    .billing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .pricing-cycle-switch { flex-wrap: wrap; justify-content: center; }
    .pricing-cycle-btn    { padding: .5rem .85rem; font-size: .85rem; }
    .pricing-grid, .change-plan-grid { padding: 1rem .5rem; }
    .billing-card-actions { flex-direction: column; align-items: stretch; }
    .billing-card-actions .btn-primary,
    .billing-card-actions .btn-secondary,
    .billing-card-actions .btn-ghost { width: 100%; justify-content: center; }
}

/* ============================================================
   Sprint 6.5 — Honorarios ampliados (modalidades + fee agreements)
   ============================================================ */

/* Dropdown del botón "Nuevo recibo" */
.dropdown { position: relative; display: inline-block; }
.dropdown .btn-primary { gap: .4rem; }

/* ============================================================
   Botones primarios y outline reutilizables del proyecto.
   Antes vivían solo en .btn-save; los definimos aquí para que
   .btn-primary y .btn-outline-primary tengan look consistente.
   ============================================================ */
.btn-primary {
    display: inline-flex; align-items: center; gap: .45rem;
    background: linear-gradient(180deg, #3B82F6 0%, #1d4ed8 100%);
    color: #fff; border: none; border-radius: 8px;
    padding: .55rem 1rem; font-weight: 600; font-size: .9rem;
    letter-spacing: .02em; cursor: pointer;
    box-shadow: 0 6px 14px rgba(59, 130, 246, .28),
                inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-primary:hover:not(:disabled) {
    filter: brightness(1.04);
    box-shadow: 0 8px 18px rgba(59, 130, 246, .34),
                inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-outline-primary {
    display: inline-flex; align-items: center; gap: .4rem;
    background: #fff; color: #1d4ed8;
    border: 1.5px solid #1d4ed8; border-radius: 8px;
    padding: .35rem .85rem; font-weight: 600; font-size: .85rem;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.btn-outline-primary:hover:not(:disabled) {
    background: #1d4ed8; color: #fff;
    box-shadow: 0 4px 10px rgba(29, 78, 216, .22);
}
.btn-outline-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline-primary.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.dropdown-backdrop {
    position: fixed; inset: 0; background: transparent; border: none;
    cursor: default; padding: 0; z-index: 40;
}
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + .4rem);
    min-width: 320px; background: #fff;
    border: 1px solid rgba(15, 30, 60, .12); border-radius: .6rem;
    box-shadow: 0 14px 40px rgba(15, 30, 60, .14);
    padding: .35rem; z-index: 50; overflow: hidden;
    animation: dropdown-fade .12s ease-out;
}
@keyframes dropdown-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
    display: grid; grid-template-columns: 32px 1fr; gap: .65rem;
    align-items: flex-start; width: 100%; padding: .65rem .75rem;
    background: transparent; border: none; border-radius: .45rem;
    text-align: left; cursor: pointer; color: #1f2c4a;
    transition: background .12s ease;
}
.dropdown-item:hover  { background: rgba(184, 145, 76, .08); }
.dropdown-item:focus  { outline: 2px solid rgba(184, 145, 76, .45); }
.dropdown-icon {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: .4rem; background: rgba(184, 145, 76, .12); color: #8d6432;
}
.dropdown-item strong { display: block; font-size: .92rem; font-weight: 600; color: #1f2c4a; }
.dropdown-item small  { display: block; font-size: .78rem; color: #6c7a93; line-height: 1.35; }

/* Pills de modalidad (selector horizontal) */
.modalidad-pills {
    display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem;
}
.modalidad-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .85rem; border-radius: 999px;
    background: #f3f5fa; color: #4a5571;
    border: 1px solid rgba(15, 30, 60, .08); font-size: .85rem;
    cursor: pointer; transition: all .12s ease;
}
.modalidad-pill:hover { background: #e7ecf5; }
.modalidad-pill.is-active {
    background: #1f2c4a; color: #fff; border-color: #1f2c4a;
}
.modalidad-pill.is-active svg { stroke: #d2b07a; }

/* Fee agreement card (resumen del acuerdo) */
.fee-agreement-card {
    background: linear-gradient(135deg, rgba(31, 44, 74, .03), rgba(184, 145, 76, .06));
    border: 1px solid rgba(15, 30, 60, .08); border-radius: .6rem;
    padding: 1rem 1.15rem; margin-bottom: 1rem;
}
.fee-agreement-card h4 {
    margin: .35rem 0 0; font-size: 1.25rem; color: #1f2c4a;
    font-weight: 600;
}
.fee-agreement-editor {
    padding: 0;
}
.fee-agreement-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    padding-bottom: .75rem; margin-bottom: 1rem;
    border-bottom: 1px solid rgba(15, 30, 60, .08);
}
.fee-agreement-head h3 { margin: 0 0 .25rem; font-size: 1.05rem; color: #1f2c4a; font-weight: 600; }

/* Modo resumen del acuerdo (read-only con botón "Editar") */
.fee-agreement-summary { display: flex; flex-direction: column; gap: 1rem; }
.fee-agreement-summary-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    padding-bottom: .75rem; border-bottom: 1px solid rgba(15, 30, 60, .08);
}
.fee-agreement-summary-head h3 { margin: 0 0 .25rem; font-size: 1.05rem; color: #1f2c4a; font-weight: 600; }
.fee-agreement-summary-actions { display: flex; align-items: center; gap: .6rem; }

.fee-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .9rem 1.5rem;
    background: linear-gradient(180deg, #fafbff 0%, #f5f7ff 100%);
    border: 1px solid rgba(31, 44, 74, .08);
    border-radius: .65rem;
    padding: 1.1rem 1.3rem;
}
.fee-summary-cell { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.fee-summary-cell-label {
    font-size: .72rem; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; color: #6b7691;
}
.fee-summary-cell-value {
    font-size: .96rem; font-weight: 600; color: #1f2c4a; word-break: break-word;
}
.fee-summary-notes {
    background: #fff8e1; border-left: 3px solid #f5b800;
    border-radius: .4rem; padding: .7rem .9rem;
}
.fee-summary-notes strong { font-size: .82rem; color: #7a5800; }
.fee-summary-notes p { margin: .25rem 0 0; font-size: .9rem; color: #4a3500; white-space: pre-wrap; }
.section-subtitle.small { font-size: .9rem; margin: 0 0 .5rem; color: #1f2c4a; }

/* Fee stages list (selector con checkbox) */
.fee-stages-list {
    display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem;
}
.fee-stage-row {
    display: grid; grid-template-columns: 22px 1fr; gap: .85rem; align-items: flex-start;
    padding: .75rem 1rem; border: 1px solid rgba(15, 30, 60, .1);
    border-radius: .55rem; cursor: pointer; background: #fff;
    transition: border-color .12s, background .12s;
}
.fee-stage-row:hover            { background: #fafbff; }
.fee-stage-row.is-disabled      { opacity: .55; cursor: not-allowed; }
.fee-stage-row input[type=checkbox] { margin-top: .15rem; accent-color: #1f2c4a; }
.fee-stage-body                 { display: flex; flex-direction: column; gap: .2rem; }
.fee-stage-head                 { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.fee-stage-amount               { font-weight: 600; color: #8d6432; margin: 0; }

/* Stages editor (tabla en el tab del expediente) */
.fee-stages-editor { margin-bottom: 1rem; }

/* Editor de líneas dentro de recibo draft */
.invoice-lines-editor    { margin: 1rem 0 .5rem; }
.invoice-lines-head      {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .5rem;
}
.invoice-lines-head h4   { margin: 0; font-size: .95rem; color: #1f2c4a; }
.invoice-lines-totals    {
    display: flex; justify-content: flex-end; gap: 1.5rem;
    margin-top: .75rem; font-size: .9rem; color: #4a5571;
}

/* Sección "Agregar concepto adicional" en el detalle del recibo */
.invoice-add-line {
    margin-top: 1.25rem; padding: 1rem 1.25rem;
    background: #fafbff; border: 1px solid rgba(15, 30, 60, .08);
    border-radius: .6rem;
}
.invoice-add-line h4 { margin: 0 0 .75rem; color: #1f2c4a; font-size: 1rem; }

/* Chips de tipo de línea en la tabla */
.item-type-chip {
    display: inline-block; font-size: .68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; padding: .12rem .45rem; border-radius: 999px;
    margin-right: .5rem; vertical-align: middle;
}
.item-type-chip.type-time     { background: #e7f1fe; color: #1f56b0; }
.item-type-chip.type-retainer { background: #e8f6e8; color: #2c8a2c; }
.item-type-chip.type-stage    { background: #faf0e0; color: #8d6432; }
.item-type-chip.type-custom   { background: #f1eaf7; color: #6a3fa5; }
.item-type-chip.type-expense  { background: #fff4e3; color: #a16500; }
.item-type-chip.type-discount { background: #fde7e7; color: #b03333; }

/* Pequeños ajustes */
.section-subtitle { margin: 0; font-size: 1.05rem; color: #1f2c4a; font-weight: 600; }
.small            { font-size: .82rem; }

@media (max-width: 720px) {
    .dropdown-menu { right: -.5rem; min-width: 280px; }
    .modalidad-pills { gap: .3rem; }
    .modalidad-pill { font-size: .78rem; padding: .35rem .65rem; }
}

/* ============================================================
   MoneyInput — input enmascarado para montos
   ============================================================ */
.money-input {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.money-input-prefix {
    position: absolute; left: .8rem; top: 50%;
    transform: translateY(-50%);
    font-size: .8rem; font-weight: 600;
    color: #8d6432; letter-spacing: .03em;
    pointer-events: none;
    text-transform: uppercase;
    z-index: 1;
}
.money-input-field {
    width: 100%;
    padding-left: 3.2rem !important;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.money-input-field:disabled {
    background: #f3f5fa; color: #6c7a93;
}
.field .money-input { width: 100%; }

/* Catálogo de órganos (SuperAdmin) — estado de última sync */
.org-sync-pill {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .2rem .45rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
}
.org-sync-pill.is-ok { border-color: #86efac; background: #ecfdf5; color: #166534; }
.org-sync-pill.is-warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.org-sync-pill.is-err { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.org-sync-pill.is-muted { border-color: #e2e8f0; background: #f1f5f9; color: #64748b; }

.org-explore-panel { padding: 1rem 1.1rem; }
.org-explore-toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-bottom: .25rem; }
.org-explore-toolbar .btn-secondary { display: inline-flex; align-items: center; gap: .35rem; }
.org-explore-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .9rem; }
.org-explore-sep { opacity: .45; user-select: none; }
.org-explore-row--muted td { background: #f8fafc; }

/* Permisos por expediente (C1) */
.exped-detail-readonly-banner {
    margin: 0 0 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: .85rem;
    font-weight: 600;
}
.exped-team-card { margin-bottom: 16px; padding: 16px 18px; max-width: 100%; min-width: 0; box-sizing: border-box; }
.exped-team-card--after-panel { margin-top: 1rem; margin-bottom: 0; }
.exped-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.exped-team-title { margin: 0; font-size: 1rem; font-weight: 700; color: #0f172a; }
.exped-team-table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.exped-team-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 0; }
.exped-team-table th,
.exped-team-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.exped-team-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.exped-team-email { font-size: .8rem; margin-top: 2px; word-break: break-word; }
.exped-team-tag {
    display: inline-block;
    margin-right: 4px;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    background: #e0e7ff;
    color: #3730a3;
}
.exped-team-editor {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}
.exped-team-editor-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.exped-team-editor-actions { margin-top: 10px; }
.btn-secondary--sm,
.btn-cancel--sm { padding: 6px 10px; font-size: .8rem; }
.input--sm { max-width: 200px; padding: 6px 8px; font-size: .85rem; }

/* Área de trabajo — análisis de texto */
.workspace-text-snippet {
    margin-top: 12px;
    padding: 12px 14px;
    max-height: 320px;
    overflow: auto;
    font-size: .8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.workspace-pick-list {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.workspace-pick-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: .9rem;
}
.workspace-pick-row:last-child { border-bottom: none; }
.workspace-pick-row:hover { background: #f8fafc; }
.workspace-pick-row input { margin-top: 3px; }

/* Área de trabajo — tabla de análisis */
.workspace-analyses-card {
    padding: 0;
    overflow: hidden;
}

.workspace-analyses-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.workspace-analyses-table {
    width: 100%;
    border-collapse: collapse;
}

.workspace-analyses-table th {
    padding: .65rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #64748b;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.workspace-analyses-table td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: .88rem;
}

.workspace-analyses-th-actions {
    width: 44px;
}

.workspace-analyses-row {
    cursor: pointer;
    transition: background .12s ease;
}

.workspace-analyses-row:hover {
    background: #f8fafc;
}

.workspace-analyses-title {
    display: block;
    font-size: .92rem;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.workspace-analyses-filename,
.workspace-analyses-expedient {
    font-size: .78rem;
    margin-top: .2rem;
    line-height: 1.35;
    word-break: break-word;
}

.workspace-analyses-actions {
    text-align: right;
}

.workspace-analyses-remove {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    line-height: 1;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .workspace-hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .workspace-hero-actions .btn-create,
    .workspace-hero-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .workspace-analyses-list {
        overflow-x: visible;
        padding: .75rem;
    }

    .workspace-analyses-table thead {
        display: none;
    }

    .workspace-analyses-table tbody {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }

    .workspace-analyses-table,
    .workspace-analyses-table tbody,
    .workspace-analyses-table tr,
    .workspace-analyses-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .workspace-analyses-row {
        position: relative;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: .85rem 2.75rem .85rem .85rem;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    }

    .workspace-analyses-row:hover {
        background: #f8fafc;
    }

    .workspace-analyses-row td {
        border-bottom: none;
        padding: 0;
    }

    .workspace-analyses-doc {
        padding-bottom: .65rem;
        margin-bottom: .55rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .workspace-analyses-table td:not(.workspace-analyses-doc):not(.workspace-analyses-actions) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .4rem 0;
        font-size: .88rem;
    }

    .workspace-analyses-table td:not(.workspace-analyses-doc):not(.workspace-analyses-actions)::before {
        content: attr(data-label);
        font-size: .7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: #64748b;
        flex-shrink: 0;
    }

    .workspace-analyses-table td[data-label="Estado"] {
        align-items: flex-start;
    }

    .workspace-analyses-table td[data-label="Estado"] .exped-status-pill {
        text-align: right;
        max-width: 65%;
    }

    .workspace-analyses-actions {
        position: absolute;
        top: .45rem;
        right: .35rem;
        width: auto;
    }

    .workspace-analyses-actions::before {
        display: none !important;
    }
}

.workspace-module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}

.workspace-module-tabs .exped-chip.is-active {
    background: var(--accent, #c9a227);
    color: #111;
    border-color: transparent;
}

.workspace-ai-box {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.workspace-ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.workspace-ai-answer {
    max-height: 220px;
    overflow: auto;
}

.workspace-drafts-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.workspace-drafts-list {
    display: grid;
    gap: 0.75rem;
}

.workspace-draft-row {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
}

.workspace-draft-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
    text-align: left;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    background: var(--surface-elevated, rgba(255, 255, 255, 0.03));
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.workspace-draft-row:hover .workspace-draft-card {
    border-color: var(--accent, #c9a227);
    background: rgba(201, 162, 39, 0.06);
}

.workspace-draft-row-actions {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 0.35rem;
}

.workspace-draft-rename,
.workspace-draft-delete {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    background: var(--surface-elevated, rgba(255, 255, 255, 0.03));
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.workspace-draft-rename:hover {
    color: var(--accent, #c9a227);
    border-color: rgba(201, 162, 39, 0.45);
    background: rgba(201, 162, 39, 0.08);
}

.workspace-draft-delete:hover {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.08);
}

.workspace-draft-kind {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent, #c9a227);
}

.workspace-draft-textarea {
    min-height: 320px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}

.workspace-draft-editor {
    max-width: 900px;
}

.workspace-templates-backdrop {
    backdrop-filter: blur(2px);
}

.workspace-templates-modal {
    display: flex;
    flex-direction: column;
    max-width: min(720px, 96vw);
    width: 100%;
    max-height: min(90vh, 880px);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.workspace-templates-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem 1.25rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    text-align: left;
}

.workspace-templates-modal-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.workspace-templates-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    color: #b59410;
}

.workspace-templates-modal-header h3 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    color: #0f172a;
}

.workspace-templates-sub {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    line-height: 1.45;
}

.workspace-templates-modal-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.workspace-templates-modal-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.workspace-templates-modal-tab:hover:not(.is-active) {
    color: #334155;
}

.workspace-templates-modal-tab.is-active {
    color: #1d4ed8;
    border-bottom-color: #2563eb;
}

.workspace-templates-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.15rem;
}

.workspace-templates-toolbar {
    margin-bottom: 0.75rem;
}

.workspace-templates-search {
    position: relative;
    margin-bottom: 0.35rem;
}

.workspace-templates-search .input {
    padding-left: 2.35rem;
}

.workspace-templates-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.workspace-templates-stats {
    margin: 0;
    font-size: 0.8rem;
}

.workspace-template-matter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.35rem;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.workspace-template-matter-chip {
    padding: 0.35rem 0.75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.workspace-template-matter-chip:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.7);
    color: #334155;
}

.workspace-template-matter-chip.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.workspace-empty-state--compact {
    padding: 1.75rem 1rem;
}

.workspace-templates-catalog {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.workspace-templates-matter-block {
    margin: 0;
}

.workspace-templates-matter-heading {
    margin: 0 0 0.5rem;
    padding: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
}

.workspace-templates-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.workspace-template-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.workspace-template-row:hover {
    border-color: #93c5fd;
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.workspace-template-row-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #1d4ed8;
}

.workspace-template-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.workspace-template-row-main strong {
    font-size: 0.92rem;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.workspace-template-row-meta {
    font-size: 0.78rem;
    line-height: 1.35;
}

.workspace-template-badge {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    vertical-align: middle;
}

.workspace-template-row-action {
    flex-shrink: 0;
    color: #94a3b8;
}

.workspace-template-row:hover .workspace-template-row-action {
    color: #2563eb;
}

.workspace-template-upload-panel {
    max-width: 28rem;
}

.workspace-template-dropzone {
    margin-top: 0.25rem;
}

.workspace-templates-modal-footer {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

/* Legacy category grid (create modal chips) */
.workspace-template-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.workspace-template-category-card {
    background: var(--surface-elevated, #fff);
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
    border-radius: 12px;
    padding: 1rem 1.1rem 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, transform 0.15s;
}

.workspace-template-category-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.workspace-template-category-head {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.workspace-template-category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(234, 88, 12, 0.12);
    color: #ea580c;
    flex-shrink: 0;
}

.workspace-template-category-head h4 {
    margin: 0;
    font-size: 1rem;
}

.workspace-template-category-items {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
}

.workspace-template-category-items li + li {
    border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.05));
}

.workspace-template-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.85rem;
    color: inherit;
    cursor: pointer;
}

.workspace-template-item:hover {
    color: var(--accent, #2563eb);
}

.workspace-template-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-template-upload-section {
    margin-top: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.workspace-template-upload-section h4 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.workspace-template-upload-form {
    display: grid;
    gap: 0.75rem;
}

.workspace-template-picker-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.workspace-template-pick-chip {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
    background: transparent;
    font-size: 0.8rem;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-template-pick-chip.is-selected,
.workspace-template-pick-chip:hover {
    border-color: var(--accent, #2563eb);
    background: rgba(37, 99, 235, 0.08);
}

.workspace-selected-template {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0.35rem 0;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.06);
    font-size: 0.9rem;
}

.workspace-create-draft-modal {
    max-width: 520px;
}

.workspace-draft-editor-body {
    min-height: 420px;
}

.legal-draft-editor {
    margin-top: 0.5rem;
}

.legal-draft-editor-host {
    min-height: 360px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.legal-draft-editor-host.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.legal-draft-editor > .ql-toolbar,
.legal-draft-editor-host .ql-toolbar {
    border-radius: 8px 8px 0 0;
    border-color: var(--border-subtle, #e2e8f0);
    font-family: inherit;
}

.legal-draft-editor-host .ql-container {
    border-radius: 0 0 8px 8px;
    border-color: var(--border-subtle, #e2e8f0);
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.95rem;
    min-height: 300px;
}

.legal-draft-editor-host .ql-editor {
    min-height: 300px;
    line-height: 1.55;
}

.legal-draft-editor-host .draft-placeholder {
    background: rgba(234, 179, 8, 0.2);
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 500;
}

.legal-draft-editor-hint {
    font-size: 0.78rem;
    margin: 0.5rem 0 0;
}

.legal-draft-editor-hint code {
    font-size: 0.85em;
}

.workspace-draft-editor {
    max-width: min(920px, 96vw);
    width: 100%;
}

.workspace-analysis-modal {
    max-width: min(920px, 96vw);
    width: 100%;
    max-height: 92vh;
}

/* Panel lateral documento (área de trabajo): no cierra al clic fuera */
.workspace-detail-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1150;
    background: rgba(15, 23, 42, 0.35);
    animation: fadeInBackdrop .15s ease;
}

.workspace-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1160;
    width: min(920px, 100vw);
    max-width: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    animation: workspaceDrawerSlideIn .22s ease;
}

@keyframes workspaceDrawerSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.workspace-detail-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.workspace-analysis-drawer .workspace-doc-header {
    flex-shrink: 0;
    align-items: flex-start;
    padding: 1rem 1.15rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.workspace-doc-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.workspace-doc-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #1d4ed8;
}

.workspace-doc-header-text {
    min-width: 0;
    flex: 1;
}

.workspace-doc-header-text h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-doc-header-filename {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-doc-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.workspace-doc-header-meta .exped-status-pill {
    font-size: 0.72rem;
}

.workspace-doc-header-pages {
    font-size: 0.75rem;
    color: #64748b;
}

.workspace-doc-header-close {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-top: 0.1rem;
}

.workspace-doc-header-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.workspace-ai-composer {
    display: flex;
    align-items: stretch;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.workspace-ai-composer:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.workspace-ai-composer-input {
    flex: 1;
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.workspace-ai-composer-send {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-left: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #2563eb;
    padding: 0 0.9rem;
    cursor: pointer;
    line-height: 0;
}

.workspace-ai-composer-send:not(:disabled):hover {
    background: #eff6ff;
}

.workspace-ai-composer-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.workspace-ai-ask-btn {
    margin-top: 0.65rem;
    width: 100%;
}

.workspace-ai-mode-block {
    margin-bottom: 0.75rem;
}

.workspace-ai-mode-bar {
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-ai-mode-chip {
    font-size: 0.82rem;
}

.workspace-ai-mode-chip--deep:not(.is-active) {
    border-style: dashed;
    opacity: 0.92;
}

.workspace-ai-mode-hint {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    max-width: 42rem;
}

.workspace-ai-chat {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
    max-height: min(50vh, 420px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.workspace-ai-turn {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workspace-ai-turn-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.workspace-ai-turn-question {
    padding: 0.65rem 0.85rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    border-left: 3px solid var(--color-institutional, #3b82f6);
}

.workspace-ai-turn-question p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #0f172a;
}

.workspace-ai-turn-answer {
    padding: 0.85rem 0.95rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    border-left: 3px solid var(--gold, #b59410);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.workspace-ai-answer-body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
}

.workspace-ai-turn-answer.is-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.workspace-ai-turn-answer.is-error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.workspace-ai-turn-answer.is-error .workspace-ai-answer-body {
    color: #991b1b;
}

.workspace-extraction-loading {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.workspace-extraction-spinner {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.workspace-extraction-loading-text strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.workspace-extraction-loading-text p {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
}

.workspace-extraction-elapsed {
    font-variant-numeric: tabular-nums;
}

.workspace-extraction-error {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workspace-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.workspace-choose-panel {
    padding: 1.15rem 1.2rem 1.25rem;
    border-radius: 14px;
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 48%, #fffbeb 100%);
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.workspace-analysis-intro {
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: #0f172a;
}

.workspace-analysis-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}

.workspace-analysis-action-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.1rem 1.15rem;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.workspace-analysis-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.workspace-analysis-action-card--read:hover {
    border-color: #93c5fd;
}

.workspace-analysis-action-card--ai:hover {
    border-color: #c4b5fd;
}

.workspace-analysis-action-card--draft:hover {
    border-color: #6ee7b7;
}

.workspace-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    flex-shrink: 0;
}

.workspace-action-icon--read {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #1d4ed8;
}

.workspace-action-icon--ai {
    background: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 100%);
    color: #6d28d9;
}

.workspace-action-icon--draft {
    background: linear-gradient(135deg, #d1fae5 0%, #ecfdf5 100%);
    color: #047857;
}

.workspace-analysis-action-card strong {
    font-size: 0.96rem;
    color: #0f172a;
}

.workspace-action-desc {
    font-size: 0.78rem;
    line-height: 1.4;
    color: #64748b;
}

.workspace-analysis-mode-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.workspace-doc-sheet {
    background: #e8eaed;
    border-radius: 8px;
    padding: 1.25rem 1rem;
    max-height: 55vh;
    overflow-y: auto;
}

.workspace-doc-sheet-inner {
    max-width: 21cm;
    margin: 0 auto;
    padding: 2cm 2.2cm;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #111;
}

.workspace-doc-sheet-inner p {
    margin: 0 0 0.65em;
}

.workspace-doc-p-break {
    min-height: 0.5em;
}

.workspace-ai-answer-box {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.legal-draft-fallback-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    background: #f8fafc;
}

.legal-draft-fb-btn {
    min-width: 2rem;
    height: 2rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}

.legal-draft-fb-note {
    font-size: 0.75rem;
    margin-left: auto;
}

.legal-draft-fallback-textarea {
    font-family: "Consolas", "Cascadia Code", ui-monospace, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 0 0 8px 8px;
    min-height: 360px;
}

/* Editor tipo Word (escritos) */
.word-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: #e8eaed;
    display: flex;
    flex-direction: column;
}

.word-editor-overlay-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

.word-editor-overlay-inner--draft {
    flex-direction: row;
    min-height: 0;
}

.draft-editor-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.draft-editor-sidebar {
    width: min(320px, 36vw);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #d1d5db;
    overflow-y: auto;
    padding: 1rem 1rem 1.25rem;
    font-size: 0.88rem;
}

.draft-editor-sidebar-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.draft-editor-sidebar-head-row h4 {
    margin: 0;
}

.draft-editor-sidebar-close-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
}

.draft-editor-sidebar-close-mobile:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.draft-editor-sidebar-backdrop {
    display: none;
}

.draft-editor-mobile-hint {
    display: none;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    line-height: 1.45;
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    color: #1e40af;
    flex-shrink: 0;
}

.draft-kalex-toolbar-btn--hide-when-open {
    display: none;
}

.draft-editor-sidebar-head h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.draft-editor-sidebar-block {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e5e7eb;
}

.draft-editor-sidebar-block h5 {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.draft-editor-sidebar-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.draft-editor-meta-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.draft-editor-meta-list li {
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.draft-editor-source-title {
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.draft-editor-source-snippet {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #4b5563;
    white-space: pre-wrap;
    max-height: 12rem;
    overflow-y: auto;
}

.draft-editor-section-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.draft-editor-section-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
}

.draft-editor-section-item.is-selected .draft-editor-section-btn {
    background: #eff6ff;
    color: #1d4ed8;
}

.draft-editor-section-item.is-whole-doc .draft-editor-section-btn {
    font-weight: 600;
}

.draft-editor-section-item.is-whole-doc.is-selected .draft-editor-section-btn {
    background: #f0fdf4;
    color: #166534;
}

.draft-editor-section-badge.is-done {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
}

.draft-editor-section-badge.is-empty {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #9ca3af;
}

.draft-editor-instruction {
    width: 100%;
    font-size: 0.85rem;
    resize: vertical;
}

.draft-editor-ai-btn {
    width: 100%;
    margin-top: 0.35rem;
}

.draft-editor-refresh-sections-btn {
    display: block;
    width: 100%;
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.draft-kalex-assistant {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e5e7eb;
}

.draft-kalex-assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.draft-kalex-assistant-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e3a5f;
}

.draft-kalex-assistant-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
}

.draft-kalex-assistant-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.draft-kalex-assistant.is-closed {
    border-top: none;
    padding-top: 0.5rem;
}

.draft-kalex-collapsed-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0.85rem 0.9rem;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(165deg, #eff6ff 0%, #f8fafc 42%, #f0fdf4 100%);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px rgba(59, 130, 246, 0.08);
}

.draft-kalex-collapsed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.55rem;
    border-radius: 50%;
    color: #1d4ed8;
    background: linear-gradient(145deg, #fff 0%, #dbeafe 100%);
    box-shadow:
        0 2px 8px rgba(37, 99, 235, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.draft-kalex-collapsed-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1e3a5f;
}

.draft-kalex-collapsed-desc {
    margin: 0 0 0.85rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #64748b;
    max-width: 16rem;
}

.draft-kalex-reopen-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border: none;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.draft-kalex-reopen-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
        0 8px 18px rgba(37, 99, 235, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.draft-kalex-reopen-btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.draft-kalex-reopen-btn span {
    flex: 0 1 auto;
}

.draft-kalex-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1d4ed8;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.draft-kalex-toolbar-btn:hover {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

.draft-kalex-assistant.is-closed .draft-kalex-intro,
.draft-kalex-assistant.is-closed .draft-kalex-quota-line,
.draft-kalex-assistant.is-closed .draft-kalex-tabs,
.draft-kalex-assistant.is-closed .draft-kalex-panel,
.draft-kalex-assistant.is-closed .draft-ai-success-banner,
.draft-kalex-assistant.is-closed .draft-sidebar-error,
.draft-kalex-assistant.is-closed .draft-kalex-assistant-head {
    display: none;
}

.draft-kalex-intro {
    margin: 0 0 0.5rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #64748b;
}

.draft-kalex-quota-line {
    margin: 0 0 0.55rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.74rem;
    color: #1e40af;
    background: #eff6ff;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
}

.draft-kalex-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.draft-kalex-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.45rem 0.35rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.draft-kalex-tab:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

.draft-kalex-tab.is-active {
    background: #fff;
    border-color: #3b82f6;
    color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.draft-kalex-tab svg {
    flex-shrink: 0;
}

.draft-kalex-panel {
    padding: 0.65rem 0.7rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    min-height: 8rem;
}

.draft-kalex-panel-title {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
}

.draft-kalex-panel-lead {
    margin: 0 0 0.65rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #64748b;
}

.draft-kalex-empty {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #94a3b8;
}

.draft-kalex-panel-result {
    max-height: 200px;
}

.draft-kalex-panel-result--compact {
    max-height: 120px;
    margin-bottom: 0;
}

.draft-kalex-mode-bar {
    margin: 0.5rem 0 !important;
}

.draft-kalex-panel-alert {
    margin-bottom: 0.65rem;
}

.draft-kalex-action-btn {
    width: 100%;
    margin-top: 0.35rem;
}

.draft-editor-sidebar-hint {
    font-size: 0.82rem;
    margin: 0.75rem 0 0;
}

.draft-ai-quota-banner {
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #7f1d1d;
}

.draft-ai-quota-banner--warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}

.draft-ai-quota-banner p {
    margin: 0;
}

.draft-sidebar-error {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
}

.draft-source-summary {
    margin: 0.5rem 0;
    padding: 0.5rem 0.6rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.draft-source-summary h6 {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.draft-source-summary-body {
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.draft-source-summary-meta {
    font-size: 0.72rem;
    margin: 0.35rem 0 0;
}

.draft-source-summary-actions {
    margin-bottom: 0.5rem;
}

.draft-review-output {
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.draft-editor-review-block.is-just-updated .draft-review-output {
    border-color: #86efac;
    background: #f0fdf4;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.draft-review-status-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin: 0 0 0.25rem;
}

.draft-review-focus-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin: 0.35rem 0 0.25rem;
}

.draft-review-focus-label .muted {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.75rem;
}

.draft-review-token-hint {
    font-size: 0.75rem;
    line-height: 1.4;
    margin: 0.35rem 0 0;
    padding: 0.4rem 0.5rem;
    background: #fffbeb;
    border-radius: 6px;
    border: 1px solid #fde68a;
}

.draft-ai-success-banner {
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #166534;
}

.draft-ai-success-banner p {
    margin: 0;
}

.draft-ai-working-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #1d4ed8;
    margin: 0 0 0.5rem;
    padding: 0.45rem 0.5rem;
    background: #eff6ff;
    border-radius: 6px;
}

.draft-ai-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #bfdbfe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: draft-ai-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes draft-ai-spin {
    to { transform: rotate(360deg); }
}

.draft-editor-ai-btn:disabled {
    opacity: 0.85;
}

.workspace-template-matter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.workspace-template-matter-section {
    margin-bottom: 1.25rem;
}

.workspace-template-matter-title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    color: #1e3a5f;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.35rem;
}

.workspace-draft-apply-expedient {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.word-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #eceff1;
}

.word-editor-chrome {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.word-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.word-editor-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1rem 0.3rem;
}

.word-editor-title-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 1.15rem;
    font-weight: 600;
    color: #111827;
    outline: none;
}

.word-editor-title-input::placeholder {
    color: #9ca3af;
    font-weight: 500;
}

.word-editor-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: auto;
}

.word-editor-badge {
    font-size: 0.78rem;
    margin-right: 0.25rem;
}

.word-editor-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.word-editor-menubar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem 0.35rem;
    font-size: 0.82rem;
    color: #374151;
}

.word-editor-menu-item {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    cursor: default;
}

.word-editor-menu-item:hover {
    background: #f3f4f6;
}

.word-editor-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    color: #1e3a5f;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

.word-editor-menu-btn:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
}

.word-editor-menu-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.word-editor-menu-hint {
    margin-left: auto;
    font-size: 0.78rem;
    max-width: 22rem;
    text-align: right;
}

.word-editor-save-ok {
    font-size: 0.85rem;
    color: #15803d;
    align-self: center;
}

.word-editor-ribbon {
    position: relative;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.word-editor-ribbon.is-collapsed .word-editor-ck-toolbar-shell,
.word-editor-ribbon.is-collapsed .word-editor-ribbon-head {
    display: none;
}

.word-editor-ribbon-head {
    display: flex;
    gap: 1.25rem;
    padding: 0.2rem 1rem 0;
    font-size: 0.68rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.word-editor-ribbon-tag {
    min-width: 4.5rem;
}

.word-editor-ck-toolbar-shell {
    min-height: 44px;
    padding: 0.15rem 0.75rem 0.35rem;
}

.word-editor-ck-toolbar-shell .ck.ck-toolbar {
    border: none !important;
    background: transparent !important;
    font-family: Inter, system-ui, sans-serif;
}

.word-editor-ck-toolbar-shell .ck-toolbar__items {
    flex-wrap: wrap;
}

.word-editor-ribbon-collapse {
    position: absolute;
    right: 0.5rem;
    top: 0.25rem;
    width: 26px;
    height: 26px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-editor-workspace {
    flex: 1;
    overflow: auto;
    padding: 1.5rem 1rem 2rem;
    background: #d8dce0;
    min-height: 0;
    transform: scale(var(--word-zoom, 1));
    transform-origin: top center;
}

/* Hoja A4 con márgenes tipo Word (2,54 cm arriba/abajo; 3,17 cm izquierda/derecha) */
.word-editor-page {
    width: 21cm;
    max-width: calc(100% - 1rem);
    margin: 0 auto 1.5rem;
    min-height: 29.7cm;
    background: #fff;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 6px 24px rgba(0, 0, 0, 0.14);
    box-sizing: border-box;
    border-radius: 1px;
}

.word-editor-page-body {
    box-sizing: border-box;
    min-height: 29.7cm;
    padding: 2.54cm 3.17cm 2.54cm 3.17cm;
}

.word-editor-ck-host {
    min-height: calc(29.7cm - 5.08cm);
    width: 100%;
}

.word-editor-ck-host.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #64748b;
}

.word-editor-ck-host .ck.ck-editor {
    width: 100%;
}

.word-editor-page .word-editor-ck-host .ck.ck-editor,
.word-editor-page .word-editor-ck-host .ck-editor__main {
    width: 100%;
}

.word-editor-page .word-editor-ck-host .ck-editor__editable,
.word-editor-page .word-editor-ck-host .ck.ck-content.ck-editor__editable {
    min-height: calc(29.7cm - 5.08cm) !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: "Times New Roman", Times, serif !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #111 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    max-width: 100% !important;
}

.word-editor-page .word-editor-ck-host .ck.ck-content p,
.word-editor-page .word-editor-ck-host .ck.ck-content li {
    margin-top: 0;
    margin-bottom: 0.35em;
}

.word-editor-ck-host .ck-editor__editable.ck-focused {
    border: none !important;
    box-shadow: none !important;
}

.word-editor-statusbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 1rem;
    background: #2563eb;
    color: #fff;
    font-size: 0.78rem;
}

.word-editor-status-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.word-editor-zoom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    color: #fff;
}

.word-editor-zoom-select {
    width: auto;
    min-width: 4.5rem;
    padding: 0.15rem 0.35rem;
    font-size: 0.78rem;
    height: auto;
}

.word-editor.is-fallback .word-editor-workspace {
    display: none;
}

.word-editor-fallback-textarea {
    flex: 1;
    margin: 1rem;
    padding: 1rem;
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: none;
    min-height: 0;
}

/* Escritos: editor en móvil / pantalla estrecha */
@media (max-width: 900px) {
    .word-editor-overlay {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .word-editor-overlay-inner--draft {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        max-height: 100dvh;
        overflow: hidden;
    }

    .draft-editor-mobile-hint {
        display: block;
        flex-shrink: 0;
    }

    .draft-editor-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1500;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
    }

    .draft-editor-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1505;
        width: min(100%, 22rem);
        max-width: 92vw;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
    }

    .word-editor-overlay-inner--draft.is-assistant-open .draft-editor-sidebar {
        transform: translateX(0);
    }

    .draft-editor-sidebar-close-mobile {
        display: inline-flex;
    }

    .draft-editor-main {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .draft-editor-main > .word-editor {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .draft-kalex-toolbar-btn--hide-when-open {
        display: inline-flex !important;
    }

    .word-editor-chrome {
        flex-shrink: 0;
    }

    .word-editor-title-row {
        flex-wrap: wrap;
        padding: 0.45rem 0.65rem 0.25rem;
        gap: 0.35rem;
    }

    .word-editor-header-actions {
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        gap: 0.35rem;
    }

    .word-editor-badge {
        width: 100%;
        margin: 0 0 0.15rem;
        order: -1;
    }

    .word-editor-back span {
        display: none;
    }

    .word-editor-menubar {
        padding: 0 0.65rem 0.3rem;
        flex-shrink: 0;
    }

    .word-editor-menu-hint {
        display: none;
    }

    .word-editor-ribbon {
        flex-shrink: 0;
    }

    .word-editor-ribbon-head {
        display: none;
    }

    /* Área con scroll: el documento vive aquí (touch en iOS/Android) */
    .word-editor-main {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .word-editor-workspace {
        padding: 0.5rem 0.25rem 1rem;
        transform: none;
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    .word-editor-page {
        width: 100%;
        max-width: 100%;
        min-height: auto;
        margin: 0 auto 0.75rem;
    }

    .word-editor-page-body {
        min-height: auto;
        padding: 1rem 0.75rem;
    }

    .word-editor-ck-host {
        min-height: 12rem;
    }

    .word-editor-page .word-editor-ck-host .ck-editor__editable,
    .word-editor-page .word-editor-ck-host .ck.ck-content.ck-editor__editable {
        min-height: 12rem !important;
    }

    .word-editor-statusbar {
        flex-shrink: 0;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }
}

/* Móvil estrecho: botones del encabezado en rejilla (evita solapamientos) */
@media (max-width: 520px) {
    .word-editor-header-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem;
        width: 100%;
    }

    .word-editor-header-actions .word-editor-back {
        grid-column: 1;
    }

    .word-editor-header-actions .draft-kalex-toolbar-btn {
        grid-column: 2;
    }

    .word-editor-header-actions .btn-secondary {
        grid-column: 3;
    }

    .word-editor-header-actions .btn-save {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: center;
    }

    .word-editor-header-actions .word-editor-save-ok {
        grid-column: 1 / -1;
        text-align: center;
    }

    .word-editor-menubar {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .word-editor-menu-btn {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }
}

@media (min-width: 901px) {
    .word-editor-overlay-inner--draft.is-assistant-open .draft-editor-sidebar {
        transform: none;
    }
}

/* CKEditor 5 */
.ck-editor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ck-editor-wrap.has-page-chrome .ck-editor-workspace--page {
    flex: 1;
    overflow: auto;
    padding: 1.25rem 1rem 2rem;
    background: #e8eaed;
    min-height: 0;
}

.ck-editor-page {
    width: 21cm;
    max-width: calc(100% - 1rem);
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.ck-editor-host {
    min-height: 12rem;
}

.ck-editor-host.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: #64748b;
}

.ck-editor-host .ck.ck-editor {
    width: 100%;
}

.ck-editor-host .ck-editor__editable {
    min-height: 24cm;
    padding: 2cm 2.2cm 2.5cm !important;
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #111;
    border: none !important;
    box-shadow: none !important;
}

.ck-editor-wrap.is-readonly .ck-editor-host .ck-editor__editable {
    background: #fff;
}

.ck-editor-wrap.is-readonly .ck.ck-toolbar {
    display: none;
}

.word-editor .ck-editor-wrap,
.word-editor-ck-zoom {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.word-editor-ck-zoom {
    overflow: auto;
}

.workspace-analysis-ck.ck-editor-wrap.has-page-chrome .ck-editor-workspace--page {
    max-height: 52vh;
}

.workspace-analysis-ck .ck-editor-host .ck-editor__editable {
    min-height: 18cm;
}

.ck-editor-fallback {
    flex: 1;
    margin: 1rem;
    padding: 1rem;
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: vertical;
    min-height: 320px;
}

.ck-inline-toolbar {
    margin: 0 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* ── Área de trabajo: uso del periodo y packs ── */
.workspace-usage-panel {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--surface-elevated, #f8fafc);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 8px;
    max-width: 42rem;
}

.workspace-usage-renew {
    font-size: 0.8rem;
    margin: 0 0 0.65rem;
}

.workspace-usage-meter {
    margin-bottom: 0.85rem;
}

.workspace-usage-meter:last-child {
    margin-bottom: 0;
}

.workspace-usage-meter-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.workspace-usage-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.workspace-usage-bar.is-warn .workspace-usage-bar-fill {
    background: #f59e0b;
}

.workspace-usage-bar.is-danger .workspace-usage-bar-fill {
    background: #dc2626;
}

.workspace-usage-bar-fill {
    height: 100%;
    background: #0d9488;
    border-radius: 4px;
    transition: width 0.25s ease;
}

.workspace-usage-detail {
    font-size: 0.78rem;
    margin: 0.35rem 0 0.5rem;
    line-height: 1.4;
}

.workspace-usage-buy {
    margin-top: 0.15rem;
}

.workspace-pack-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
}

.workspace-pack-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.workspace-pack-list li:last-child {
    border-bottom: none;
}

.workspace-pack-modal {
    max-width: 28rem;
}

.workspace-breadcrumb {
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.workspace-breadcrumb a {
    color: inherit;
    text-decoration: underline;
}

.workspace-expedient-picker {
    width: 100%;
}

.workspace-expedient-search {
    margin-bottom: 1.25rem;
    max-width: 24rem;
}

.workspace-expedient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.workspace-expedient-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    text-align: left;
    padding: 1.1rem 1.15rem;
    background: var(--surface-elevated, #fff);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.workspace-expedient-card:hover {
    border-color: #0d9488;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}

.workspace-expedient-card-num {
    font-size: 0.78rem;
    font-weight: 600;
    color: #0d9488;
    letter-spacing: 0.02em;
}

.workspace-expedient-card-title {
    font-size: 1rem;
    line-height: 1.35;
}

.workspace-expedient-card-client {
    font-size: 0.85rem;
}

.workspace-expedient-card-cta {
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

/* Expediente: vigilancia boletín Jalisco */
.exped-boletin-panel {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid #bae6fd;
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.exped-boletin-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.exped-boletin-panel-head-text {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    min-width: 0;
    flex: 1 1 auto;
}

.exped-boletin-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0c4a6e;
}

.exped-boletin-panel-lead {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
}

.exped-boletin-form {
    display: grid;
    gap: 0.65rem;
}

.exped-boletin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.exped-boletin-linked-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
}

.exped-boletin-linked-meta {
    flex: 1 1 10rem;
    min-width: 0;
}

.exped-boletin-actions--end {
    margin-top: 0;
    margin-left: auto;
    justify-content: flex-end;
    flex-shrink: 0;
}

.exped-boletin-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.35rem;
}

.exped-boletin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.42rem 0.9rem;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.exped-boletin-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.exped-boletin-btn--sync {
    background: #0ea5e9;
    color: #fff;
    border-color: #0284c7;
    box-shadow: 0 1px 2px rgba(14, 165, 233, 0.25);
}

.exped-boletin-btn--sync:hover:not(:disabled) {
    background: #0284c7;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
}

.exped-boletin-btn--link {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
    border-color: #0284c7;
    box-shadow: 0 1px 2px rgba(14, 165, 233, 0.25);
    padding: 0.48rem 1.1rem;
}

.exped-boletin-btn--link:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
}

.exped-boletin-btn--unlink {
    background: #fff;
    color: #64748b;
    border-color: #e2e8f0;
}

.exped-boletin-btn--unlink:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.exped-boletin-candidates {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.exped-boletin-candidate-btn {
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.exped-boletin-candidate-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.exped-boletin-candidate-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}

.exped-boletin-candidate-desc {
    font-size: 0.88rem;
    color: #0f172a;
}

.exped-boletin-candidate-parties {
    font-size: 0.8rem;
    line-height: 1.45;
}

.exped-boletin-candidate-action {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0284c7;
    margin-top: 0.15rem;
}

.exped-boletin-candidate-btn:hover:not(:disabled) {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.court-catalog-picker {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.court-catalog-picker-hint {
    font-size: .88rem;
    margin: 0;
}

.court-catalog-picker-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .45rem;
}

.court-catalog-matter-chips {
    flex-wrap: wrap;
}

.court-catalog-search {
    margin-bottom: .5rem;
}

.court-catalog-court-field {
    gap: .5rem;
}

.court-catalog-selected {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    background: linear-gradient(180deg, #f0f9ff 0%, #fff 100%);
}

.court-catalog-selected-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
    flex-shrink: 0;
}

.court-catalog-selected-body {
    flex: 1;
    min-width: 0;
}

.court-catalog-selected-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #0369a1;
    margin-bottom: .2rem;
}

.court-catalog-selected-name {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
}

.court-catalog-selected-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-shrink: 0;
}

.court-catalog-combobox {
    position: relative;
    display: flex;
    align-items: center;
}

.court-catalog-combobox-icon {
    position: absolute;
    left: .75rem;
    color: #94a3b8;
    pointer-events: none;
    display: flex;
}

.court-catalog-combobox-input {
    padding-left: 2.35rem !important;
    padding-right: 2.25rem !important;
}

.court-catalog-combobox-clear {
    position: absolute;
    right: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.court-catalog-combobox-clear:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.court-catalog-picker-count {
    font-size: .78rem;
    margin: .35rem 0 .25rem;
}

.court-catalog-browse-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .35rem;
    padding: .45rem .75rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: .85rem;
    cursor: pointer;
}

.court-catalog-browse-btn:hover:not(:disabled) {
    border-color: #0ea5e9;
    color: #0369a1;
    background: #f0f9ff;
}

.court-catalog-court-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: .35rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}

.court-catalog-court-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    width: 100%;
    text-align: left;
    padding: .55rem .65rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.court-catalog-court-item-name {
    font-size: .88rem;
    line-height: 1.35;
    color: #0f172a;
}

.court-catalog-court-item-matter {
    font-size: .72rem;
    color: #64748b;
}

.court-catalog-court-item:hover:not(:disabled) {
    background: #f1f5f9;
}

.court-catalog-court-item.is-selected {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.court-catalog-court-item.is-selected .court-catalog-court-item-name {
    font-weight: 600;
    color: #0369a1;
}

.court-catalog-court-item:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.exped-new-section--nested {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

/* —— Área de trabajo: diseño renovado —— */
.content-scroll:has(.workspace-landing),
.content-scroll:has(.workspace-page) {
    padding: 1.25rem 1.5rem 2rem;
}

.workspace-page,
.workspace-landing {
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
    padding: 0.25rem 0 1.5rem;
    box-sizing: border-box;
}

.workspace-page-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem 1.5rem;
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #fffbeb 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.workspace-page-hero-main {
    flex: 1;
    min-width: min(100%, 280px);
}

.workspace-page-hero-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-top: 0.35rem;
}

.workspace-page-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #1d4ed8;
}

.workspace-page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    font-family: var(--font-serif, Georgia, serif);
}

.workspace-page-sub {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.workspace-page-case {
    font-weight: 600;
    color: #334155;
}

.workspace-page-dot {
    opacity: 0.5;
}

.workspace-matter-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.workspace-page-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
}

.workspace-page-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.workspace-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.82rem;
    margin-bottom: 0;
}

.workspace-breadcrumb a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.workspace-breadcrumb a:hover {
    text-decoration: underline;
}

.workspace-breadcrumb-sep {
    color: #94a3b8;
    flex-shrink: 0;
}

.workspace-segmented-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.35rem;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.workspace-segmented-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.workspace-segmented-tab:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.65);
    color: #334155;
}

.workspace-segmented-tab.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.workspace-segmented-tab.is-active svg {
    color: #b59410;
}

.workspace-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
    gap: 0.65rem;
}

.workspace-empty-state--cta {
    max-width: 32rem;
    margin: 0 auto 1rem;
}

.workspace-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
    margin-bottom: 0.25rem;
}

.workspace-empty-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.workspace-empty-lead {
    margin: 0;
    max-width: 26rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.workspace-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.workspace-docs-section {
    margin-top: 0.25rem;
}

.workspace-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.85rem;
}

.workspace-doc-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    padding-right: 2.75rem;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.workspace-doc-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.workspace-doc-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.workspace-doc-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    color: #1d4ed8;
}

.workspace-doc-card-body {
    flex: 1;
    min-width: 0;
}

.workspace-doc-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.workspace-doc-card-file {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-word;
}

.workspace-doc-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    margin-top: 0.55rem;
}

.workspace-doc-card-origin {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.workspace-doc-card-pages {
    font-size: 0.75rem;
}

.workspace-doc-card-date {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
}

.workspace-doc-card-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.workspace-doc-card-delete:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.workspace-drawer-inner {
    padding: 1.15rem 1.25rem 1.5rem;
}

.workspace-drawer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
}

.workspace-drawer-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.workspace-drawer-tab:hover:not(.is-active) {
    background: #f8fafc;
    color: #334155;
}

.workspace-drawer-tab.is-active {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    border-color: transparent;
    color: #fff;
}

.workspace-drawer-tab.is-active svg {
    color: inherit;
}

.workspace-drawer-tab--ghost {
    margin-left: auto;
    border-style: dashed;
    background: transparent;
}

.workspace-form-card {
    padding: 1.1rem 1.15rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.workspace-form-lead {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.workspace-form-submit {
    width: 100%;
    margin-top: 0.75rem;
}

.workspace-pick-modal {
    max-width: min(640px, 96vw);
}

.workspace-pick-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.workspace-pick-modal-header h3 {
    margin: 0;
}

.workspace-pick-modal-sub {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
}

.workspace-pick-search {
    position: relative;
    margin-bottom: 0.75rem;
}

.workspace-pick-search .input {
    padding-left: 2.35rem;
}

.workspace-pick-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.workspace-pick-list {
    border-radius: 10px;
    background: #fff;
}

.workspace-pick-row {
    transition: background 0.12s;
}

.workspace-pick-row:has(input:checked) {
    background: #eff6ff;
}

.workspace-detail-drawer-backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.workspace-analysis-drawer .workspace-doc-header {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

/* Landing expedientes */
.workspace-landing-hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.workspace-landing-body {
    padding: 0 0.15rem;
}

.workspace-landing-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: #fff;
}

.workspace-landing-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-serif, Georgia, serif);
    color: #0f172a;
}

.workspace-landing-lead {
    margin: 0.4rem 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    max-width: 52rem;
}

.workspace-expedient-search-wrap {
    position: relative;
}

.workspace-expedient-search-wrap .input {
    padding-left: 2.35rem;
}

.workspace-expedient-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.workspace-expedient-card {
    border-radius: 12px;
    padding: 1.15rem 1.2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.workspace-expedient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.12);
}

/* Escritos */
.workspace-drafts-section {
    margin-top: 0.25rem;
}

.workspace-drafts-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.workspace-drafts-heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.workspace-drafts-sub {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
}

.workspace-drafts-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.workspace-draft-card {
    border-radius: 12px;
    border-color: #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

@media (max-width: 768px) {
    .content-scroll:has(.workspace-landing),
    .content-scroll:has(.workspace-page) {
        padding: 0.85rem 1rem 1.35rem;
    }

    .workspace-page,
    .workspace-landing {
        padding-bottom: 1rem;
    }

    .workspace-page-hero,
    .workspace-landing-hero {
        padding: 1.1rem 1.15rem;
    }

    .workspace-page-hero {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .workspace-page-hero-actions {
        width: 100%;
    }

    .workspace-page-hero-actions .btn-create,
    .workspace-page-hero-actions .btn-secondary {
        flex: 1;
        justify-content: center;
    }

    .workspace-segmented-tabs {
        width: 100%;
    }

    .workspace-segmented-tab {
        flex: 1;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.5rem 0.65rem;
    }

    .workspace-docs-grid {
        grid-template-columns: 1fr;
    }

    .workspace-drawer-tab--ghost {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .workspace-drafts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-drafts-toolbar-actions {
        flex-direction: column;
    }

    .workspace-drafts-toolbar-actions .btn-create,
    .workspace-drafts-toolbar-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

.billing-section-ia {
    margin: 2rem 0;
    max-width: 48rem;
}

.billing-section-title {
    font-size: 1.15rem;
    margin: 0 0 0.35rem;
}

.billing-section-lead {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.billing-section-ia .workspace-usage-panel {
    max-width: none;
}


