@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --ma-brand: #01b3e3;
    --ma-primary: #007c99;
    --ma-primary-dark: #005f78;
    --ma-primary-light: #01b3e3;
    --ma-navy: #10263b;
    --ma-sidebar-bg: #ffffff;
    --ma-sidebar-fg: #526675;
    --ma-sidebar-active: #e7f7fb;
    --ma-accent: #01b3e3;
    --ma-radius-field: 12px;
    --ma-radius-card: 16px;
    --ma-field-height: 48px;
    --ma-navbar-height: 76px;
    --ma-sidebar-width: 272px;
    --ma-bg: #f4f7f9;
    --ma-text: #172733;
    --ma-text-muted: #637785;
    --ma-card-bg: #ffffff;
    --ma-card-border: #d9e5ea;
    --ma-card-shadow: 0 1px 2px rgba(16,38,59,.03), 0 10px 30px rgba(16,38,59,.055);
    --ma-hover-bg: #edf6f9;
    --ma-border-light: #d9e5ea;
    --ma-crono-bg: linear-gradient(145deg, #f5fbfd, #e7f5f9);
    --ma-crono-border: #bee5ef;
    --ma-crono-label: var(--ma-primary);
    --ma-crono-text: #1e293b;
    --ma-crono-muted: #64748b;
    --ma-crono-time: #94a3b8;
    --ma-crono-time-active: var(--ma-primary);
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --ma-primary: #19a9cc;
    --ma-primary-dark: #39c5e6;
    --ma-primary-light: #27c4ec;
    --ma-sidebar-bg: #0d1b2a;
    --ma-sidebar-fg: #a9bac5;
    --ma-sidebar-active: rgba(39,196,236,.12);
    --ma-bg: #09131e;
    --ma-text: #eff6f9;
    --ma-text-muted: #9fb1bd;
    --ma-card-bg: #111f2c;
    --ma-card-border: #293c4b;
    --ma-card-shadow: 0 1px 2px rgba(0,0,0,.2), 0 14px 34px rgba(0,0,0,.18);
    --ma-hover-bg: #192b3a;
    --ma-border-light: #293c4b;
    --ma-crono-bg: linear-gradient(145deg, #102637, #123246);
    --ma-crono-border: rgba(39,196,236,.24);
    --ma-crono-label: var(--ma-accent);
    --ma-crono-text: #fff;
    --ma-crono-muted: rgba(255,255,255,.5);
    --ma-crono-time: rgba(255,255,255,.4);
    --ma-crono-time-active: var(--ma-accent);
}

* { -webkit-font-smoothing: antialiased; }

html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

body {
    background: var(--ma-bg);
    font-family: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    color: var(--ma-text);
    transition: background-color .2s ease, color .2s ease;
}

/* ===== Typography ===== */
h1, .h1 { font: 700 2.125rem/1.22 'Libre Baskerville', Georgia, serif; letter-spacing: -.025em; }
h2, .h2 { font: 700 1.65rem/1.3 'Libre Baskerville', Georgia, serif; letter-spacing: -.02em; }
h3, .h3 { font-size: 1.3rem; font-weight: 700; }
h4, .h4 { font-size: 1.125rem; font-weight: 700; }
h5, .h5 { font-size: 1rem; font-weight: 700; }

@media (max-width: 767.98px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.4rem; }
}

/* ===== Navbar ===== */
.app-navbar {
    background: linear-gradient(105deg, #0d2032, #102f46 68%, #0b354b);
    min-height: var(--ma-navbar-height);
    border-bottom: 1px solid rgba(1,179,227,.2);
    box-shadow: 0 8px 30px rgba(5,22,35,.13);
    position: relative;
    z-index: 1040;
}
.app-navbar .container-fluid { min-height: var(--ma-navbar-height); }
.app-navbar .navbar-brand {
    letter-spacing: .3px;
    padding: 0;
    display: flex;
    align-items: center;
}
.app-navbar .navbar-brand img { height: 40px; width: auto; }
.app-navbar .btn-outline-light {
    border-radius: var(--ma-radius-field);
    font-size: .9rem;
}
.app-navbar .dropdown-toggle {
    border-radius: var(--ma-radius-field);
    font-size: .9rem;
    font-weight: 500;
}

/* ===== Shell ===== */
.app-shell { display: flex; min-height: calc(100vh - var(--ma-navbar-height)); }
.app-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.app-footer { margin-top: auto; font-size: 13px; color: var(--ma-text-muted); }

/* ===== Sidebar ===== */
.app-sidebar {
    width: var(--ma-sidebar-width);
    background: var(--ma-sidebar-bg);
    flex-shrink: 0;
    border-right: 1px solid var(--ma-border-light);
    transition: background-color .2s ease, border-color .2s ease;
}
.app-sidebar .nav { padding: 1.35rem .9rem; }
.app-sidebar .nav-link {
    color: var(--ma-sidebar-fg);
    border-radius: var(--ma-radius-field);
    margin-bottom: 4px;
    font-size: .965rem;
    font-weight: 600;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: .75rem;
    transition: all .15s;
}
.app-sidebar .nav-link:hover {
    background: var(--ma-hover-bg);
    color: var(--ma-primary);
    transform: translateX(1px);
}
.app-sidebar .nav-link.active {
    background: var(--ma-sidebar-active);
    color: var(--ma-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--ma-brand);
}
.app-sidebar .nav-ico {
    display: inline-flex;
    width: 1.25rem;
    height: 1.25rem;
    align-items: center;
    justify-content: center;
    opacity: .88;
    flex: 0 0 1.25rem;
}
.app-sidebar .nav-ico svg { width: 19px; height: 19px; }
.app-sidebar .nav-section {
    color: var(--ma-text-muted);
    font-size: .75rem;
    letter-spacing: .13em;
    padding: 1.35rem .9rem .55rem;
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .app-sidebar { width: 280px; }
    /* En celular el menú es un cajón lateral (no toda la pantalla): se ve un borde de la página y se cierra al tocarla. */
    .app-sidebar.offcanvas-start { width: min(300px, 86vw); box-shadow: 0 0 40px rgba(16,38,59,.35); }
}

/* ===== Forms ===== */
.form-control, .form-select {
    height: var(--ma-field-height);
    border-radius: var(--ma-radius-field);
    font-size: 1rem;
    border-color: var(--ma-border-light);
    background: var(--ma-card-bg);
    color: var(--ma-text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ma-primary-light);
    box-shadow: 0 0 0 3px rgba(0,153,184,.12);
}
textarea.form-control { height: auto; min-height: 100px; }
.form-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ma-text-muted);
    margin-bottom: .4rem;
    letter-spacing: .01em;
}

/* ===== Buttons ===== */
.btn {
    height: var(--ma-field-height);
    border-radius: var(--ma-radius-field);
    font-size: .965rem;
    font-weight: 600;
    padding: .5rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: all .15s;
}
.btn:active { transform: scale(.97); }
.btn-sm {
    min-height: 38px;
    height: auto;
    font-size: .875rem;
    padding: .35rem .85rem;
}

.btn-primary {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
    box-shadow: 0 1px 3px rgba(0,153,184,.2);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--ma-primary-dark);
    border-color: var(--ma-primary-dark);
    box-shadow: 0 4px 12px rgba(0,153,184,.3);
}
.btn-outline-primary {
    color: var(--ma-primary);
    border-color: var(--ma-primary);
}
.btn-outline-primary:hover {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
    color: #fff;
}

/* Theme toggle button */
#theme-toggle {
    width: 82px;
    height: 42px;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: rgba(231,244,250,.62);
    cursor: pointer;
    transition: background-color .2s, border-color .2s, transform .2s;
}
#theme-toggle:hover {
    background: rgba(255,255,255,.18);
    transform: translateY(-1px);
}
.theme-option {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color .2s, background-color .2s, box-shadow .2s, transform .2s;
}
#theme-toggle .theme-option-light {
    color: #10263b;
    background: #fff;
    box-shadow: 0 2px 8px rgba(4,20,32,.22);
}
#theme-toggle .theme-option-dark { color: rgba(231,244,250,.55); }
[data-theme="dark"] #theme-toggle .theme-option-light {
    color: rgba(231,244,250,.48);
    background: transparent;
    box-shadow: none;
}
[data-theme="dark"] #theme-toggle .theme-option-dark {
    color: #10263b;
    background: #e9f4f8;
    box-shadow: 0 2px 8px rgba(0,0,0,.32);
}
#theme-toggle #theme-icon-light {
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
}
#theme-toggle #theme-icon-dark {
    fill: currentColor;
    stroke: none;
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--ma-card-border);
    border-radius: var(--ma-radius-card);
    background: var(--ma-card-bg);
    box-shadow: var(--ma-card-shadow);
    transition: box-shadow .2s, transform .2s;
}
.card-header {
    border-radius: var(--ma-radius-card) var(--ma-radius-card) 0 0;
    font-size: 1.1rem;
    font-weight: 700;
    background: transparent;
    border-bottom: 1px solid var(--ma-border-light);
    padding: 1rem 1.25rem;
}
.card-body { padding: 1.4rem; }

/* ===== Tables ===== */
.table { font-size: .93rem; color: var(--ma-text); }
.table th {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ma-text-muted);
    border-bottom-width: 2px;
    padding: .85rem 1rem;
}
.table td { padding: .9rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(0,153,184,.03); }

/* ===== Auth ===== */
.auth-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    background: var(--ma-bg);
    padding: 0;
}
.auth-card {
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
}
.auth-logo { width: 100%; max-width: 310px; height: auto; }

/* ===== Colores utilitarios ===== */
.text-primary { color: var(--ma-primary) !important; }
a { color: var(--ma-primary); }
a:hover { color: var(--ma-primary-dark); }

.badge-risk-bajo  { background: #16a34a; }
.badge-risk-medio { background: #d97706; }
.badge-risk-alto  { background: #dc2626; }

/* ===== Dashboard Tempo ===== */
.tempo-greeting { padding-top: .5rem; }
.tempo-date {
    font-size: 14px;
    color: var(--ma-text-muted);
    font-weight: 500;
    margin-bottom: .25rem;
}
.tempo-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--ma-text);
    margin-bottom: .25rem;
    line-height: 1.15;
}
.tempo-subtitle {
    font-size: 15px;
    color: var(--ma-text-muted);
    margin-bottom: 0;
}

.tempo-stat-card .card-body { padding: 1.25rem; }
.tempo-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,153,184,.1), 0 0 0 1px rgba(0,153,184,.15);
}
.tempo-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.tempo-icon-blue  { background: #dbeafe; color: #2563eb; }
.tempo-icon-cyan  { background: #e0f9f4; color: #0099b8; }
.tempo-icon-green { background: #dcfce7; color: #16a34a; }
.tempo-icon-orange { background: #fef3c7; color: #d97706; }
[data-theme="dark"] .tempo-icon-blue  { background: rgba(37,99,235,.15); }
[data-theme="dark"] .tempo-icon-cyan  { background: rgba(0,153,184,.15); }
[data-theme="dark"] .tempo-icon-green { background: rgba(22,163,74,.15); }
[data-theme="dark"] .tempo-icon-orange { background: rgba(217,119,6,.15); }

.tempo-stat-label {
    font-size: 13px;
    color: var(--ma-text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}
.tempo-stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ma-text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.tempo-stat-meta {
    font-size: 12px;
    color: var(--ma-text-muted);
    margin-top: 2px;
}

/* Progress bar in stat cards */
.tempo-stat-progress {
    height: 4px;
    background: var(--ma-border-light);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.tempo-stat-bar {
    height: 100%;
    background: var(--ma-primary);
    border-radius: 2px;
    transition: width .6s ease-out;
}
.tempo-bar-orange { background: #d97706; }

.tempo-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ma-text);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.tempo-section-meta {
    font-size: 13px;
    color: var(--ma-text-muted);
}

/* Activity list */
.tempo-activity-list {}
.tempo-activity-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ma-border-light);
    transition: background .15s;
}
.tempo-activity-item:last-child { border-bottom: 0; }
.tempo-activity-item:hover { background: var(--ma-hover-bg); }
.tempo-activity-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--ma-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 50px;
}
.tempo-activity-body { flex: 1; min-width: 0; }
.tempo-activity-desc {
    font-size: 14px;
    font-weight: 600;
    color: var(--ma-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tempo-activity-meta {
    font-size: 13px;
    color: var(--ma-text-muted);
}
.tempo-activity-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
}
.tempo-activity-duration {
    font-size: 14px;
    font-weight: 600;
    color: var(--ma-text);
}
.tempo-activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.tempo-empty-icon { opacity: .5; }
.tempo-btn-register {
    height: 48px;
    font-size: 15px;
    padding: .5rem 1.5rem;
    border-radius: var(--ma-radius-card);
}

/* Facturable tags */
.tempo-facturable-tag {
    color: #16a34a;
    font-weight: 600;
    font-size: 12px;
}
.tempo-nofact-tag {
    color: #94a3b8;
    font-size: 12px;
}

/* Tasks */
.tempo-task-list {}
.tempo-task-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ma-border-light);
    transition: background .15s;
}
.tempo-task-item:last-child { border-bottom: 0; }
.tempo-task-item:hover { background: var(--ma-hover-bg); }
.tempo-task-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ma-text);
    margin-bottom: 2px;
}
.tempo-task-date {
    font-size: 12px;
    color: var(--ma-text-muted);
}
.tempo-badge {
    font-size: 11px;
    font-weight: 600;
    padding: .3rem .6rem;
    border-radius: 8px;
    text-transform: capitalize;
}

/* ===== Work Orders on Dashboard ===== */
.wo-mini-card {
    text-align: center;
}
.wo-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,153,184,.1);
}
.wo-mini-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--ma-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.wo-mini-active { color: #2563eb; }
.wo-mini-done { color: #16a34a; }
.wo-mini-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ma-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.wo-numero {
    font-size: 14px;
    font-weight: 700;
    color: var(--ma-primary);
    white-space: nowrap;
    min-width: 70px;
}
.wo-estado-card {
    transition: transform .15s, box-shadow .15s;
}
.wo-estado-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* ===== Tom Select overrides ===== */
.ts-wrapper .ts-control {
    height: var(--ma-field-height);
    border-radius: var(--ma-radius-field) !important;
    border-color: var(--ma-border-light);
    font-size: 14px;
    padding: 6px 12px !important;
}
.ts-wrapper .ts-control input { font-size: 14px !important; }
.ts-wrapper.focus .ts-control {
    border-color: var(--ma-primary-light) !important;
    box-shadow: 0 0 0 3px rgba(0,153,184,.12) !important;
}
.ts-dropdown { border-radius: var(--ma-radius-field) !important; font-size: 14px; }
.ts-dropdown .option.active { background: var(--ma-primary) !important; }

/* Tom Select inside cronómetro (adapts to theme) */
.crono-widget .ts-wrapper .ts-control {
    background: rgba(0,153,184,.06) !important;
    border-color: var(--ma-crono-border) !important;
    color: var(--ma-crono-text) !important;
}
.crono-widget .ts-wrapper .ts-control input {
    color: var(--ma-crono-text) !important;
}
.crono-widget .ts-wrapper.focus .ts-control {
    border-color: var(--ma-primary) !important;
    box-shadow: 0 0 0 3px rgba(0,153,184,.15) !important;
}
.crono-widget .ts-wrapper .ts-control .item { color: var(--ma-crono-text); }

/* Dark mode cronómetro Tom Select */
[data-theme="dark"] .crono-widget .ts-wrapper .ts-control {
    background: rgba(255,255,255,.1) !important;
    border-color: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
[data-theme="dark"] .crono-widget .ts-wrapper .ts-control input {
    color: #fff !important;
}
[data-theme="dark"] .crono-widget .ts-wrapper .ts-control input::placeholder {
    color: rgba(255,255,255,.4) !important;
}
[data-theme="dark"] .crono-widget .ts-wrapper.focus .ts-control {
    border-color: var(--ma-accent) !important;
    box-shadow: 0 0 0 3px rgba(0,212,255,.2) !important;
}
[data-theme="dark"] .crono-widget .ts-wrapper .ts-control .item { color: #fff; }

/* ===== Facturable toggle ===== */
.facturable-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--ma-radius-field);
}
[data-theme="dark"] .facturable-toggle {
    background: rgba(22,163,74,.1);
    border-color: rgba(22,163,74,.25);
}
.facturable-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ma-text);
    display: block;
}
.facturable-hint {
    font-size: 12px;
    color: var(--ma-text-muted);
    display: block;
}
.facturable-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.facturable-switch input { display: none; }
.facturable-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
}
.facturable-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.facturable-switch input:checked + .facturable-slider {
    background: #16a34a;
}
.facturable-switch input:checked + .facturable-slider::before {
    transform: translateX(20px);
}

/* ===== Cronómetro Rápido (Light by default) ===== */
.crono-widget {
    background: var(--ma-crono-bg);
    border: 2px solid var(--ma-crono-border);
    border-radius: var(--ma-radius-card);
    padding: 1.5rem;
    color: var(--ma-crono-text);
    position: relative;
    overflow: hidden;
}
.crono-widget::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    background: rgba(0,153,184,.06);
    border-radius: 50%;
}
.crono-active {
    border-color: var(--ma-primary);
    box-shadow: 0 0 0 2px var(--ma-primary), 0 8px 32px rgba(0,153,184,.12);
}
[data-theme="dark"] .crono-active {
    border-color: var(--ma-accent);
    box-shadow: 0 0 0 2px var(--ma-accent), 0 8px 32px rgba(0,212,255,.2);
}
.crono-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}
.crono-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--ma-crono-label);
}
.crono-header svg { opacity: .4; color: var(--ma-crono-muted); }
.crono-question {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: .75rem;
    color: var(--ma-crono-text);
}
.crono-select {
    background: rgba(0,153,184,.06) !important;
    border: 1px solid var(--ma-crono-border) !important;
    color: var(--ma-crono-text) !important;
    border-radius: var(--ma-radius-field) !important;
    height: var(--ma-field-height);
}
.crono-select option { color: #1e293b; background: #fff; }
.crono-select:focus {
    border-color: var(--ma-primary) !important;
    box-shadow: 0 0 0 3px rgba(0,153,184,.15) !important;
}
[data-theme="dark"] .crono-select {
    background: rgba(255,255,255,.1) !important;
    border-color: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
[data-theme="dark"] .crono-select:focus {
    border-color: var(--ma-accent) !important;
    box-shadow: 0 0 0 3px rgba(0,212,255,.2) !important;
}
.crono-time {
    font-size: 36px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .06em;
    color: var(--ma-crono-time);
    text-align: center;
    margin: 1rem 0;
}
.crono-time-active {
    color: var(--ma-crono-time-active);
    animation: crono-pulse 2s ease-in-out infinite;
}
[data-theme="dark"] .crono-time-active {
    text-shadow: 0 0 20px rgba(0,212,255,.3);
}
@keyframes crono-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .85; }
}
.crono-hint {
    font-size: 12px;
    color: var(--ma-crono-muted);
    text-align: center;
    margin-bottom: .75rem;
}
.crono-play-btn, .crono-stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    margin: 0 auto;
    transition: all .15s;
}
.crono-play-btn {
    background: var(--ma-primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,153,184,.25);
}
.crono-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,153,184,.35);
    background: var(--ma-primary-dark);
}
.crono-stop-btn {
    background: #dc2626;
    color: #fff;
    box-shadow: 0 4px 16px rgba(220,38,38,.3);
}
.crono-stop-btn:hover { transform: scale(1.08); }
.crono-popout-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--ma-border-light);
    background: transparent;
    color: var(--ma-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
}
.crono-popout-btn:hover {
    border-color: var(--ma-primary);
    color: var(--ma-primary);
    background: rgba(0,153,184,.06);
}
[data-theme="dark"] .crono-popout-btn {
    border-color: rgba(255,255,255,.2);
    color: rgba(255,255,255,.6);
}
[data-theme="dark"] .crono-popout-btn:hover {
    border-color: var(--ma-accent);
    color: var(--ma-accent);
    background: rgba(0,212,255,.1);
}
.crono-running-client {
    font-size: 14px;
    color: var(--ma-crono-muted);
    text-align: center;
    margin-bottom: .25rem;
}
.crono-save-time {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--ma-primary);
}
[data-theme="dark"] .crono-save-time { color: var(--ma-accent); }
.crono-form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ma-crono-muted);
    margin-bottom: .3rem;
    display: block;
}
.crono-textarea {
    background: rgba(0,153,184,.04) !important;
    border: 1px solid var(--ma-crono-border) !important;
    color: var(--ma-crono-text) !important;
    border-radius: var(--ma-radius-field) !important;
}
.crono-textarea:focus {
    border-color: var(--ma-primary) !important;
    box-shadow: 0 0 0 3px rgba(0,153,184,.12) !important;
}
[data-theme="dark"] .crono-textarea {
    background: rgba(255,255,255,.1) !important;
    border-color: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
[data-theme="dark"] .crono-textarea::placeholder { color: rgba(255,255,255,.35) !important; }
[data-theme="dark"] .crono-textarea:focus {
    border-color: var(--ma-accent) !important;
    box-shadow: 0 0 0 3px rgba(0,212,255,.2) !important;
}
#crono-save .btn-primary {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
    color: #fff;
    font-weight: 700;
}
[data-theme="dark"] #crono-save .btn-primary {
    background: var(--ma-accent);
    border-color: var(--ma-accent);
    color: var(--ma-sidebar-bg);
}
#crono-save .btn-outline-secondary {
    color: var(--ma-text-muted);
    border-color: var(--ma-border-light);
}
#crono-save .btn-outline-secondary:hover {
    background: var(--ma-hover-bg);
}
[data-theme="dark"] #crono-save .btn-outline-secondary {
    color: rgba(255,255,255,.6);
    border-color: rgba(255,255,255,.2);
}
[data-theme="dark"] #crono-save .btn-outline-secondary:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

/* ===== Cronómetro barra (actividades) ===== */
.crono-bar {
    background: var(--ma-crono-bg);
    border: 2px solid var(--ma-crono-border);
    border-radius: var(--ma-radius-card);
    padding: 1rem 1.25rem;
    color: var(--ma-crono-text);
}
.crono-bar.crono-active {
    border-color: var(--ma-primary);
    box-shadow: 0 0 0 2px var(--ma-primary), 0 8px 32px rgba(0,153,184,.1);
}
[data-theme="dark"] .crono-bar.crono-active {
    border-color: var(--ma-accent);
    box-shadow: 0 0 0 2px var(--ma-accent), 0 8px 32px rgba(0,212,255,.15);
}
.crono-bar-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.crono-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.crono-bar-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--ma-crono-label);
    white-space: nowrap;
}
.crono-bar-select {
    width: 200px;
    background: rgba(0,153,184,.06) !important;
    border: 1px solid var(--ma-crono-border) !important;
    color: var(--ma-crono-text) !important;
    border-radius: var(--ma-radius-field) !important;
    height: 38px !important;
    font-size: 13px;
}
[data-theme="dark"] .crono-bar-select {
    background: rgba(255,255,255,.1) !important;
    border-color: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
.crono-bar-select option { color: #1e293b; background: #fff; }
.crono-bar-center { display: flex; align-items: center; }
.crono-bar-time {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ma-crono-time);
    letter-spacing: .04em;
}
.crono-bar-time-active {
    color: var(--ma-crono-time-active);
}
[data-theme="dark"] .crono-bar-time-active {
    text-shadow: 0 0 12px rgba(0,212,255,.2);
}
.crono-play-sm {
    width: 40px !important; height: 40px !important;
}
.crono-stop-sm {
    width: 36px !important; height: 36px !important;
}
.crono-popout-sm {
    width: 32px !important; height: 32px !important;
    border-width: 1px !important;
}
.crono-save-time-sm {
    font-size: 15px;
    font-weight: 700;
    color: var(--ma-primary);
    white-space: nowrap;
}
[data-theme="dark"] .crono-save-time-sm { color: var(--ma-accent); }
.crono-bar #crono-save .form-control,
.crono-bar #crono-save .form-select {
    background: rgba(0,153,184,.04) !important;
    border-color: var(--ma-crono-border) !important;
    color: var(--ma-crono-text) !important;
    font-size: 13px;
}
[data-theme="dark"] .crono-bar #crono-save .form-control,
[data-theme="dark"] .crono-bar #crono-save .form-select {
    background: rgba(255,255,255,.1) !important;
    border-color: rgba(255,255,255,.15) !important;
    color: #fff !important;
}
[data-theme="dark"] .crono-bar #crono-save .form-control::placeholder { color: rgba(255,255,255,.4) !important; }
.crono-bar #crono-save .btn-primary {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
    color: #fff;
}
[data-theme="dark"] .crono-bar #crono-save .btn-primary {
    background: var(--ma-accent);
    border-color: var(--ma-accent);
    color: var(--ma-sidebar-bg);
}
.crono-bar #crono-save .btn-outline-secondary {
    color: var(--ma-text-muted);
    border-color: var(--ma-border-light);
}
[data-theme="dark"] .crono-bar #crono-save .btn-outline-secondary {
    color: rgba(255,255,255,.6);
    border-color: rgba(255,255,255,.2);
}

/* ===== Cronómetro PiP (flotante) ===== */
.crono-pip {
    position: fixed;
    z-index: 9999;
    width: 220px;
    background: linear-gradient(135deg, #112233, #0d3a4a);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(0,212,255,.2);
    color: #fff;
    overflow: hidden;
    transition: box-shadow .2s;
    animation: crono-pip-in .3s ease-out;
}
@keyframes crono-pip-in {
    from { opacity: 0; transform: translateY(20px) scale(.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.crono-pip:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 0 1px rgba(0,212,255,.35);
}
.crono-pip-drag {
    padding: 12px 16px;
    cursor: grab;
    user-select: none;
}
.crono-pip-drag:active { cursor: grabbing; }
.crono-pip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.crono-pip-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--ma-accent);
}
.crono-pip-actions { display: flex; gap: 4px; }
.crono-pip-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
}
.crono-pip-btn:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
}
#crono-pip-stop:hover {
    background: rgba(220,38,38,.6);
    color: #fff;
}
.crono-pip-client {
    font-size: 12px;
    color: rgba(255,255,255,.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.crono-pip-time {
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ma-accent);
    text-shadow: 0 0 16px rgba(0,212,255,.25);
    letter-spacing: .02em;
}

/* ===== Actividades: selector de tiempo ===== */
.tiempo-display {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: var(--ma-radius-card);
    padding: 1.75rem;
    border: 2px solid var(--ma-primary-light);
    transition: transform .15s;
}
.tiempo-display.pulse { transform: scale(1.03); }
.tiempo-horas, .tiempo-mins {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--ma-sidebar-bg);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}
.tiempo-sep {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--ma-primary);
    animation: blink 1.5s step-end infinite;
}
@keyframes blink { 50% { opacity: .3; } }
.tiempo-chip {
    min-width: 64px;
    font-weight: 600;
    border-radius: 2rem;
    transition: all .15s;
}
.tiempo-chip:active { transform: scale(.93); }
.tiempo-manual-box {
    background: #f8fafc;
    border-radius: var(--ma-radius-field);
    padding: 1rem;
    border: 1px dashed #d9e1e3;
    margin-top: .5rem;
}
.tiempo-manual-box .form-control {
    height: 38px;
    font-size: 16px;
    font-weight: 600;
}

/* ===== 2FA ===== */
.qr-box { display: flex; justify-content: center; }
.totp-secret {
    font-family: ui-monospace, SFMono-Regular, monospace;
    letter-spacing: .12em;
    background: #f1f3f5;
    padding: .5rem .75rem;
    border-radius: var(--ma-radius-field);
    word-break: break-all;
}

/* ===== Selection ===== */
::selection {
    background: #b8e6da;
    color: #073f3c;
}

/* ===== Dropdown ===== */
.dropdown-menu {
    border-radius: var(--ma-radius-field);
    font-size: 14px;
    box-shadow: 0 10px 28px rgba(15,23,42,.1);
    border: 1px solid var(--ma-border-light);
    padding: .5rem;
}
.dropdown-item {
    border-radius: 8px;
    padding: .5rem .75rem;
    font-size: 14px;
}
.dropdown-item:hover { background: var(--ma-hover-bg); }

/* ===== Alerts ===== */
.alert {
    border-radius: var(--ma-radius-field);
    font-size: 14px;
    font-weight: 500;
}

/* ===== Pagination ===== */
.page-link { border-radius: 10px !important; }

/* ===== List group inside cards ===== */
.list-group-flush .list-group-item {
    padding: .85rem 1.25rem;
    font-size: 14px;
}

/* ===== Compact stat strip ===== */
.stat-compact {
    border-left: 3px solid var(--ma-primary);
}
.stat-compact-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ma-text-muted);
    margin-bottom: 1px;
}
.stat-compact-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--ma-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.stat-green { color: #16a34a; }
.stat-cyan { color: var(--ma-primary); }
.stat-blue { color: #2563eb; }
.stat-done { color: #16a34a; }
.stat-compact-meta {
    font-size: 11px;
    color: var(--ma-text-muted);
}
.stat-compact-bar {
    height: 3px;
    background: var(--ma-border-light);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.stat-compact-fill {
    height: 100%;
    background: var(--ma-primary);
    border-radius: 2px;
    transition: width .6s ease-out;
}
.stat-fill-orange { background: #d97706; }

/* ===== Cronómetro Slots (multi-timer) ===== */
.crono-slot {
    border-left: 3px solid var(--ma-border-light);
    transition: border-color .2s, box-shadow .2s;
}
.crono-slot-active {
    border-left-color: var(--ma-primary);
    box-shadow: 0 0 0 1px rgba(0,153,184,.2), 0 4px 12px rgba(0,153,184,.08);
}
[data-theme="dark"] .crono-slot-active {
    border-left-color: var(--ma-accent);
    box-shadow: 0 0 0 1px rgba(0,212,255,.2), 0 4px 12px rgba(0,212,255,.08);
}
.crono-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}
.crono-slot-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--ma-text-muted);
}
.crono-slot-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.crono-slot-idle-badge {
    background: var(--ma-border-light);
    color: var(--ma-text-muted);
}
.crono-slot-running-badge {
    background: rgba(0,153,184,.12);
    color: var(--ma-primary);
}
[data-theme="dark"] .crono-slot-running-badge {
    background: rgba(0,212,255,.15);
    color: var(--ma-accent);
}
.crono-slot-save-badge {
    background: rgba(217,119,6,.12);
    color: #d97706;
}
.crono-slot-time {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ma-text-muted);
    text-align: center;
    margin: .5rem 0;
    letter-spacing: .03em;
}
.crono-slot-time-active {
    color: var(--ma-primary);
    animation: crono-pulse 2s ease-in-out infinite;
}
[data-theme="dark"] .crono-slot-time-active {
    color: var(--ma-accent);
    text-shadow: 0 0 12px rgba(0,212,255,.2);
}
.crono-slot-client-name {
    font-size: 12px;
    color: var(--ma-text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crono-slot-save-time {
    font-size: 16px;
    font-weight: 700;
    color: var(--ma-primary);
    text-align: center;
}
[data-theme="dark"] .crono-slot-save-time {
    color: var(--ma-accent);
}
.crono-slot .form-select-sm,
.crono-slot .form-control-sm {
    font-size: 12px;
    height: 34px;
    border-radius: 8px;
}
.crono-slot textarea.form-control-sm {
    height: auto;
    min-height: auto;
}

/* ===== Cronómetro unified running rows ===== */
.crono-unified {
    border-left: 3px solid var(--ma-primary);
}
.crono-run-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    background: rgba(0,153,184,.04);
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background .15s;
}
.crono-run-row:hover { background: rgba(0,153,184,.08); }
[data-theme="dark"] .crono-run-row { background: rgba(0,212,255,.06); }
[data-theme="dark"] .crono-run-row:hover { background: rgba(0,212,255,.1); }
.crono-run-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ma-primary);
    flex-shrink: 0;
    animation: crono-pulse 2s ease-in-out infinite;
}
[data-theme="dark"] .crono-run-dot { background: var(--ma-accent); }
.crono-run-client {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--ma-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crono-run-time {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ma-primary);
    letter-spacing: .02em;
}
[data-theme="dark"] .crono-run-time { color: var(--ma-accent); }
.crono-run-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--ma-border-light);
    background: transparent;
    color: var(--ma-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .15s;
}
.crono-run-btn:hover {
    border-color: var(--ma-primary);
    color: var(--ma-primary);
}
.crono-run-btn-stop:hover {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}
.crono-save-item {
    padding: .75rem;
    background: rgba(217,119,6,.04);
    border: 1px solid rgba(217,119,6,.15);
    border-radius: 8px;
    margin-bottom: 6px;
}
[data-theme="dark"] .crono-save-item {
    background: rgba(217,119,6,.08);
    border-color: rgba(217,119,6,.2);
}

/* ===== Container fluid padding ===== */
.container-fluid { padding-left: 2rem; padding-right: 2rem; }

@media (max-width: 767.98px) {
    .container-fluid { padding-left: 1rem; padding-right: 1rem; }
    .tempo-title { font-size: 22px; }
    .stat-compact-value { font-size: 18px; }
}

/* ===== Muñoz visual system 2026 ===== */
.app-main > .container-fluid {
    width: min(100%, 1680px);
    padding-top: 2rem !important;
    padding-bottom: 2.5rem !important;
}

.app-footer {
    padding-block: 1.25rem !important;
    font-size: .875rem;
}

a {
    text-underline-offset: .18em;
    text-decoration-thickness: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ma-primary), #006b87);
    border-color: var(--ma-primary);
    box-shadow: 0 6px 16px rgba(0,124,153,.18);
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #138daa, var(--ma-primary));
    border-color: var(--ma-primary);
    color: #fff;
}

.btn-outline-primary {
    background: color-mix(in srgb, var(--ma-primary) 4%, transparent);
}

.btn-outline-secondary {
    color: var(--ma-text-muted);
    border-color: var(--ma-card-border);
}

.form-control,
.form-select,
.ts-wrapper .ts-control {
    box-shadow: 0 1px 2px rgba(16,38,59,.025);
}

.form-control::placeholder,
.ts-wrapper .ts-control input::placeholder {
    color: color-mix(in srgb, var(--ma-text-muted) 72%, transparent);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ma-brand);
    box-shadow: 0 0 0 4px rgba(1,179,227,.13);
}

.card:hover {
    box-shadow: 0 1px 2px rgba(16,38,59,.025), 0 14px 34px rgba(16,38,59,.075);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 18px 38px rgba(0,0,0,.24);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ma-text);
    --bs-table-border-color: var(--ma-border-light);
    margin-bottom: 0;
}

.table th {
    background: color-mix(in srgb, var(--ma-bg) 68%, var(--ma-card-bg));
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--ma-hover-bg);
    color: var(--ma-text);
}

.dropdown-menu,
.modal-content,
.list-group-item,
.accordion-item {
    color: var(--ma-text);
    background-color: var(--ma-card-bg);
    border-color: var(--ma-card-border);
}

.dropdown-menu {
    padding: .5rem;
    box-shadow: 0 18px 45px rgba(9,29,44,.16);
}

.dropdown-item {
    color: var(--ma-text);
    border-radius: 8px;
    padding: .55rem .75rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--ma-primary);
    background: var(--ma-hover-bg);
}

.modal-content {
    border-radius: 20px;
    box-shadow: 0 28px 80px rgba(4,20,32,.24);
}

.modal-header,
.modal-footer {
    border-color: var(--ma-border-light);
}

.alert {
    border-width: 1px;
    font-size: .95rem;
    box-shadow: 0 5px 18px rgba(16,38,59,.045);
}

.badge {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .01em;
    padding: .42em .68em;
}

.pagination {
    gap: .3rem;
}

.page-link {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ma-primary);
    background: var(--ma-card-bg);
    border-color: var(--ma-card-border);
    border-radius: 10px !important;
}

.page-item.active .page-link {
    background: var(--ma-primary);
    border-color: var(--ma-primary);
}

.tempo-title {
    font: 700 2.125rem/1.2 'Libre Baskerville', Georgia, serif;
    letter-spacing: -.025em;
}

.tempo-subtitle { font-size: 1rem; }
.tempo-date { font-size: .9rem; }
.tempo-section-title { font-size: .9rem; letter-spacing: .09em; }
.tempo-section-meta { font-size: .875rem; }
.tempo-stat-label { font-size: .9rem; }
.tempo-stat-meta { font-size: .82rem; }
.tempo-stat-value { font-size: 1.9rem; }
.tempo-activity-time,
.tempo-activity-desc,
.tempo-activity-duration,
.tempo-task-name { font-size: .95rem; }
.tempo-activity-meta,
.tempo-task-date { font-size: .84rem; }
.tempo-badge { font-size: .75rem; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(340px, .92fr) minmax(480px, 1.08fr);
}

.auth-brand-panel {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 5.5rem);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 18% 15%, rgba(1,179,227,.24), transparent 34%),
        linear-gradient(145deg, #0a1d2e 0%, #102b40 56%, #0a3d55 100%);
}

.auth-brand-panel::before,
.auth-brand-panel::after {
    content: '';
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(85,210,239,.2);
    border-radius: 50%;
}

.auth-brand-panel::before {
    width: 520px;
    height: 520px;
    right: -235px;
    top: -160px;
}

.auth-brand-panel::after {
    width: 330px;
    height: 330px;
    right: -110px;
    bottom: -170px;
}

.auth-brand-mark {
    position: relative;
    width: fit-content;
}

.auth-brand-mark::after {
    content: '';
    display: block;
    width: 72px;
    height: 3px;
    margin-top: 1.5rem;
    border-radius: 99px;
    background: var(--ma-brand);
}

.auth-brand-copy {
    max-width: 31rem;
}

.auth-brand-kicker {
    margin-bottom: 1rem;
    color: #79d9f0;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.auth-brand-title {
    margin: 0;
    color: #fff;
    font: 400 clamp(2rem, 3.6vw, 3.7rem)/1.18 'Libre Baskerville', Georgia, serif;
    letter-spacing: -.035em;
}

.auth-brand-foot {
    color: rgba(231,244,250,.62);
    font-size: .875rem;
}

.auth-content-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 5rem);
    background:
        linear-gradient(rgba(1,179,227,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(1,179,227,.035) 1px, transparent 1px),
        var(--ma-bg);
    background-size: 34px 34px;
}

.auth-content-panel .auth-card {
    position: relative;
    margin: 0;
    box-shadow: 0 22px 60px rgba(16,38,59,.12);
}

.auth-card .card-body { padding: clamp(1.75rem, 4vw, 3rem) !important; }

.auth-title {
    margin-bottom: .65rem;
    font-size: 1.75rem;
}

.auth-intro {
    margin-bottom: 1.75rem;
    color: var(--ma-text-muted);
    font-size: 1rem;
}

.auth-theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2;
    color: var(--ma-text-muted) !important;
    background: #dfe7eb !important;
    border-color: var(--ma-card-border) !important;
    box-shadow: 0 8px 24px rgba(16,38,59,.08);
}

[data-theme="dark"] .auth-theme-toggle {
    background: #223442 !important;
}

.auth-card .btn-primary { width: 100%; }

.small,
small { font-size: .875em; }

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel {
        min-height: 225px;
        padding: 2rem;
    }
    .auth-brand-copy { margin-top: 2.5rem; }
    .auth-brand-title { font-size: clamp(1.75rem, 7vw, 2.6rem); }
    .auth-brand-foot { display: none; }
    .auth-content-panel { padding: 2rem 1rem 3rem; }
}

@media (max-width: 767.98px) {
    body { font-size: 16px; }
    .app-main > .container-fluid { padding-top: 1.35rem !important; }
    .app-navbar .navbar-brand img { height: 32px; max-width: 185px; }
    .tempo-title { font-size: 1.7rem; }
    .tempo-stat-card .card-body { padding: 1rem; }
    .tempo-stat-value { font-size: 1.55rem; }
    .table { font-size: .9rem; }
}

@media (min-width: 1800px) {
    body { font-size: 18px; }
    .app-main > .container-fluid { padding-top: 2.35rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ===== Salesforce-inspired workspace, adapted to Muñoz ===== */
html:not([data-theme="dark"]) .app-main {
    background:
        linear-gradient(112deg, rgba(215,228,255,.88), rgba(242,235,255,.82) 68%, rgba(224,245,250,.72)) top / 100% 270px no-repeat,
        var(--ma-bg);
}

[data-theme="dark"] .app-main {
    background:
        linear-gradient(112deg, rgba(25,73,112,.3), rgba(61,46,105,.22) 68%, rgba(12,83,103,.22)) top / 100% 270px no-repeat,
        var(--ma-bg);
}

.dashboard-hero {
    min-height: 150px;
    padding: 1.15rem 1rem 2rem;
    margin-bottom: 1rem;
}

.dashboard-hero .tempo-greeting { padding-top: 0; }

.dashboard-hero .tempo-title {
    margin: .35rem 0 .45rem;
    color: #172b78;
    font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(2rem, 2.1vw, 2.65rem);
    font-weight: 700;
    letter-spacing: -.045em;
}

.dashboard-hero-name { color: #4d67df; }

.dashboard-hero .tempo-date {
    color: #526578;
    font-weight: 600;
}

.dashboard-hero .tempo-subtitle { color: #4c5865; }

[data-theme="dark"] .dashboard-hero .tempo-title { color: #f1f5ff; }
[data-theme="dark"] .dashboard-hero-name { color: #74d6ef; }
[data-theme="dark"] .dashboard-hero .tempo-date,
[data-theme="dark"] .dashboard-hero .tempo-subtitle { color: #afbdca; }

.dashboard-page .card {
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(16,38,59,.035), 0 8px 24px rgba(34,45,75,.055);
}

.dashboard-page .stat-compact {
    border-color: rgba(122,139,166,.2);
    overflow: hidden;
}

.dashboard-page .stat-compact .card-body {
    min-height: 104px;
    padding: 1rem 1.1rem !important;
}

.dashboard-page .stat-compact-label {
    font-size: .78rem;
    letter-spacing: .025em;
}

.dashboard-page .stat-compact-value { font-size: 1.42rem; }

.dashboard-page .tempo-section-title {
    color: #19365b;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

[data-theme="dark"] .dashboard-page .tempo-section-title { color: #deedf5; }

.dashboard-page .tempo-activity-list,
.dashboard-page .tempo-task-list {
    padding: .35rem;
}

.dashboard-page .tempo-activity-item,
.dashboard-page .tempo-task-item {
    margin: .45rem;
    padding: .8rem 1rem !important;
    border: 1px solid var(--ma-card-border) !important;
    border-radius: 16px;
    background: var(--ma-card-bg);
}

.dashboard-page .tempo-activity-item:hover,
.dashboard-page .tempo-task-item:hover {
    border-color: rgba(1,179,227,.38) !important;
    background: var(--ma-hover-bg);
}

.dashboard-page .wo-numero,
.dashboard-page .tempo-activity-desc,
.dashboard-page .tempo-task-name { font-size: .86rem !important; }

.dashboard-page .tempo-activity-meta,
.dashboard-page .tempo-task-date,
.dashboard-page .text-muted[style*="font-size"] { font-size: .78rem !important; }

.dashboard-page .badge[style*="font-size"] { font-size: .7rem !important; }

.dashboard-page table[style*="font-size"] { font-size: .84rem !important; }

.dashboard-page .wo-estado-card {
    min-width: 100px;
    border-radius: 16px;
}

.dashboard-page .crono-unified {
    border-left: 0;
    outline: 3px solid rgba(1,179,227,.08);
    outline-offset: 3px;
}

@media (max-width: 767.98px) {
    html:not([data-theme="dark"]) .app-main,
    [data-theme="dark"] .app-main { background-size: 100% 235px; }
    .dashboard-hero {
        min-height: 132px;
        padding: .75rem 0 1.25rem;
    }
    .dashboard-hero .tempo-title { font-size: 1.8rem; }
    .dashboard-page .stat-compact .card-body { min-height: 94px; }
}

/* ===== Work orders: modern detail and editor ===== */
.work-order-show,
.work-order-form { --wo-soft: rgba(1,179,227,.075); }

.wo-page-header {
    position: relative;
    overflow: hidden;
    padding: clamp(1.4rem, 3vw, 2.1rem);
    border: 1px solid rgba(84,105,223,.12);
    border-radius: 22px;
    background: linear-gradient(115deg, rgba(219,232,255,.92), rgba(240,236,255,.86) 65%, rgba(220,245,250,.9));
    box-shadow: 0 14px 38px rgba(38,54,91,.07);
}

.wo-page-header::after {
    content: '';
    position: absolute;
    width: 190px;
    height: 190px;
    right: -72px;
    top: -112px;
    border: 1px solid rgba(1,179,227,.22);
    border-radius: 50%;
    pointer-events: none;
}

.wo-page-header h1 {
    position: relative;
    z-index: 1;
    color: #18385a;
    font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(1.55rem, 2vw, 2.1rem);
    letter-spacing: -.035em;
}

.wo-page-heading .badge { margin: .65rem .35rem 0 0; }
.wo-page-actions { position: relative; z-index: 1; }

[data-theme="dark"] .wo-page-header {
    border-color: rgba(39,196,236,.16);
    background: linear-gradient(115deg, rgba(23,62,91,.86), rgba(48,39,83,.72) 65%, rgba(15,70,86,.82));
}

[data-theme="dark"] .wo-page-header h1 { color: #f0f7fa; }

.work-order-show .card,
.work-order-form .card {
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(16,38,59,.03), 0 9px 26px rgba(28,49,65,.055);
}

.work-order-form .card { overflow: visible; } /* el desplegable de Cliente (Tom Select) no debe recortarse */
.work-order-form .ts-dropdown { z-index: 1050; }

.work-order-show .card-body,
.work-order-form .card-body { padding: 1.45rem; }

.work-order-show .card-body > h2:first-child,
.work-order-form .card-body > h2:first-child,
.work-order-form .card-body > .form-check:first-child .h6 {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: #174f70 !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.work-order-show .card-body > h2:first-child::before,
.work-order-form .card-body > h2:first-child::before {
    content: '';
    width: 5px;
    height: 20px;
    border-radius: 5px;
    background: linear-gradient(#01b3e3, #5670df);
    flex: 0 0 5px;
}

[data-theme="dark"] .work-order-show .card-body > h2:first-child,
[data-theme="dark"] .work-order-form .card-body > h2:first-child,
[data-theme="dark"] .work-order-form .card-body > .form-check:first-child .h6 { color: #74d6ef !important; }

.work-order-show dl.row { margin-inline: 0; }

.work-order-show dl.row dt,
.work-order-show dl.row dd {
    margin: 0;
    padding-top: .72rem;
    padding-bottom: .72rem;
    border-bottom: 1px solid var(--ma-border-light);
}

.work-order-show dl.row dt {
    color: var(--ma-text-muted) !important;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .025em;
}

.work-order-show dl.row dd {
    color: var(--ma-text);
    font-size: .88rem;
    font-weight: 600;
}

.work-order-show .table,
.work-order-form .table { border-collapse: separate; border-spacing: 0; }

.work-order-show .table thead th,
.work-order-form .table thead th {
    color: var(--ma-text-muted);
    background: var(--ma-hover-bg);
    border-top: 1px solid var(--ma-border-light);
}

.work-order-show .table thead th:first-child,
.work-order-form .table thead th:first-child { border-radius: 12px 0 0 12px; }

.work-order-show .table thead th:last-child,
.work-order-form .table thead th:last-child { border-radius: 0 12px 12px 0; }

.work-order-show .table tfoot th {
    padding-top: 1rem;
    color: var(--ma-primary);
    font-size: 1rem;
}

.work-order-form .form-label {
    color: #526b7a;
    font-size: .82rem;
    font-weight: 700;
}

[data-theme="dark"] .work-order-form .form-label { color: #a9bac5; }

.work-order-form .form-control,
.work-order-form .form-select,
.work-order-form .ts-control,
.work-order-form .input-group-text {
    background-color: color-mix(in srgb, var(--ma-card-bg) 72%, var(--ma-bg));
    border-color: color-mix(in srgb, var(--ma-card-border) 86%, var(--ma-primary));
}

.work-order-form textarea.form-control { min-height: 112px; line-height: 1.55; }

.work-order-form form > .mt-3.mb-4 {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.15rem;
    border: 1px solid var(--ma-card-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--ma-card-bg) 92%, transparent);
    box-shadow: 0 12px 30px rgba(16,38,59,.08);
}

.work-order-form form > .mt-3.mb-4 .btn { min-width: 190px; }

@media (max-width: 767.98px) {
    .wo-page-header { padding: 1.25rem; }
    .wo-page-actions { width: 100%; }
    .wo-page-actions .btn { flex: 1; }
    .work-order-show dl.row dt,
    .work-order-show dl.row dd { padding-block: .55rem; }
    .work-order-form form > .mt-3.mb-4 .btn { width: 100%; }
}

/* ===== Pipeline Board ===== */
.pipeline-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    /* Alto acotado a la ventana: cada columna se desplaza por dentro en vez de alargar toda la página. */
    /* Respaldo; pipeline.js ajusta el alto exacto para que la base curva quede dentro de la ventana. */
    height: max(420px, calc(100vh - 260px));
    align-items: stretch;
}
.pipeline-col {
    /* Todas las columnas con el mismo ancho y alto. */
    /* Las columnas se reparten el ancho disponible (todas iguales); solo hay scroll lateral si no caben. */
    flex: 1 1 0;
    min-width: 235px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.pipeline-col-header {
    background: var(--ma-card-bg);
    border-radius: var(--ma-radius-card) var(--ma-radius-card) 0 0;
    padding: 12px 14px;
    box-shadow: var(--ma-card-shadow);
    flex: 0 0 auto;
    height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}
.pipeline-col-header strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipeline-col-header small { white-space: nowrap; font-size: .8rem; }
.pipeline-col-body {
    background: var(--ma-bg);
    border: 1px solid var(--ma-border-light);
    border-top: none;
    /* Base curva, igual en todas las columnas. */
    border-radius: 0 0 24px 24px;
    padding: 8px 8px 16px;
    flex: 1;
    min-height: 120px;
    overflow-y: scroll; /* la barra siempre se ve: indica que hay más ventas por debajo */
    scrollbar-width: thin;
    scrollbar-color: #9fb3c0 transparent;
    overscroll-behavior: contain;
    transition: background .15s;
}
.pipeline-col-body.drag-over {
    background: var(--ma-hover-bg);
    border-color: var(--ma-accent);
}
.pipeline-card {
    background: var(--ma-card-bg);
    border: 1px solid var(--ma-card-border);
    border-radius: 10px;
    padding: 7px 10px;
    margin-bottom: 6px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow .15s, opacity .15s;
}
.pipeline-card > a {
    font-size: .85rem;
    line-height: 1.25;
    display: -webkit-box !important; /* gana a .d-block de Bootstrap */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pipeline-card-cliente { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
.pipeline-card strong { font-size: .92rem; }
.pipe-toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 1085;
    max-width: 360px; padding: 12px 16px; border-radius: 12px;
    background: var(--ma-navy); color: #fff; font-size: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.pipe-toast.is-error { background: #b42318; }
.pipeline-col[data-activa="0"] .pipeline-col-header { opacity: .8; }
.pipeline-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
}
.pipeline-card.dragging {
    opacity: 0.4;
}

/* ---------- Paneles (dashboards) ---------- */
.dash-widget { border: 1px solid var(--ma-card-border); border-radius: var(--ma-radius-card); background: var(--ma-card-bg); box-shadow: var(--ma-card-shadow); min-height: 360px; display: flex; flex-direction: column; transition: opacity .15s; }
.dash-widget.is-loading { opacity: .55; pointer-events: none; }
.dash-widget-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; padding: 1rem 1rem .25rem; }
.dash-widget-title { font-size: .95rem; font-weight: 500; text-transform: uppercase; letter-spacing: .01em; margin: 0; color: var(--ma-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-widget-actions { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.dash-widget-actions .btn-icon { border: 0; background: transparent; color: var(--ma-text-muted); padding: .2rem .35rem; border-radius: 6px; line-height: 1; }
.dash-widget-actions .btn-icon:hover { background: var(--ma-hover-bg); color: var(--ma-primary); }
.dash-widget-body { flex: 1; padding: 0 1rem; position: relative; }
.dash-chart { position: relative; height: 260px; }
.dash-widget-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 1rem .9rem; font-size: .78rem; }
.dash-widget-foot a { color: var(--ma-primary); text-decoration: none; min-width: 0; }
.dash-widget-foot a:hover { text-decoration: underline; }
.dash-widget-foot .js-asof { white-space: nowrap; }
.dash-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ma-text-muted); font-size: .85rem; }
.dash-metric { font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 500; color: #0b7a75; line-height: 1.1; padding-top: 2.5rem; }
.dash-metric-sub { color: var(--ma-text-muted); font-size: .8rem; margin-top: .35rem; }
.dash-widget.is-expanded { position: fixed; inset: 4vh 4vw; z-index: 1080; min-height: 0; height: auto !important; }
.dash-widget.is-expanded .dash-chart { height: calc(92vh - 140px); }
body.dash-has-expanded::after { content: ''; position: fixed; inset: 0; background: rgba(16, 38, 59, .45); z-index: 1070; }

/* ---------- Ficha de oportunidad (estilo Salesforce) ---------- */
.op-header-icon { font-size: 1.4rem; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 8px; background: #fde4dd; }
.op-highlights { display: flex; flex-wrap: wrap; gap: .5rem 2rem; font-size: .82rem; }
.op-highlights > div { display: flex; flex-direction: column; min-width: 7rem; }
.op-highlights span { color: var(--ma-text-muted); font-size: .72rem; }
/* Barra de etapas al estilo Salesforce Path */
.op-path-toggle { flex: 0 0 auto; width: 2rem; height: 2rem; border: 1px solid var(--ma-border); border-radius: 6px; background: var(--ma-card-bg, #fff); color: var(--ma-text); font-size: 1.1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.op-path-toggle > span { display: inline-block; transition: transform .15s; }
.op-path-toggle[aria-expanded="true"] > span { transform: rotate(90deg); }
.op-path { display: flex; list-style: none; margin: 0; padding: 0; min-width: 0; }
.op-path-step { flex: 1; min-width: 0; }
.op-path-step + .op-path-step { margin-left: -9px; }
.op-path-step button {
    position: relative; display: block; width: 100%; height: 2rem; border: 0; padding: 0 1.1rem 0 1.5rem; font-size: .78rem;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: #f3f3f3; color: #181818; cursor: pointer;
    /* Chevron con muesca: el solapamiento negativo deja una ranura blanca entre pasos. */
    clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%, 13px 50%);
}
.op-path-step:first-child button { clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%); border-radius: 1rem 0 0 1rem; padding-left: 1rem; }
.op-path-step:last-child button { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 13px 50%); border-radius: 0 1rem 1rem 0; }
.op-path-step button:disabled { cursor: default; }
.op-path-step.is-todo button:not(:disabled):hover { background: #e5e5e5; }
.op-path-step.is-done button { background: #45a659; color: #fff; }
.op-path-step.is-done button:not(:disabled):hover { background: #3a8f4c; }
.op-path-step.is-done .op-path-label { display: none; }
.op-path-step.is-done button:hover .op-path-label, .op-path-step.is-done.is-selected .op-path-label { display: inline; }
.op-path-step.is-done button:hover .op-path-check, .op-path-step.is-done.is-selected .op-path-check { display: none; }
.op-path-step.is-current button { background: #014486; color: #fff; }
.op-path-step.is-won button { background: #45a659; color: #fff; font-weight: 600; }
.op-path-step.is-lost button { background: #ba0517; color: #fff; font-weight: 600; }
.op-path-step.is-selected button { background: #0176d3 !important; color: #fff !important; }
.op-path-step.is-current.is-selected button { background: #014486 !important; }
.op-path-action { background: #0176d3; border-color: #0176d3; }
/* Ranura blanca entre chevrons: cada paso se dibuja sobre un fondo blanco ligeramente más ancho. */
.op-path-step { filter: drop-shadow(2px 0 0 var(--ma-card-bg, #fff)); }
[data-theme="dark"] .op-path-step.is-todo button { background: #2b2f36; color: #e6e6e6; }
@media (max-width: 767.98px) {
    .op-path-step:not(.is-current):not(.is-selected) .op-path-label { display: none; }
    .op-path-step.is-todo button::after { content: "•"; }
    .op-path-action { font-size: .72rem; }
}
.op-fields .op-field { display: flex; gap: .75rem; padding: .35rem .5rem; border-bottom: 1px solid var(--ma-border-light); font-size: .85rem; }
.op-field-label { flex: 0 0 42%; color: var(--ma-text-muted); font-size: .76rem; }
.op-field-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.op-section { margin-top: .75rem; }
.op-section-title { font-weight: 600; font-size: .85rem; background: var(--ma-hover-bg); padding: .4rem .6rem; border-radius: 6px; margin: 1rem 0 .4rem; cursor: pointer; }
details.op-section > summary.op-section-title { margin-top: 0; }
.op-quicklinks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .75rem; font-size: .82rem; }
.op-composer { border: 1px solid var(--ma-border-light); border-radius: 8px; padding: .75rem; }

.widget-checklist { max-height: 14rem; overflow-y: auto; }

/* ===== Frase del día ===== */
.frase-dia {
    margin-top: .75rem;
    padding: .55rem .9rem;
    max-width: 46rem;
    border-left: 4px solid var(--ma-brand, #01b3e3);
    border-radius: 0 10px 10px 0;
    background: rgba(1,179,227,.08);
    color: var(--ma-text, #172733);
    font-size: .92rem;
    line-height: 1.45;
}
.frase-dia-icono { margin-right: .25rem; }

/* ===== Menú lateral agrupado (colores del logo: cian y azul marino) ===== */
.app-sidebar .offcanvas-body { overflow-y: auto; }
.app-sidebar .sb-search { flex: 0 0 auto; padding: 16px 14px 6px; }
.app-sidebar .sb-search input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--ma-border-light);
    border-radius: var(--ma-radius-field);
    background: var(--ma-card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2301b3e3' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center / 17px;
    color: var(--ma-text);
    font-size: .9rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.app-sidebar .sb-search input:focus { border-color: var(--ma-primary-light); box-shadow: 0 0 0 3px rgba(1,179,227,.14); }
.app-sidebar .sb-nav { padding: 8px 14px 24px; }
.app-sidebar .sb-nav > .nav-link { margin-bottom: 8px; }
.app-sidebar .sb-group {
    margin: 8px 0;
    border: 1px solid #d5e3e9;
    border-radius: 14px;
    background: var(--ma-card-bg);
    overflow: hidden;
}
.app-sidebar .sb-group summary {
    list-style: none;
    cursor: pointer;
    position: relative;
    padding: 13px 34px 13px 14px;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: #00698a;                 /* cian del logo, oscuro para el texto */
    background: #e3f5fb;
    border-radius: 13px;
    user-select: none;
}
.app-sidebar .sb-group:nth-of-type(even) summary { color: var(--ma-navy); background: #e8eef3; } /* azul marino del logo */
.app-sidebar .sb-group summary::-webkit-details-marker { display: none; }
.app-sidebar .sb-group summary::after { content: '+'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 1.1rem; font-weight: 700; }
.app-sidebar .sb-group[open] summary::after { content: '−'; }
.app-sidebar .sb-group[open] summary { border-radius: 13px 13px 0 0; }
.app-sidebar .sb-group summary:focus-visible { outline: 2px solid var(--ma-primary-light); outline-offset: 2px; }
.app-sidebar .sb-group-items { padding: 6px 6px 8px; }
.app-sidebar .sb-group-items .nav-link { margin-bottom: 2px; }
.app-sidebar .nav-link[hidden] { display: none; }
.app-sidebar .sb-group[hidden] { display: none; }
.app-sidebar .sb-badge {
    background: #e5484d; color: #fff;
    font-size: .72rem; font-weight: 700;
    border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 7px; line-height: 1.5;
}
.app-sidebar .sb-empty { color: var(--ma-text-muted); padding: 1rem; }
[data-theme="dark"] .app-sidebar .sb-group { border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .app-sidebar .sb-group summary { color: #7fdcf5; background: rgba(39,196,236,.13); }
[data-theme="dark"] .app-sidebar .sb-group:nth-of-type(even) summary { color: #d4e2ec; background: rgba(255,255,255,.07); }

.app-sidebar .sb-top { margin-bottom: 8px; }

/* ===== Gestión Humana ===== */
.gh-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 28px 32px; margin-bottom: 24px; border-radius: 22px; color: #fff; background: radial-gradient(120% 160% at 100% 0%, #01b3e3 0%, #007c99 38%, #10263b 100%); box-shadow: 0 18px 40px rgba(16,38,59,.18); }
.gh-hero-sm { padding: 22px 28px; }
.gh-hero h1 { font-size: 1.9rem; margin: 0; font-weight: 700; }
.gh-hero-sm h1 { font-size: 1.5rem; }
.gh-kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; opacity: .8; margin: 0 0 6px; }
.gh-sub { margin: 4px 0 0; opacity: .9; }
.gh-hero-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.gh-stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: rgba(255,255,255,.14); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.22); color: #fff; text-decoration: none; min-width: 190px; }
a.gh-stat:hover { background: rgba(255,255,255,.22); color: #fff; }
.gh-stat strong { display: block; font-size: .92rem; }
.gh-stat small { opacity: .85; font-size: .75rem; }
.gh-num { font-size: 2rem; font-weight: 800; line-height: 1; min-width: 54px; text-align: center; }
.gh-ring { --p: 0; --c: #16a34a; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.25) 0); position: relative; flex: none; }
.gh-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #0c4a60; }
.gh-ring span { position: relative; font-size: .62rem; font-weight: 700; text-align: center; line-height: 1.1; }
.gh-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.gh-tile { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--ma-radius-card); background: var(--ma-card-bg); border: 1px solid var(--ma-card-border); box-shadow: var(--ma-card-shadow); text-decoration: none; color: var(--ma-text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.gh-tile:hover { transform: translateY(-3px); border-color: var(--ma-brand); color: var(--ma-text); box-shadow: 0 14px 32px rgba(1,179,227,.18); }
.gh-tile small { color: var(--ma-text-muted); line-height: 1.35; }
.gh-tile-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: linear-gradient(145deg, #e7f7fb, #cdeef8); flex: none; }
[data-theme="dark"] .gh-tile-ico { background: rgba(1,179,227,.16); }
.gh-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 18px; border-radius: 14px; color: #fff; background: linear-gradient(90deg, #d97706, #b45309); box-shadow: 0 8px 22px rgba(217,119,6,.25); }
.gh-banner-ico { font-size: 1.5rem; }
.gh-banner-text { flex: 1; display: flex; flex-direction: column; font-size: .88rem; }
.gh-checklist { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--ma-card-bg); border: 1px dashed var(--ma-brand); font-size: .88rem; }
.gh-checklist span { padding: 3px 10px; border-radius: 99px; background: var(--ma-hover-bg); }
.gh-form-card { border-radius: var(--ma-radius-card); }
.gh-saldo { padding: 10px 14px; border-radius: 12px; background: var(--ma-hover-bg); font-size: .9rem; }
.gh-dias { min-height: 20px; font-weight: 600; color: var(--ma-primary); }
.gh-dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0 0 14px; }
.gh-dl dt { color: var(--ma-text-muted); font-weight: 500; font-size: .85rem; }
.gh-dl dd { margin: 0; }
.gh-cert-mini { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--ma-border-light); text-decoration: none; color: var(--ma-text); justify-content: space-between; }
.gh-cert-code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .08em; color: var(--ma-primary); }
.gh-cert-code.big { font-size: 1.35rem; }
.gh-cert-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--ma-hover-bg); text-decoration: none; color: var(--ma-text); border: 1px solid var(--ma-brand); }
.gh-doc { display: flex; gap: 8px; padding: 6px 0; text-decoration: none; color: var(--ma-text); }
.gh-estudio { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--ma-border-light); }
.gh-timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.gh-timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; font-size: .88rem; }
.gh-timeline li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--ma-border-light); }
.gh-timeline li:last-child::before { display: none; }
.gh-dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--ma-brand); box-shadow: 0 0 0 3px rgba(1,179,227,.2); flex: none; z-index: 1; }
.gh-cambios { margin: 4px 0 0; padding-left: 16px; font-size: .78rem; color: var(--ma-text-muted); }
.gh-cert-card { border-radius: 22px; overflow: hidden; border: 1px solid var(--ma-card-border); background: var(--ma-card-bg); box-shadow: var(--ma-card-shadow); }
.gh-cert-card.is-off { filter: grayscale(.7); }
.gh-cert-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; color: #fff; letter-spacing: .2em; font-size: .75rem; background: linear-gradient(90deg, #10263b, #007c99); }
.gh-seal { padding: 4px 12px; border-radius: 99px; font-size: .75rem; letter-spacing: .04em; background: rgba(255,255,255,.2); }
.gh-seal.ok { background: #16a34a; }
.gh-seal.off { background: #dc2626; }
.gh-cert-body { display: flex; gap: 24px; padding: 24px; align-items: center; flex-wrap: wrap; }
.gh-cert-qr { width: 170px; height: 170px; flex: none; padding: 8px; border-radius: 14px; background: #fff; border: 1px solid var(--ma-card-border); }
.gh-cert-qr svg { width: 100%; height: 100%; display: block; }
.gh-cert-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 22px; background: var(--ma-hover-bg); }
.gh-cert-foot small { display: block; color: var(--ma-text-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.gh-public { background: radial-gradient(90% 60% at 50% 0%, #d9f3fb 0%, var(--ma-bg) 70%); min-height: 100vh; }
[data-theme="dark"] .gh-public { background: var(--ma-bg); }
.gh-pub-wrap { max-width: 640px; margin: 0 auto; padding: 28px 16px 40px; }
.gh-pub-head { text-align: center; margin-bottom: 18px; padding: 20px 16px 16px; border-radius: 22px; background: linear-gradient(135deg, #10263b, #0b4a63); box-shadow: 0 14px 32px rgba(16,38,59,.18); }
.gh-pub-logo { height: 46px; }
.gh-pub-head p { margin: 8px 0 0; color: #8fdcf3; letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; }
.gh-pub-card { background: var(--ma-card-bg); border: 1px solid var(--ma-card-border); border-radius: 22px; padding: 28px; margin-bottom: 16px; box-shadow: var(--ma-card-shadow); }
.gh-pub-card h1 { font-size: 1.35rem; font-weight: 700; }
.gh-pub-qr { font-size: 3rem; color: var(--ma-brand); line-height: 1; }
.gh-pub-form { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gh-pub-form .form-control { flex: 1 1 220px; letter-spacing: .12em; }
.gh-video { width: 100%; max-height: 300px; border-radius: 14px; margin-top: 14px; background: #000; }
.gh-res-ok, .gh-res-warn, .gh-res-bad { text-align: center; color: #fff; border: 0; }
.gh-res-ok { background: linear-gradient(135deg, #16a34a, #0f766e); }
.gh-res-warn { background: linear-gradient(135deg, #d97706, #b45309); }
.gh-res-bad { background: linear-gradient(135deg, #dc2626, #991b1b); }
.gh-res-ico { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; font-size: 2rem; background: rgba(255,255,255,.22); }
.gh-pub-foot { text-align: center; color: var(--ma-text-muted); font-size: .8rem; margin-top: 18px; line-height: 1.8; }
@media (max-width: 575px) { .gh-dl { grid-template-columns: 1fr; gap: 2px; } .gh-dl dd { margin-bottom: 8px; } .gh-cert-foot { grid-template-columns: 1fr; } .gh-hero { padding: 20px; } }

@media (max-width: 575px) { .gh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .gh-tile { padding: 14px; } .gh-stat { min-width: 0; flex: 1 1 100%; } }

/* ===== Clientes: semáforo y cartera ===== */
.cl-sem { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: #eef2f5; color: #526675; }
.cl-sem i, .cl-kpi i { width: 10px; height: 10px; border-radius: 50%; background: #9aa9b5; flex: none; }
.cl-sem-verde { background: #e3f6ea; color: #136c34; } .cl-sem-verde i { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.cl-sem-naranja { background: #fff1de; color: #9a5300; } .cl-sem-naranja i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.cl-sem-rojo { background: #fde6e6; color: #a31616; } .cl-sem-rojo i { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.22); }
[data-theme="dark"] .cl-sem { background: rgba(255,255,255,.08); color: #b8c7d2; }
[data-theme="dark"] .cl-sem-verde { background: rgba(22,163,74,.18); color: #7ee2a1; }
[data-theme="dark"] .cl-sem-naranja { background: rgba(245,158,11,.18); color: #ffc474; }
[data-theme="dark"] .cl-sem-rojo { background: rgba(220,38,38,.2); color: #ff9a9a; }
.cl-kpis { display: flex; gap: 12px; flex-wrap: wrap; }
.cl-kpi { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 14px; background: var(--ma-card-bg); border: 1px solid var(--ma-card-border); box-shadow: var(--ma-card-shadow); text-decoration: none; color: var(--ma-text); min-width: 170px; transition: transform .12s, border-color .12s; }
a.cl-kpi:hover { transform: translateY(-2px); color: var(--ma-text); }
.cl-kpi.is-on { border-color: var(--ma-brand); box-shadow: 0 0 0 2px rgba(1,179,227,.25); }
.cl-kpi strong { display: block; font-size: 1.35rem; line-height: 1.15; }
.cl-kpi span { font-size: .8rem; color: var(--ma-text-muted); }
.cl-kpi i { width: 14px; height: 14px; }
.cl-kpi-rojo i { background: #dc2626; } .cl-kpi-naranja i { background: #f59e0b; } .cl-kpi-verde i { background: #16a34a; }
.cl-kpi-rojo { border-left: 4px solid #dc2626; } .cl-kpi-naranja { border-left: 4px solid #f59e0b; } .cl-kpi-verde { border-left: 4px solid #16a34a; } .cl-kpi-gris { border-left: 4px solid #9aa9b5; }
.cl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.cl-stats > div { padding: 10px 14px; border-radius: 12px; background: var(--ma-hover-bg); }
.cl-stats small { display: block; color: var(--ma-text-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.cl-stats strong { display: block; font-size: 1.15rem; }
.cl-stats span { font-size: .78rem; color: var(--ma-text-muted); }
@media (max-width: 575px) { .cl-kpi { flex: 1 1 100%; } }

.cl-typeahead { position: relative; }
.cl-suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 1050; margin-top: 4px; max-height: 360px; overflow-y: auto; background: var(--ma-card-bg); border: 1px solid var(--ma-card-border); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,38,59,.18); }
.cl-suggest-item { display: flex; flex-direction: column; padding: 9px 14px; text-decoration: none; color: var(--ma-text); border-bottom: 1px solid var(--ma-border-light); }
.cl-suggest-item small { color: var(--ma-text-muted); }
.cl-suggest-item:hover, .cl-suggest-item.is-active { background: var(--ma-hover-bg); color: var(--ma-text); }
.cl-suggest-empty { padding: 12px 14px; color: var(--ma-text-muted); }
.cl-quick { max-width: 170px; font-size: .75rem; padding-top: 2px; padding-bottom: 2px; height: auto; }

/* Ventana de motivo (reemplaza al prompt nativo) */
.ma-modal-ov { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(16,38,59,.55); backdrop-filter: blur(3px); animation: ma-fade .15s ease-out; }
.ma-modal { width: min(440px, 100%); padding: 24px; border-radius: 18px; background: var(--ma-card-bg); color: var(--ma-text); border: 1px solid var(--ma-card-border); box-shadow: 0 30px 70px rgba(16,38,59,.35); animation: ma-pop .18s ease-out; }
.ma-modal h2 { font-size: 1.15rem; margin: 0 0 4px; }
.ma-modal-detail { margin: 0 0 14px; color: var(--ma-text-muted); font-size: .9rem; }
.ma-modal textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ma-card-border); background: var(--ma-bg); color: var(--ma-text); resize: vertical; }
.ma-modal textarea:focus { outline: 2px solid var(--ma-brand); outline-offset: 1px; }
.ma-modal-err { margin-top: 6px; color: #dc2626; font-size: .82rem; }
.ma-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
@keyframes ma-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ma-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
