/* ═══════════════════════════════════════════
   DEVOPSPANEL — DESIGN SYSTEM
   Dark, neutral operations UI. One sans (Inter) for interface text, one mono
   (JetBrains Mono) for ports, paths, times and logs. Color is reserved for
   meaning: blue = action/selection, status palette = state.
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    color-scheme: dark;

    /* Surfaces, darkest to lightest */
    --bg-base:          #0e0f11;
    --bg-surface:       #131417;
    --bg-card:          #17181b;
    --bg-raised:        #1e1f23;
    --bg-input:         #111215;
    --bg-hover:         rgba(255, 255, 255, 0.045);
    --bg-active:        rgba(255, 255, 255, 0.07);
    --bg-surface-glass: var(--bg-surface);
    --bg-card-glass:    var(--bg-card);

    /* Ink */
    --text-main:        #ececee;
    --text-dim:         #a1a1aa;
    --muted:            #71717a;

    /* Lines */
    --border:           rgba(255, 255, 255, 0.075);
    --border-strong:    rgba(255, 255, 255, 0.13);
    --border-hover:     rgba(255, 255, 255, 0.2);

    /* Accent — action and selection only */
    --primary:          #3987e5;
    --primary-hover:    #5598e7;
    --primary-fg:       #86b6ef;
    --primary-soft:     rgba(57, 135, 229, 0.14);
    --secondary:        #9085e9;

    /* Status — reserved for state, always paired with a label or icon */
    --success:          #0ca30c;
    --success-fg:       #5cc95c;
    --warning:          #fab219;
    --warning-fg:       #fcc94f;
    --serious:          #ec835a;
    --serious-fg:       #f2a07f;
    --danger:           #d03b3b;
    --danger-fg:        #ef8080;

    /* Legacy aliases still referenced by page markup */
    --green:            var(--success);
    --green-dim:        var(--muted);
    --blue:             var(--primary);
    --orange:           var(--serious);
    --purple:           var(--secondary);
    --accent:           var(--primary);
    --border-color:     var(--border);
    --primary-glow:     var(--primary-soft);
    --secondary-glow:   rgba(144, 133, 233, 0.14);
    --success-glow:     rgba(12, 163, 12, 0.16);
    --warning-glow:     rgba(250, 178, 25, 0.16);
    --danger-glow:      rgba(208, 59, 59, 0.16);

    --font-sans:        'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:        'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

    --radius-sm:        5px;
    --radius:           8px;
    --radius-lg:        10px;
    --shadow-pop:       0 12px 32px rgba(0, 0, 0, 0.45);
    --ease:             cubic-bezier(.2, .7, .3, 1);
}

[data-bs-theme=dark] {
    --bs-body-bg:            var(--bg-base);
    --bs-body-color:         var(--text-main);
    --bs-secondary-color:    var(--text-dim);
    --bs-tertiary-bg:        var(--bg-raised);
    --bs-border-color:       var(--border);
    --bs-emphasis-color:     #fff;
    --bs-link-color:         var(--primary-fg);
    --bs-link-hover-color:   #b7d3f6;
    --bs-link-color-rgb:     134, 182, 239;
    --bs-success-rgb:        12, 163, 12;
    --bs-danger-rgb:         208, 59, 59;
    --bs-warning-rgb:        250, 178, 25;
    --bs-font-sans-serif:    var(--font-sans);
    --bs-font-monospace:     var(--font-mono);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    min-width: 0;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    color: var(--primary-fg);
}

a:hover {
    color: #b7d3f6;
}

code, kbd, pre, samp {
    font-family: var(--font-mono);
}

code {
    color: var(--primary-fg);
    font-size: .92em;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background: rgba(57, 135, 229, 0.35);
}

.text-dim   { color: var(--text-dim) !important; }
.text-muted { color: var(--muted) !important; }
.text-light { color: var(--text-main) !important; }
.text-success { color: var(--success-fg) !important; }
.text-danger  { color: var(--danger-fg) !important; }
.text-warning { color: var(--warning-fg) !important; }
.text-info    { color: var(--primary-fg) !important; }
.italic { font-style: italic; }

/* ═══ APP SHELL ═══ */
.dp-app-shell,
.dp-main,
.content {
    min-width: 0;
    max-width: 100%;
}

.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    z-index: 100;
}

.top-row {
    background: rgba(14, 15, 17, 0.88);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.dp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main) !important;
    text-decoration: none;
}

.dp-brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
}

.dp-brand-name {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.dp-brand-sub {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

.dp-nav {
    padding: 8px 10px 16px;
}

.dp-nav-section {
    padding: 14px 10px 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 0;
    padding: 7px 10px !important;
    border-radius: 6px;
    color: var(--text-dim) !important;
    font-size: 13px;
    font-weight: 500;
    transition: background-color .15s var(--ease), color .15s var(--ease);
}

.nav-link svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    opacity: .85;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main) !important;
}

.nav-link.active {
    background: var(--bg-active);
    color: var(--text-main) !important;
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--primary);
}

.nav-link.active svg {
    color: var(--primary-fg);
    opacity: 1;
}

.dp-topbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dp-version {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.dp-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
}

.dp-avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.dp-divider-v {
    width: 1px;
    height: 18px;
    background: var(--border-strong);
}

.dp-clock {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    font-size: 12px;
}

/* ═══ PAGE HEADER ═══ */
.dp-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dp-page-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
}

.dp-page-header p {
    margin: 4px 0 0;
    color: var(--text-dim);
    font-size: 13px;
}

/* ═══ CARDS & ACCORDION ═══ */
.card, .dp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-main);
}

.dp-card h2 {
    margin-bottom: 14px;
    font-size: 14px !important;
    font-weight: 600;
}

.card-header, .card-body, .card-footer {
    background: transparent;
    border-color: var(--border);
    color: inherit;
}

.dp-accordion {
    margin-bottom: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dp-acc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 16px !important;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    cursor: default;
    user-select: none;
}

.dp-accordion > .dp-acc-header:last-child {
    border-bottom: 0;
}

.dp-acc-toggle {
    cursor: pointer;
    transition: background-color .15s var(--ease);
}

.dp-acc-toggle:hover {
    background: var(--bg-hover);
}

.dp-acc-chevron {
    display: inline-flex;
    color: var(--muted);
    transition: transform .18s var(--ease);
}

.dp-acc-chevron.open {
    transform: rotate(90deg);
}

.dp-acc-sub {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.dp-acc-body {
    padding: 14px 16px;
}

/* ═══ ROWS ═══ */
.dp-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
    padding: 9px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong) !important;
    border-radius: var(--radius);
    font-size: 13px;
    word-break: break-word;
    transition: background-color .15s var(--ease), border-color .15s var(--ease);
}

.dp-row:hover {
    background: var(--bg-raised);
    border-color: var(--border-strong);
}

.dp-row.on  { border-left-color: var(--success) !important; }
.dp-row.off { border-left-color: var(--danger) !important; }
.dp-row.off > * { opacity: .8; }

.dp-row.hidden-item {
    opacity: .5 !important;
    border-style: dashed !important;
}

/* ═══ STATUS DOTS ═══ */
.dp-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.dp-dot.on   { background: var(--success); box-shadow: 0 0 0 3px rgba(12, 163, 12, .18); }
.dp-dot.off  { background: var(--danger);  box-shadow: 0 0 0 3px rgba(208, 59, 59, .18); }
.dp-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(250, 178, 25, .18); }

/* ═══ BADGES ═══ */
.dp-badge,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 7px;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius-sm);
    background: var(--bg-raised) !important;
    color: var(--text-dim) !important;
    font-family: var(--font-sans);
    font-size: 11px !important;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.badge.bg-success { background: rgba(12, 163, 12, .12) !important;  border-color: rgba(12, 163, 12, .32) !important;  color: var(--success-fg) !important; }
.badge.bg-danger  { background: rgba(208, 59, 59, .12) !important;  border-color: rgba(208, 59, 59, .36) !important;  color: var(--danger-fg) !important; }
.badge.bg-warning { background: rgba(250, 178, 25, .1) !important;  border-color: rgba(250, 178, 25, .3) !important;  color: var(--warning-fg) !important; }
.badge.bg-info,
.badge.bg-primary { background: var(--primary-soft) !important;     border-color: rgba(57, 135, 229, .34) !important; color: var(--primary-fg) !important; }
.badge.bg-secondary { color: var(--text-dim) !important; }

.dp-badge.proc {
    background: rgba(144, 133, 233, .12) !important;
    border-color: rgba(144, 133, 233, .32) !important;
    color: #b3abf2 !important;
}

/* ═══ BUTTONS ═══ */
.dp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--bg-raised);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}

.dp-btn:hover {
    background: #26272c;
    border-color: var(--border-hover);
}

.dp-btn:active {
    background: #2b2c31;
}

.dp-btn:disabled,
.dp-btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

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

.dp-btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.dp-btn.start {
    background: rgba(12, 163, 12, .12);
    border-color: rgba(12, 163, 12, .35);
    color: var(--success-fg);
}
.dp-btn.start:hover {
    background: rgba(12, 163, 12, .2);
    border-color: rgba(12, 163, 12, .55);
}

.dp-btn.stop,
.dp-btn.kill {
    background: rgba(208, 59, 59, .1);
    border-color: rgba(208, 59, 59, .34);
    color: var(--danger-fg);
}
.dp-btn.stop:hover,
.dp-btn.kill:hover {
    background: rgba(208, 59, 59, .18);
    border-color: rgba(208, 59, 59, .55);
}

.dp-btn.restart {
    background: rgba(250, 178, 25, .08);
    border-color: rgba(250, 178, 25, .3);
    color: var(--warning-fg);
}
.dp-btn.restart:hover {
    background: rgba(250, 178, 25, .15);
    border-color: rgba(250, 178, 25, .5);
}

.dp-btn.restart.update-available {
    background: rgba(208, 59, 59, .16);
    border-color: rgba(208, 59, 59, .7);
    color: #fbd0d0;
    animation: dp-update-pulse 2s ease-in-out infinite;
}

@keyframes dp-update-pulse {
    50% { box-shadow: 0 0 0 4px rgba(208, 59, 59, .16); }
}

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

.dp-btn.is-busy svg,
.dp-spin {
    animation: dp-spin .85s linear infinite;
}

.metric-card.is-busy {
    border-color: rgba(250, 178, 25, .45);
}

.dp-dot.busy {
    background: var(--warning-fg, #fab219);
    animation: dp-update-pulse 1.1s ease-in-out infinite;
}

.dp-btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-dim);
}
.dp-btn.ghost:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.dp-btn.accent {
    background: var(--primary-soft);
    border-color: rgba(57, 135, 229, .38);
    color: var(--primary-fg);
    text-decoration: none;
}
.dp-btn.accent:hover {
    background: rgba(57, 135, 229, .22);
    border-color: rgba(57, 135, 229, .6);
    color: #cde2fb;
}

.dp-btn.sm {
    min-height: 24px;
    padding: 2px 8px;
    font-size: 11.5px;
}

.dp-btn.icon {
    width: 26px;
    min-height: 26px;
    padding: 0;
}

.dp-btn svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.dp-btn-hide, .dp-btn-unhide {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px 6px !important;
    border: none !important;
    background: transparent !important;
    color: var(--muted) !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: color .15s !important;
}
.dp-btn-hide:hover   { color: var(--danger-fg) !important; }
.dp-btn-unhide:hover { color: var(--success-fg) !important; }

/* ═══ MONO DATA ═══ */
.dp-port {
    color: var(--primary-fg);
    font-family: var(--font-mono);
    font-weight: 500;
}

.dp-ram,
.dp-mono {
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.dp-path {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: normal;
    word-break: break-all;
}

/* ═══ TOOLBAR BAR ═══ */
.dp-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dp-bar-title {
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
}

/* ═══ TABLES ═══ */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--bg-hover);
    --bs-table-striped-bg: rgba(255, 255, 255, .02);
    margin-bottom: 0;
    border-color: var(--border);
    color: var(--text-main);
    font-size: 12.5px;
}

.table > :not(caption) > * > * {
    background-color: transparent;
    color: inherit;
}

.table th,
.dp-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}

.table td {
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.dp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.dp-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 10px;
    background: var(--bg-raised);
    text-align: left;
}

.dp-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.dp-table tbody tr {
    transition: background-color .12s var(--ease);
}

.dp-table tbody tr:hover {
    background: var(--bg-hover);
}

.dp-table tbody tr:last-child td {
    border-bottom: 0;
}

.dp-table tr.is-off > td:not(:first-child):not(:last-child) {
    opacity: .72;
}

.dp-table tr.is-editing,
.dp-table tr.is-editing-detail {
    background: var(--primary-soft);
}

.dp-table .t-center { text-align: center; }
.dp-table .t-end    { text-align: right; }
.dp-table .t-name   { color: var(--text-main); font-weight: 600; }
.dp-table .t-sub    { margin-top: 1px; color: var(--muted); font-size: 11px; }
.dp-table .t-sub.proc { color: #b3abf2; }

/* ═══ LOG VIEW ═══ */
.dp-log {
    max-height: 250px;
    margin-bottom: 0;
    padding: 10px 12px;
    overflow-y: auto;
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius);
    color: var(--text-dim) !important;
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.65;
}

.dp-log-line {
    display: flex;
    gap: 10px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .035);
}

.dp-log-line:last-child { border-bottom: 0; }
.dp-log-line time { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.dp-log-line .ok   { color: var(--success-fg); }
.dp-log-line .fail { color: var(--danger-fg); }

.dp-empty {
    padding: 28px 16px;
    color: var(--muted);
    text-align: center;
}

/* ═══ FORMS ═══ */
input, select, textarea,
.form-control, .form-select {
    min-height: 30px;
    padding: 5px 10px !important;
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 6px !important;
    font-family: inherit !important;
    font-size: 12.5px !important;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

input::placeholder, textarea::placeholder {
    color: var(--muted) !important;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--border-hover) !important;
}

input:focus, select:focus, textarea:focus,
.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(57, 135, 229, .22) !important;
    outline: none !important;
}

input[type=checkbox], input[type=radio] {
    min-height: 0;
    width: 15px;
    height: 15px;
    padding: 0 !important;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

.form-label, label {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
}

select option {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

.custom-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.custom-switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: #3a3b40;
    cursor: pointer;
    transition: background-color .2s var(--ease);
}

.switch-slider:before {
    content: "";
    position: absolute;
    left: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s var(--ease);
}

input:checked + .switch-slider { background: var(--primary); }
input:checked + .switch-slider:before { transform: translateX(16px); }

/* ═══ ALERTS ═══ */
.alert {
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-raised);
    color: var(--text-main);
    font-size: 12.5px;
}
.alert-danger  { background: rgba(208, 59, 59, .1);  border-color: rgba(208, 59, 59, .35);  color: #f6c2c2; }
.alert-warning { background: rgba(250, 178, 25, .08); border-color: rgba(250, 178, 25, .3);  color: #fde3a4; }
.alert-success { background: rgba(12, 163, 12, .1);   border-color: rgba(12, 163, 12, .32);  color: #b6e6b6; }
.alert-info    { background: var(--primary-soft);      border-color: rgba(57, 135, 229, .32); color: #cde2fb; }

/* ═══ METRIC TILES ═══ */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.metric-card .title {
    margin-bottom: 6px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
}

.metric-card .value {
    color: var(--text-main);
    font-size: 24px;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.metric-card .value small {
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.metric-card .subtext {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11.5px;
}

/* ═══ SCROLLBARS ═══ */
* {
    scrollbar-width: thin;
    scrollbar-color: #34353a transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #2c2d32;
    border: 3px solid transparent;
    border-radius: 10px;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #3f4046; }

/* ═══ ERROR BAR ═══ */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 100%;
    padding: 10px 16px;
    background: #1d1314;
    border-top: 1px solid rgba(208, 59, 59, .6);
    color: #f6c2c2;
    font-size: 13px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .4);
}

#blazor-error-ui .reload {
    margin-left: 8px;
    color: #fff;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 16px;
    top: 9px;
    cursor: pointer;
}

/* ═══ STATUS TEXT ═══ */
.st-ok   { color: var(--success-fg) !important; }
.st-warn { color: var(--warning-fg) !important; }
.st-crit { color: var(--danger-fg) !important; }
.st-idle { color: var(--muted) !important; }

.dp-health {
    border-color: var(--border-strong) !important;
}
.dp-health.st-ok   { background: rgba(12, 163, 12, .1) !important;  border-color: rgba(12, 163, 12, .3) !important; }
.dp-health.st-warn { background: rgba(250, 178, 25, .08) !important; border-color: rgba(250, 178, 25, .3) !important; }
.dp-health.st-crit { background: rgba(208, 59, 59, .1) !important;  border-color: rgba(208, 59, 59, .35) !important; }

/* ═══ PANELS, CONSOLES, METERS ═══ */
.dp-panel {
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dp-panel-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dp-ctl-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
}

.dp-ctl-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin-right: auto;
}

.dp-ctl-label strong { font-weight: 600; }

.dp-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.dp-console {
    overflow: hidden;
    margin: 4px 0 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dp-console-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
}

.dp-console-head strong {
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dp-console-head .text-dim {
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dp-console pre,
.dp-console-body {
    height: 150px;
    margin: 0;
    padding: 8px 10px;
    overflow: auto;
    color: var(--text-dim);
    font: 11px/1.55 var(--font-mono);
    white-space: pre-wrap;
}

.dp-console-body.sm { height: 110px; }

.dp-console-empty {
    padding: 10px;
    color: var(--muted);
    font-size: 12px;
}

.dp-kv {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    color: var(--text-dim);
    font-size: 12px;
}

.dp-kv b {
    color: var(--text-main);
    font-weight: 500;
}

.dp-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.dp-metric {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
}

.dp-metric > span:first-child {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.dp-metric > b {
    font-family: var(--font-mono);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.dp-disks {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.dp-disk {
    display: grid;
    grid-template-columns: 26px 80px minmax(60px, 1fr) 44px 128px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.dp-disk-name  { color: var(--text-main); font-family: var(--font-mono); font-weight: 600; }
.dp-disk-label { overflow: hidden; color: var(--text-dim); text-overflow: ellipsis; white-space: nowrap; }
.dp-disk-pct,
.dp-disk-free  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.dp-disk-free  { color: var(--muted); }

.dp-meter {
    height: 6px;
    overflow: hidden;
    background: var(--bg-raised);
    border-radius: 3px;
}

.dp-meter > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--success);
    transition: width .4s var(--ease);
}

.dp-meter > span.st-warn { background: var(--warning); }
.dp-meter > span.st-crit { background: var(--danger); }

.dp-machine {
    margin-bottom: 12px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dp-machine:last-child { margin-bottom: 0; }

.dp-machine-name {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
}

.dp-edit-panel {
    margin-top: 10px;
    padding: 12px;
    background: var(--primary-soft);
    border: 1px solid rgba(57, 135, 229, .25);
    border-radius: var(--radius);
}

/* ═══ MODALS ═══ */
.dp-modal-backdrop {
    z-index: 9999;
    isolation: isolate;
    background: rgba(0, 0, 0, .35) !important;
}

.dp-modal-confirm {
    z-index: 99999;
    background: rgba(0, 0, 0, .55) !important;
}

.dp-modal-window {
    display: flex;
    flex-direction: column;
    min-width: 320px;
    min-height: 160px;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    overflow: auto;
    resize: both;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-strong);
    border-radius: 12px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}

.dp-modal-window > pre {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
}

.dp-modal-window.danger {
    border-color: rgba(208, 59, 59, .6);
}

.dp-modal-drag-handle {
    cursor: move;
    user-select: none;
}

.dp-modal-title {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
}

.dp-modal-danger-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(208, 59, 59, .14);
    color: var(--danger-fg);
}

.dp-modal-window h5 {
    margin-bottom: 6px;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 650;
}

.dp-console-output,
.dp-log-output {
    margin: 0;
    padding: 10px 12px;
    overflow-y: auto;
    background: #0a0a0c;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font: 11.5px/1.55 var(--font-mono);
    white-space: pre-wrap;
    word-break: break-all;
}

.dp-log-output.ok   { color: #b6e6b6; }
.dp-log-output.fail { color: #f6c2c2; }

.dp-countdown {
    height: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--bg-raised);
    border-radius: 3px;
}

.dp-countdown > span {
    display: block;
    height: 100%;
    background: var(--warning);
    transition: width 1s linear;
}

.dp-choice {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
    width: 100%;
    padding: 10px 12px !important;
    text-align: left;
    white-space: normal !important;
}

/* ═══ LOGIN ═══ */
.login-shell {
    min-height: calc(100vh - 160px);
}

.login-card {
    width: min(380px, 100%);
    box-shadow: var(--shadow-pop);
}

.login-card h1 {
    margin: 14px 0 4px;
    font-size: 18px;
}

.login-card .dp-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}

/* ═══ PUBLICATION BOARD ═══ */
.pub-page {
    width: 100%;
}

.pub-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.pub-page-title,
.pub-page-meta {
    display: flex;
    align-items: center;
    min-width: 0;
}

.pub-page-title {
    gap: 12px;
}

.pub-page-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--bg-raised);
    color: var(--primary-fg);
}

.pub-page-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
    line-height: 1.2;
}

.pub-page-title > div > span {
    display: block;
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 13px;
}

.pub-page-meta {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.pub-project-count,
.pub-running-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 12px;
    white-space: nowrap;
}

.pub-running-pill {
    max-width: min(48vw, 470px);
    overflow: hidden;
    border-color: rgba(250, 178, 25, .3);
    background: rgba(250, 178, 25, .07);
    color: var(--warning-fg);
}

.pub-running-pill strong {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.pub-running-pid {
    flex: 0 0 auto;
    color: var(--success-fg);
    font-family: var(--font-mono);
    font-size: 11px;
}

.pub-board {
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.pub-grid-header,
.pub-grid-row {
    display: grid;
    grid-template-columns: minmax(150px, .75fr) minmax(315px, 1.2fr) minmax(330px, 1.25fr);
}

.pub-grid-header {
    min-height: 36px;
    align-items: center;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-strong);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pub-grid-header > div {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 8px 12px;
    border-right: 1px solid var(--border);
}

.pub-grid-header > div:last-child { border-right: 0; }
.pub-grid-header > div > span { display: none; }

.pub-grid-row {
    min-height: 54px;
    align-items: stretch;
    border-top: 1px solid var(--border);
    transition: background-color .12s var(--ease);
}

.pub-grid-body > .pub-grid-row:first-child { border-top: 0; }

.pub-grid-row:hover {
    background: rgba(255, 255, 255, .02);
}

.pub-grid-row.row-running {
    background: rgba(12, 163, 12, .045);
    box-shadow: inset 2px 0 0 var(--success);
}

.pub-col-project,
.pub-col-execution,
.pub-col-deployment {
    min-width: 0;
    border-right: 1px solid var(--border);
}

.pub-col-project {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    overflow: hidden;
    padding: 8px 12px;
}

.pub-project-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.pub-project-name {
    overflow: hidden;
    color: var(--text-main);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-project-type {
    flex: 0 0 auto;
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.1;
}

.dp-web-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    color: var(--primary-fg);
    font-size: 11px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.dp-web-link span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-web-link:hover span:nth-child(2) { text-decoration: underline; }
.dp-web-link span:last-child { flex: 0 0 auto; opacity: .6; }
.dp-web-link:hover { color: #b7d3f6; }

.pub-col-execution,
.pub-col-deployment {
    display: grid;
    align-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
}

.pub-col-execution {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pub-col-execution.ysland-execution:not(.running) {
    grid-template-columns: minmax(0, 1.65fr) minmax(92px, .65fr);
}

.ysland-dev-actions {
    display: flex;
    grid-column: 1;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.ysland-test-btn { grid-column: 2; grid-row: 1; align-self: center; }
.ysland-prod-btn { grid-column: 2; grid-row: 2; }

.pub-col-execution.running {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

.pub-col-deployment {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
}

.pub-slot-btn {
    width: 100%;
    min-width: 0;
    height: 28px;
    min-height: 28px;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-action-with-log {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.pub-action-with-log > span:not(.pub-log-btn):not(.pub-last-result) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pub-action-with-log > .pub-log-btn {
    flex: 0 0 auto;
    margin-left: auto;
    cursor: pointer;
}

.pub-action-full {
    background: rgba(250, 178, 25, .12) !important;
    border-color: rgba(250, 178, 25, .4) !important;
    color: var(--warning-fg) !important;
}

/* DocumentoOficialesXaf: herramientas OCR naranjas y modelos/IA azules. */
.document-extra-orange {
    background: rgba(236, 131, 90, .12) !important;
    border-color: rgba(236, 131, 90, .42) !important;
    color: var(--serious-fg) !important;
}
.document-extra-orange:hover {
    background: rgba(236, 131, 90, .2) !important;
    border-color: rgba(236, 131, 90, .6) !important;
}

.document-extra-blue {
    background: var(--primary-soft) !important;
    border-color: rgba(57, 135, 229, .42) !important;
    color: var(--primary-fg) !important;
}
.document-extra-blue:hover {
    background: rgba(57, 135, 229, .22) !important;
    border-color: rgba(57, 135, 229, .6) !important;
}

.pub-running-actions {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.pub-run-state {
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
}

.pub-tone-demo {
    background: rgba(250, 178, 25, .1) !important;
    border-color: rgba(250, 178, 25, .38) !important;
    color: var(--warning-fg) !important;
}

.pub-tone-test {
    background: rgba(144, 133, 233, .12) !important;
    border-color: rgba(144, 133, 233, .4) !important;
    color: #b3abf2 !important;
}

.pub-last-result {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
}
.pub-last-result.ok   { color: var(--success-fg); }
.pub-last-result.fail { color: var(--danger-fg); }

.pub-log-btn {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    opacity: .75;
}
.pub-log-btn:hover {
    background: rgba(255, 255, 255, .1);
    opacity: 1;
}

.ysland-score-dev-actions,
.ysland-score-prod-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}
.ysland-score-prod-actions { grid-column: 3; }

.meserp-local-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}
.meserp-production {
    border-color: rgba(208, 59, 59, .5) !important;
    color: var(--danger-fg) !important;
}

.pub-slot-placeholder {
    height: 28px;
    visibility: hidden;
}

.pub-extra-exec-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.ysland-deploy-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}

.ysland-deploy-group > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ysland-deploy-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.ysland-dev-buttons {
    flex-direction: column;
    align-items: stretch;
}

.ysland-dev-buttons .pub-slot-btn {
    height: 24px;
    min-height: 24px;
}

.pub-history {
    margin-top: 12px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.pub-history-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.pub-history-summary:hover { background: var(--bg-hover); }
.pub-history-summary::-webkit-details-marker { display: none; }
.pub-history-icon { color: var(--muted); font-size: 13px; }
.pub-history-summary > strong { font-size: 13px; font-weight: 600; }

.pub-history-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bg-raised);
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
}

.pub-history-latest {
    margin-left: auto;
    overflow: hidden;
    color: var(--muted);
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-history-latest b { color: var(--text-dim); font-weight: 600; }

.pub-history-chevron {
    flex: 0 0 auto;
    margin-left: 4px;
    color: var(--muted);
    font-size: 15px;
    transition: transform .18s var(--ease);
}

.pub-history[open] .pub-history-chevron { transform: rotate(180deg); }

.pub-history-list {
    max-height: 280px;
    overflow: auto;
    border-top: 1px solid var(--border);
}

.pub-history-empty {
    padding: 16px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.pub-history-item {
    display: grid;
    grid-template-columns: 18px 130px minmax(120px, 1fr) 90px 48px minmax(42px, max-content) 12px;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.pub-history-item:last-child { border-bottom: 0; }

.pub-history-item:hover,
.pub-history-item:focus-visible {
    outline: none;
    background: var(--bg-hover);
}

.pub-history-status {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

.pub-history-status.success { background: rgba(12, 163, 12, .14); color: var(--success-fg); }
.pub-history-status.failure { background: rgba(208, 59, 59, .14); color: var(--danger-fg); }

.pub-history-project,
.pub-history-environment,
.pub-history-time,
.pub-history-duration {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-history-project { color: var(--text-main); font-weight: 500; }
.pub-history-time,
.pub-history-duration { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.pub-history-exit { color: var(--danger-fg); font-family: var(--font-mono); font-size: 11px; }
.pub-history-open { color: var(--muted); font-size: 16px; text-align: right; }

@media (max-width: 1100px) {
    .pub-grid-header { display: none; }
    .pub-grid-row { grid-template-columns: minmax(0, 1fr); }

    .pub-col-project,
    .pub-col-execution,
    .pub-col-deployment {
        border-right: 0;
    }

    .pub-col-project { padding: 10px 12px 6px; }

    .pub-col-execution {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 6px 12px;
        border-top: 1px solid var(--border);
    }

    .pub-col-execution.ysland-execution:not(.running) {
        grid-template-columns: minmax(0, 1.65fr) minmax(92px, .65fr);
    }

    .pub-col-deployment {
        padding: 6px 12px 10px;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 620px) {
    .pub-page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .pub-page-meta {
        justify-content: flex-start;
        width: 100%;
    }

    .pub-running-pill { max-width: 100%; }
    .pub-history-latest { display: none; }
    .ysland-score-prod-actions { grid-column: auto; }

    .pub-history-item {
        grid-template-columns: 18px minmax(75px, 1fr) minmax(60px, 1fr) max-content 12px;
        gap: 6px;
    }

    .pub-history-time { display: none; }
}

/* ═══ DEVICE-AWARE COMPACT TEMPLATE ═══
   The data attribute is maintained by wwwroot/js/device-layout.js so a
   phone/tablet can switch density after rotation without a navigation. */
html[data-device="mobile"],
html.is-mobile {
    --dp-density: .86;
}

html[data-device="desktop"],
html.is-desktop {
    --dp-density: 1;
}

@media (max-width: 640.98px), (pointer: coarse) and (max-width: 900px) {
    body {
        font-size: 13px;
    }

    .page.dp-app-shell {
        display: flex;
        flex-direction: column;
    }

    .dp-app-shell .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .dp-sidebar-topbar {
        min-height: 3rem !important;
        height: 3rem !important;
        padding: 0 .75rem !important;
    }

    .dp-nav-scrollable {
        max-height: min(62vh, 460px);
        overflow-y: auto;
    }

    .dp-nav .nav-link {
        padding: 9px 10px !important;
        font-size: 13px;
    }

    .nav-link.active::before { display: none; }

    .dp-main-topbar {
        min-height: 3rem !important;
        height: 3rem !important;
        gap: 6px;
        padding: .35rem .75rem !important;
        flex-direction: row !important;
        align-items: center !important;
    }

    .dp-main-topbar > div { min-width: 0; }
    .dp-main-topbar > div:last-child { gap: 6px !important; }

    .dp-user-name,
    .dp-divider-v,
    .dp-version {
        display: none !important;
    }

    .dp-main-topbar .dp-clock { font-size: 11px; }

    .content { padding: .75rem !important; }

    .dp-page-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }

    .dp-page-header h1 { font-size: 18px; }
    .dp-page-header p { font-size: 12px; }

    .dp-bar {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    .dp-bar > * { min-width: 0; }

    .dp-accordion { margin-bottom: 10px; }

    .dp-acc-header {
        min-height: 42px;
        gap: 6px;
        padding: 9px 12px !important;
        font-size: 13px;
        flex-wrap: wrap;
    }

    .dp-acc-body {
        max-width: 100%;
        padding: 10px 12px;
        overflow-x: auto;
    }

    .dp-row {
        gap: 6px;
        padding: 8px 10px;
        font-size: 12.5px;
    }

    .dp-btn {
        min-height: 34px;
        padding: 6px 10px;
    }

    .dp-btn.sm, .dp-btn.icon { min-height: 30px; }
    .dp-btn.icon { width: 30px; }

    input:not([type=checkbox]):not([type=radio]),
    select,
    textarea {
        max-width: 100%;
        min-height: 36px;
        padding: 7px 10px !important;
        font-size: 14px !important;
    }

    textarea { min-height: 80px; }

    .row {
        --bs-gutter-x: .6rem;
        --bs-gutter-y: .55rem;
    }

    .table-responsive,
    .dp-table-scroll {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 560px;
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 6px 6px;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    .metric-card { padding: 10px 12px; }
    .metric-card .value { font-size: 20px; }

    .dp-log {
        max-width: 100%;
        max-height: 220px;
        padding: 8px 10px;
        overflow: auto;
        font-size: 11px;
        overflow-wrap: anywhere;
        white-space: pre-wrap;
    }

    pre {
        max-width: 100%;
        overflow: auto;
        overflow-wrap: anywhere;
        white-space: pre-wrap;
    }

    .dp-modal-backdrop {
        align-items: flex-end !important;
        padding: 8px !important;
    }

    .dp-modal-window {
        width: 100% !important;
        max-width: none !important;
        max-height: calc(100dvh - 16px) !important;
        padding: 12px !important;
        border-radius: 12px !important;
        overflow: auto !important;
    }

    .dp-console-output {
        max-height: 42dvh !important;
        font-size: 11px !important;
    }

    .login-shell {
        min-height: calc(100dvh - 6rem) !important;
        padding: 10px 0;
    }

    .login-card { padding: 18px !important; }

    /* Dashboard: keep the dense watchdog table usable with a deliberate swipe. */
    .dp-home-toolbar {
        width: 100%;
        flex-wrap: wrap;
    }

    .dp-home-watchdogs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dp-home-watchdogs table { min-width: 760px; }

    .project-detail-header,
    .machine-card-header,
    .sessions-machine-header {
        flex-wrap: wrap;
    }

    .project-detail-header > .text-dim { margin-left: auto; }

    .machine-card-header > .ms-auto {
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .machine-service-row,
    .machine-vpn-row,
    .machine-disk-row,
    .vpn-console-header,
    .ollama-console-header {
        flex-wrap: wrap;
    }

    .vpn-console-header .text-dim,
    .ollama-console-header .text-dim {
        flex: 1 1 100%;
        order: 3;
    }

    .vpn-console-header .ms-auto,
    .ollama-console-header .ms-auto {
        margin-left: auto !important;
    }

    .machine-service-row span[style*="min-width:190px"] {
        min-width: min(190px, 100%) !important;
        flex: 1 1 150px;
    }

    .machine-disk-row > div { flex: 1 1 100px; }

    .chats-prompt-row > .col { min-width: 0; }
    .chats-prompt-row > .col-auto:first-child { flex: 1 1 100%; }
    .chats-prompt-row > .col-auto:last-child { flex: 0 0 auto; }
    .chats-prompt-row > .col-auto select { width: 100%; }

    .chats-response {
        max-height: 48dvh !important;
        overflow-wrap: anywhere;
    }

    .chats-page .dp-acc-body { overflow-x: hidden; }

    .chats-page .table {
        width: 100%;
        min-width: 0 !important;
        table-layout: fixed;
    }

    .chats-page .table th,
    .chats-page .table td {
        max-width: 0;
        overflow-wrap: anywhere;
        white-space: normal;
        vertical-align: top;
    }

    .chats-page .table code,
    .chats-page code {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .docs-page,
    .chats-page,
    .sessions-page,
    .machines-page {
        max-width: 100%;
    }

    /* Publication: buttons and execution controls become tap-sized cells. */
    .pub-page-title h1 { font-size: 18px; }
    .pub-page-title > div > span { font-size: 12px; }

    .pub-col-execution {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 6px 10px;
    }

    .pub-col-execution.ysland-execution:not(.running) { grid-template-columns: 1fr; }

    .ysland-test-btn,
    .ysland-prod-btn {
        grid-column: auto;
        grid-row: auto;
    }

    .pub-col-deployment {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 6px 10px 10px;
    }

    .pub-slot-btn {
        height: 34px !important;
        font-size: 12px !important;
    }

    .pub-extra-exec-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pub-history-item { padding: 9px 10px; }

    /* OneDrive: each file is a compact two-column card instead of a clipped row. */
    .onedrive-list-header { display: none !important; }

    .onedrive-file-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 8px;
        align-items: center;
        padding: 10px !important;
    }

    .onedrive-file-name { grid-column: 1; min-width: 0; }

    .onedrive-file-meta {
        width: auto !important;
        text-align: left !important;
        font-size: 11px !important;
    }

    .onedrive-file-modified,
    .onedrive-file-size {
        grid-column: 1;
    }

    .onedrive-file-action {
        grid-column: 2;
        grid-row: 1 / span 3;
        width: auto !important;
    }

    /* Users: turn the table into readable records and keep actions together. */
    .users-table {
        width: 100%;
        min-width: 0 !important;
    }

    .users-table thead { display: none; }

    .users-table tbody,
    .users-table tr,
    .users-table td {
        display: block;
        width: 100%;
    }

    .users-table tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    .users-table td {
        padding: 3px 0 !important;
        border: 0 !important;
    }

    .users-table td:nth-child(1)::before { content: 'Usuario: '; color: var(--text-dim); }
    .users-table td:nth-child(2)::before { content: 'Rol: ';     color: var(--text-dim); }
    .users-table td:nth-child(3)::before { content: 'Estado: ';  color: var(--text-dim); }

    .user-actions {
        display: flex !important;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: flex-start !important;
        text-align: left !important;
    }

    .user-actions .dp-btn { flex: 1 1 150px; }
}

/* ═══ MOBILE TEMPLATE — shell, navigation and card layouts ═══ */
.dp-tabbar {
    display: none;
}

@media (max-width: 640.98px), (pointer: coarse) and (max-width: 900px) {
    /* Shell: only the brand bar stays pinned; navigation lives at the bottom. */
    .dp-app-shell .sidebar {
        padding-top: env(safe-area-inset-top);
    }

    .dp-main-topbar {
        position: static;
        background: transparent;
        border-bottom: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: .6rem .75rem 0 !important;
        height: auto !important;
    }

    .dp-restart-update { display: none; }

    .content {
        padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    }

    .dp-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
        background: rgba(19, 20, 23, .94);
        backdrop-filter: saturate(140%) blur(12px);
        -webkit-backdrop-filter: saturate(140%) blur(12px);
        border-top: 1px solid var(--border-strong);
    }

    .dp-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 52px;
        border-radius: 10px;
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 500;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }

    .dp-tabbar a svg {
        width: 21px;
        height: 21px;
    }

    .dp-tabbar a.active {
        color: var(--primary-fg);
    }

    .dp-tabbar a.active svg {
        filter: drop-shadow(0 0 8px rgba(57, 135, 229, .35));
    }

    .dp-tabbar a:active {
        background: var(--bg-hover);
    }

    /* Hamburger menu opens as an overlay sheet instead of pushing content down. */
    .dp-nav-scrollable {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        max-height: calc(100dvh - 3rem - 70px) !important;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-strong);
        box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
    }

    /* Page headers: actions drop below the title and fill the width. */
    .dp-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dp-page-header > .dp-badge,
    .dp-page-header > .badge {
        align-self: flex-start;
    }

    .dp-home-toolbar > .dp-btn {
        flex: 1 1 0;
    }

    .dp-acc-header .ms-auto.d-flex {
        width: 100%;
        margin-left: 0 !important;
    }

    .dp-acc-header .ms-auto.d-flex > .dp-btn {
        flex: 1 1 0;
    }

    .dp-acc-sub {
        margin-left: 0;
        width: 100%;
    }

    /* Data tables marked .dp-table-cards become one card per row. */
    .dp-home-watchdogs { overflow-x: visible !important; }
    .dp-home-watchdogs table { min-width: 0 !important; }

    .dp-table-cards thead { display: none; }

    .dp-table-cards,
    .dp-table-cards tbody {
        display: block;
        width: 100%;
    }

    .dp-table-cards tbody tr {
        display: grid;
        grid-template-columns: 12px minmax(0, 1fr) minmax(0, 1fr) auto;
        align-items: start;
        gap: 10px 10px;
        padding: 14px 14px;
        border-bottom: 1px solid var(--border);
    }

    .dp-table-cards tbody tr.is-off > td:not(:first-child):not(:last-child) { opacity: 1; }

    .dp-table-cards td {
        display: block;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        text-align: left !important;
    }

    .dp-table-cards td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 3px;
        color: var(--muted);
        font-family: var(--font-sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: .03em;
        text-transform: uppercase;
    }

    .dp-table-cards .c-dot     { grid-column: 1; grid-row: 1; padding-top: 6px !important; }
    .dp-table-cards .c-name    { grid-column: 2 / 4; grid-row: 1; }
    .dp-table-cards .c-state   { grid-column: 4; grid-row: 1; }
    .dp-table-cards .c-machine { grid-column: 2; grid-row: 2; }
    .dp-table-cards .c-port    { grid-column: 3; grid-row: 2; }
    .dp-table-cards .c-uptime  { grid-column: 4; grid-row: 2; }
    .dp-table-cards .c-check   { grid-column: 2; grid-row: 3; }
    .dp-table-cards .c-notify  { grid-column: 3; grid-row: 3; }
    .dp-table-cards .c-restart { grid-column: 4; grid-row: 3; }
    .dp-table-cards .c-actions { grid-column: 2 / -1; grid-row: 4; }

    .dp-table-cards .c-name .t-name { font-size: 14px; }
    .dp-table-cards .c-actions > div { justify-content: flex-start !important; }
    .dp-table-cards .c-actions .dp-btn.icon { width: 40px; min-height: 36px; }
    .dp-table-cards input[type=checkbox] { width: 20px; height: 20px; }

    .dp-table-cards tbody tr.is-editing-detail {
        display: block;
        padding-top: 0;
    }

    .dp-table-cards tbody tr.is-editing-detail td:first-child { display: none; }
    .dp-table-cards tbody tr.is-editing-detail input { width: 100% !important; }

    .dp-table-cards tbody tr.is-editing .c-name input,
    .dp-table-cards tbody tr.is-editing select,
    .dp-table-cards tbody tr.is-editing .c-port input {
        width: 100% !important;
    }

    /* Machines */
    .dp-machine { padding: 12px; }
    .dp-panel { padding: 10px 12px; }

    .dp-ctl-label {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .dp-ctl-row > .dp-btn { flex: 1 1 auto; }

    .dp-console-head { flex-wrap: wrap; row-gap: 2px; }
    .dp-console-head strong { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .dp-console-head .dp-btn { flex: 0 0 auto; }
    .dp-console-head .text-dim { flex: 1 1 100%; order: 3; }
    .dp-console-head .ms-auto { margin-left: 0 !important; }

    .dp-metric { height: 30px; }

    .dp-disk {
        grid-template-columns: 26px minmax(0, 1fr) 44px;
        row-gap: 4px;
    }

    .dp-disk .dp-meter { grid-column: 1 / -1; grid-row: 2; }
    .dp-disk-free { grid-column: 2 / -1; grid-row: 3; text-align: left; }
    .dp-disk-pct  { grid-column: 3; grid-row: 1; }

    .dp-kv { gap: 4px 12px; }

    /* Publication */
    .pub-page-meta .pub-project-count { order: 2; }
    .pub-running-actions .dp-btn { flex: 1 1 auto; min-height: 34px; }
    .meserp-local-actions { grid-template-columns: 1fr; }
    .pub-slot-placeholder { display: none; }
    .pub-log-btn { width: 26px; height: 26px; }

    /* Modals become bottom sheets */
    .dp-modal-window {
        resize: none;
        border-radius: 14px 14px 0 0 !important;
        padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    }

    .dp-modal-backdrop { padding: 0 !important; }
    .dp-modal-window .dp-btn { min-height: 38px; }
}

.dp-start-toast { position: fixed; right: 24px; bottom: 24px; z-index: 11000; display: flex; align-items: center; gap: 18px; max-width: min(480px, calc(100vw - 32px)); padding: 16px 18px; color: var(--text); background: var(--bg-surface); border: 1px solid var(--border); border-left: 4px solid #2bb991; border-radius: 12px; box-shadow: 0 8px 32px #0003; overflow-wrap: anywhere; }
.dp-start-toast.error { border-left-color: #ef6673; }
.dp-start-toast button { flex: none; border: 0; background: transparent; color: inherit; font-size: 24px; cursor: pointer; }

/* ═══ TOOLTIPS & COMPACT AGENTS ═══ */
.dp-accordion.dp-has-tooltips {
    overflow: visible;
}

.dp-accordion.dp-has-tooltips > .dp-acc-header {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.dp-table-agents-wrap {
    overflow: visible;
}

@media (max-width: 960px) {
    .dp-table-agents-wrap {
        overflow-x: auto;
    }
}

.dp-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.dp-card-title-main {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.dp-tip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    outline: none;
}

.dp-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    cursor: help;
    user-select: none;
    transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease);
}

.dp-tip-wrap:hover .dp-info-icon,
.dp-tip-wrap:focus-within .dp-info-icon,
.dp-info-icon:hover,
.dp-info-icon:focus-visible {
    border-color: var(--primary);
    color: var(--primary-fg);
    background: var(--primary-soft);
}

.dp-tip-bubble {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 60;
    width: max-content;
    max-width: min(360px, 80vw);
    padding: 8px 10px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-2px);
    transition: opacity .14s var(--ease), transform .14s var(--ease), visibility .14s var(--ease);
}

.dp-card-title-row .dp-tip-bubble {
    left: auto;
    right: 0;
}

.dp-tip-wrap:hover > .dp-tip-bubble,
.dp-tip-wrap:focus-within > .dp-tip-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dp-agent-msg-truncate {
    display: inline-block;
    max-width: 240px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
