/* ═══════════════════════════════════════════════════════════
   CloudOS — Hoja de estilos principal
   ═══════════════════════════════════════════════════════════ */

:root {
  --accent: #4f8cff;
  --accent-2: #7b5cff;
  --glass: rgba(18, 22, 33, 0.72);
  --glass-light: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef1f8;
  --text-dim: #9aa3b5;
  --danger: #ff5c6c;
  --ok: #38d39f;
  --warn: #ffc24b;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --topbar-h: 34px;
  --dock-size: 54px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: #0b0e17;
  user-select: none;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════ BOOT ═══════════ */
#boot-screen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #16203a 0%, #0b0e17 65%);
  gap: 14px;
  transition: opacity .6s ease;
}
#boot-screen.fade { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 72px; animation: bootFloat 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(79,140,255,.45)); }
@keyframes bootFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.boot-title { font-size: 30px; font-weight: 700; letter-spacing: 4px; }
.boot-sub { color: var(--text-dim); font-size: 13px; letter-spacing: 2px; }
.boot-bar { width: 260px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 16px; }
.boot-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .3s ease; }
.boot-status { color: var(--text-dim); font-size: 12px; margin-top: 6px; min-height: 16px; }

/* ═══════════ LOGIN ═══════════ */
#login-screen {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 40px;
  background: linear-gradient(135deg, #10182e 0%, #1a1033 50%, #0b1a2e 100%);
}
.login-clock { text-align: center; }
.login-time { font-size: 84px; font-weight: 200; letter-spacing: 2px; line-height: 1; }
.login-date { color: var(--text-dim); font-size: 18px; margin-top: 8px; text-transform: capitalize; }
.login-card {
  width: 320px; padding: 34px 28px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 20px;
  backdrop-filter: blur(18px); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.login-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center; font-size: 42px;
  box-shadow: 0 8px 26px rgba(79,140,255,.4);
}
.login-name { font-size: 19px; font-weight: 600; }
.login-input-wrap { display: flex; width: 100%; gap: 8px; }
.login-input-wrap input {
  flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255,255,255,.06); color: var(--text); outline: none; font-size: 14px;
}
.login-input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }
.login-input-wrap button {
  width: 44px; border-radius: 10px; border: none; font-size: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white;
  transition: transform .15s;
}
.login-input-wrap button:hover { transform: scale(1.06); }
.login-hint { color: var(--text-dim); font-size: 11.5px; }
.login-footer { position: absolute; bottom: 26px; color: var(--text-dim); font-size: 12px; letter-spacing: .5px; }

/* ═══════════ WALLPAPER ═══════════ */
#desktop { position: fixed; inset: 0; }
#wallpaper { position: absolute; inset: 0; transition: background .5s ease; }

/* ═══════════ TOPBAR ═══════════ */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; z-index: 5000;
  background: rgba(10, 13, 22, .82); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 12.5px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-logo { font-weight: 700; letter-spacing: .4px; }
.topbar-item { cursor: default; opacity: .9; }
#menu-actividades { cursor: pointer; padding: 4px 10px; border-radius: 8px; transition: background .15s; }
#menu-actividades:hover, #menu-actividades.active { background: rgba(255,255,255,.12); }
.topbar-clock { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ═══════════ DOCK ═══════════ */
#dock {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 8px; z-index: 5000;
  padding: 9px 12px; border-radius: 20px;
  background: rgba(12, 16, 26, .72); border: 1px solid var(--border);
  backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.dock-icon {
  width: var(--dock-size); height: var(--dock-size); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; cursor: pointer; position: relative;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.06);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .15s;
}
.dock-icon:hover { transform: translateY(-9px) scale(1.12); background: rgba(255,255,255,.14); }
.dock-icon .dot {
  position: absolute; bottom: -6px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); opacity: 0; transition: opacity .2s;
}
.dock-icon.running .dot { opacity: 1; }
.dock-icon .tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(4px);
  padding: 4px 10px; border-radius: 8px; font-size: 11.5px; white-space: nowrap;
  background: rgba(10,13,22,.95); border: 1px solid var(--border);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.dock-icon:hover .tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.dock-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: rgba(255,255,255,.14); }

/* ═══════════ ICONOS DE ESCRITORIO ═══════════ */
#desktop-icons {
  position: absolute; top: calc(var(--topbar-h) + 12px); left: 12px;
  display: flex; flex-direction: column; flex-wrap: wrap; gap: 6px;
  max-height: calc(100% - var(--topbar-h) - 110px); z-index: 10;
}
.desk-icon {
  width: 86px; padding: 10px 4px; border-radius: 12px; text-align: center;
  cursor: pointer; transition: background .15s;
}
.desk-icon:hover { background: rgba(255,255,255,.1); }
.desk-icon.selected { background: rgba(79,140,255,.28); outline: 1px solid rgba(79,140,255,.5); }
.desk-icon .emoji { font-size: 34px; display: block; }
.desk-icon .label {
  display: block; margin-top: 5px; font-size: 11.5px;
  text-shadow: 0 1px 4px rgba(0,0,0,.9); word-break: break-word;
}

/* ═══════════ VENTANAS ═══════════ */
#windows-layer { position: absolute; inset: 0; z-index: 100; pointer-events: none; }
.window {
  position: absolute; min-width: 320px; min-height: 200px;
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(22px); box-shadow: var(--shadow);
  pointer-events: auto; overflow: hidden;
  animation: winOpen .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes winOpen { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.window.closing { animation: winClose .18s ease forwards; }
@keyframes winClose { to { transform: scale(.86); opacity: 0; } }
.window.focused { border-color: rgba(255,255,255,.22); box-shadow: 0 24px 70px rgba(0,0,0,.65); }
.window.maximized { border-radius: 0; }

.titlebar {
  height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(255,255,255,.045); border-bottom: 1px solid rgba(255,255,255,.07);
  cursor: default; flex-shrink: 0;
}
.titlebar .w-emoji { font-size: 15px; }
.titlebar .w-title { font-size: 12.5px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-controls { display: flex; gap: 7px; }
.w-btn {
  width: 13px; height: 13px; border-radius: 50%; border: none; padding: 0;
  opacity: .85; transition: transform .12s, filter .12s;
}
.w-btn:hover { transform: scale(1.18); filter: brightness(1.25); }
.w-btn.close { background: var(--danger); }
.w-btn.min { background: var(--warn); }
.w-btn.max { background: var(--ok); }
.window-body { flex: 1; overflow: auto; position: relative; }

.resize-handle { position: absolute; z-index: 5; }
.resize-handle.r { right: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.resize-handle.b { bottom: 0; left: 0; right: 0; height: 6px; cursor: ns-resize; }
.resize-handle.br { right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }

/* ═══════════ ACTIVITIES (LAUNCHER) ═══════════ */
#activities {
  position: absolute; inset: 0; z-index: 6000;
  background: rgba(8, 10, 18, .66); backdrop-filter: blur(20px);
  display: flex; flex-direction: column; align-items: center;
  padding-top: 9vh;
}
#activities-search {
  width: min(560px, 86vw); padding: 14px 20px; font-size: 16px;
  border-radius: 14px; border: 1px solid var(--border);
  background: rgba(255,255,255,.08); color: var(--text); outline: none;
}
#activities-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }
#activities-grid {
  margin-top: 34px; display: grid; grid-template-columns: repeat(auto-fill, 108px);
  gap: 18px; justify-content: center; max-width: 720px; overflow-y: auto; padding-bottom: 60px;
}
.act-icon { width: 108px; padding: 14px 6px; border-radius: 16px; text-align: center; cursor: pointer; transition: background .15s, transform .15s; }
.act-icon:hover { background: rgba(255,255,255,.12); transform: translateY(-3px); }
.act-icon .emoji { font-size: 40px; display: block; }
.act-icon .label { display: block; margin-top: 7px; font-size: 12px; }

/* ═══════════ MENÚ CONTEXTUAL ═══════════ */
#context-menu {
  position: absolute; z-index: 8000; min-width: 190px; padding: 6px;
  background: rgba(16, 20, 32, .96); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.ctx-item { padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; display: flex; gap: 9px; align-items: center; }
.ctx-item:hover { background: rgba(79,140,255,.3); }
.ctx-sep { height: 1px; margin: 5px 8px; background: rgba(255,255,255,.1); }

/* ═══════════ NOTIFICACIONES ═══════════ */
#notifications {
  position: absolute; right: 14px; top: calc(var(--topbar-h) + 12px);
  z-index: 7000; display: flex; flex-direction: column; gap: 10px; width: 320px;
}
.notif {
  padding: 13px 15px; border-radius: 14px;
  background: rgba(16, 20, 32, .95); border: 1px solid var(--border);
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
  display: flex; gap: 11px; align-items: flex-start;
  animation: notifIn .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes notifIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.notif.out { animation: notifOut .25s ease forwards; }
@keyframes notifOut { to { transform: translateX(50px); opacity: 0; } }
.notif .n-emoji { font-size: 21px; }
.notif .n-title { font-weight: 700; font-size: 13px; }
.notif .n-body { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }

/* ═══════════ APP: TERMINAL ═══════════ */
.term {
  height: 100%; background: rgba(6, 8, 14, .92); color: #d7e0f0;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace; font-size: 13px;
  padding: 12px 14px; overflow-y: auto; user-select: text;
}
.term-line { white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
.term-input-row { display: flex; gap: 8px; }
.term-prompt { color: var(--ok); white-space: nowrap; }
.term-input {
  flex: 1; background: transparent; border: none; outline: none; color: #d7e0f0;
  font-family: inherit; font-size: inherit; caret-color: var(--accent);
}
.t-ok { color: var(--ok); } .t-err { color: var(--danger); }
.t-warn { color: var(--warn); } .t-dim { color: var(--text-dim); }
.t-accent { color: var(--accent); }

/* ═══════════ APP: ARCHIVOS ═══════════ */
.files { display: flex; height: 100%; }
.files-side {
  width: 150px; border-right: 1px solid rgba(255,255,255,.08);
  padding: 10px 8px; flex-shrink: 0; overflow-y: auto;
}
.files-side-item { padding: 8px 10px; border-radius: 9px; font-size: 12.5px; cursor: pointer; display: flex; gap: 8px; }
.files-side-item:hover { background: rgba(255,255,255,.08); }
.files-side-item.active { background: rgba(79,140,255,.25); }
.files-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.files-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12.5px;
}
.files-path { flex: 1; color: var(--text-dim); background: rgba(255,255,255,.05); border-radius: 8px; padding: 6px 10px; user-select: text; }
.files-btn { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,.07); color: var(--text); font-size: 12px; }
.files-btn:hover { background: rgba(255,255,255,.14); }
.files-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, 92px); gap: 8px; padding: 12px; align-content: start; }
.file-item { padding: 12px 4px; border-radius: 12px; text-align: center; cursor: pointer; }
.file-item:hover { background: rgba(255,255,255,.08); }
.file-item.selected { background: rgba(79,140,255,.28); }
.file-item .f-emoji { font-size: 30px; }
.file-item .f-name { font-size: 11px; margin-top: 5px; word-break: break-word; }

/* ═══════════ APP: EDITOR ═══════════ */
.editor { display: flex; flex-direction: column; height: 100%; }
.editor-bar {
  display: flex; gap: 8px; padding: 8px 12px; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12px;
}
.editor-file { color: var(--text-dim); flex: 1; user-select: text; }
.editor textarea {
  flex: 1; resize: none; border: none; outline: none; padding: 14px;
  background: rgba(6, 8, 14, .6); color: #d7e0f0; font-size: 13.5px; line-height: 1.6;
  font-family: Consolas, "Courier New", monospace; user-select: text;
}
.editor-status { padding: 6px 12px; font-size: 11px; color: var(--text-dim); border-top: 1px solid rgba(255,255,255,.07); display: flex; justify-content: space-between; }

/* ═══════════ APP: CALCULADORA ═══════════ */
.calc { display: flex; flex-direction: column; height: 100%; padding: 14px; gap: 12px; }
.calc-screen {
  background: rgba(6, 8, 14, .65); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: right; min-height: 76px; display: flex; flex-direction: column; justify-content: flex-end;
}
.calc-hist { font-size: 13px; color: var(--text-dim); min-height: 18px; user-select: text; }
.calc-cur { font-size: 32px; font-weight: 600; user-select: text; word-break: break-all; }
.calc-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-btn {
  border: 1px solid var(--border); border-radius: 12px; font-size: 18px;
  background: rgba(255,255,255,.07); color: var(--text); transition: filter .1s, transform .05s;
}
.calc-btn:hover { filter: brightness(1.35); }
.calc-btn:active { transform: scale(.94); }
.calc-btn.op { background: rgba(79,140,255,.22); }
.calc-btn.eq { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.calc-btn.danger { background: rgba(255,92,108,.2); color: var(--danger); }

/* ═══════════ APP: NAVEGADOR ═══════════ */
.browser { display: flex; flex-direction: column; height: 100%; }
.browser-bar { display: flex; gap: 8px; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.08); align-items: center; }
.browser-bar input {
  flex: 1; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255,255,255,.06); color: var(--text); outline: none; font-size: 13px;
}
.browser-frame { flex: 1; border: none; background: white; width: 100%; }
.browser-note { padding: 26px; color: var(--text-dim); font-size: 13px; line-height: 1.7; text-align: center; }

/* ═══════════ APP: AJUSTES ═══════════ */
.settings { display: flex; height: 100%; }
.settings-side { width: 160px; border-right: 1px solid rgba(255,255,255,.08); padding: 12px 9px; flex-shrink: 0; }
.settings-main { flex: 1; overflow-y: auto; padding: 20px 24px; }
.settings h3 { margin: 4px 0 16px; font-size: 18px; }
.settings section { margin-bottom: 26px; }
.settings section h4 { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.045); margin-bottom: 8px; gap: 14px; }
.set-row label { font-size: 13px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: white; }
.set-select, .set-input {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,.07); color: var(--text); font-size: 12.5px; outline: none;
}
.about-card { text-align: center; padding: 26px; }
.about-card .big { font-size: 52px; }
.about-card h2 { margin: 8px 0 4px; }
.about-card p { color: var(--text-dim); font-size: 12.5px; line-height: 1.7; }

/* ═══════════ APP: ACERCA / SISTEMA ═══════════ */
.sysmon { padding: 16px; height: 100%; overflow-y: auto; }
.sysmon h4 { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin: 14px 0 8px; }
.bar { height: 9px; background: rgba(255,255,255,.09); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; color: var(--text-dim); }
.kv b { color: var(--text); font-weight: 600; user-select: text; }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 640px) {
  :root { --dock-size: 46px; }
  #desktop-icons { display: none; }
  .files-side { display: none; }
  .settings-side { width: 110px; }
  .login-time { font-size: 56px; }
}

/* ═══════════ SUDO: root tag, dialog, halt ═══════════ */
.root-tag {
  color: #fff; background: rgba(255,92,108,.35); border: 1px solid rgba(255,92,108,.6);
  padding: 2px 9px; border-radius: 99px; font-weight: 700; cursor: default;
}
.sudo-dialog { min-width: 380px; }
.sudo-head { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.sudo-msg { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
#halt-screen {
  position: fixed; inset: 0; z-index: 11000; background: #05070c;
  display: flex; align-items: center; justify-content: center;
}
.halt-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.halt-logo { font-size: 64px; animation: bootFloat 2.4s ease-in-out infinite; }
.halt-title { font-size: 22px; font-weight: 700; }
.halt-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }

/* ═══════════ APP SUDO ═══════════ */
.sudoapp { padding: 18px 20px; height: 100%; overflow-y: auto; }
.sudo-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px;
  border-radius: 14px; background: linear-gradient(135deg, rgba(255,92,108,.16), rgba(123,92,255,.14));
  border: 1px solid var(--border);
}
.sudo-emoji { font-size: 34px; }
.sudo-banner h3 { font-size: 16px; margin-bottom: 3px; }
.svc-row { align-items: flex-start; }
.svc-btns { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.audit-box { background: rgba(6,8,14,.55); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.audit-row { font-size: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.audit-row:last-child { border-bottom: none; }

/* ═══════════ APP CLOUDDB ═══════════ */
.db-layout { display: flex; gap: 14px; height: calc(100% - 60px); }
.db-side {
  width: 190px; flex-shrink: 0; overflow-y: auto;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
}
.db-view { flex: 1; overflow-y: auto; min-width: 0; }
.sql-console { display: flex; flex-direction: column; gap: 10px; height: calc(100% - 60px); }
.sql-console textarea {
  flex: 1; min-height: 120px; resize: vertical; padding: 12px 14px;
  background: rgba(6, 8, 14, .65); border: 1px solid var(--border); border-radius: 11px;
  color: #d7e0f0; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.55;
  outline: none; user-select: text;
}
.sql-console textarea:focus { border-color: var(--accent); }
.sql-out { flex: 1; overflow: auto; min-height: 90px; }
.sql-pre {
  font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.5;
  background: rgba(6, 8, 14, .6); border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; overflow-x: auto; user-select: text; white-space: pre;
}
.sql-error {
  font-family: Consolas, monospace; font-size: 12.5px; color: var(--danger);
  background: rgba(255,92,108,.08); border: 1px solid rgba(255,92,108,.4);
  border-radius: 11px; padding: 11px 14px; user-select: text;
}

/* ═══════════ APP CLOUDCRM ═══════════ */
.crm { display: flex; height: 100%; }
.crm-side {
  width: 176px; flex-shrink: 0; display: flex; flex-direction: column;
  background: rgba(10, 13, 22, .55); border-right: 1px solid rgba(255,255,255,.08); padding: 14px 10px;
}
.crm-brand { font-weight: 800; font-size: 15px; padding: 4px 8px 14px; letter-spacing: .3px; }
.crm-nav { display: flex; flex-direction: column; gap: 4px; }
.crm-nav-item {
  padding: 9px 11px; border-radius: 10px; font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background .15s;
}
.crm-nav-item:hover { background: rgba(255,255,255,.07); }
.crm-nav-item.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; }
.crm-foot { margin-top: auto; color: var(--text-dim); font-size: 10.5px; padding: 6px 8px; }
.crm-main { flex: 1; overflow-y: auto; padding: 18px 22px; min-width: 0; }
.crm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.crm-head h2 { font-size: 19px; }
.crm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .crm-cols { grid-template-columns: 1fr; } }
.crm-card {
  background: rgba(255,255,255,.045); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
}
.crm-card h4 { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }

.kpis-grid, .crm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: rgba(255,255,255,.045); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; border-top: 3px solid var(--c, var(--accent));
}
.kpi-v { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.kpi-s { font-size: 10.5px; color: var(--text-dim); font-weight: 500; }
.kpi-l { color: var(--text-dim); font-size: 11.5px; margin-top: 4px; }

.hbar-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.hbar-l { width: 84px; font-size: 11.5px; color: var(--text-dim); flex-shrink: 0; }
.hbar { flex: 1; height: 10px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; }
.hbar > div { height: 100%; border-radius: 99px; transition: width .5s ease; }
.hbar-v { font-size: 11px; width: 110px; text-align: right; flex-shrink: 0; }

.crm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.crm-table th {
  text-align: left; color: var(--text-dim); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 1px; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.crm-table td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: top; }
.crm-table tr:hover td { background: rgba(255,255,255,.03); }
.row-act { text-align: right; white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 10.5px;
  font-weight: 700; text-transform: capitalize;
}
.badge.b-cliente { background: rgba(56,211,159,.18); color: var(--ok); }
.badge.b-prospecto { background: rgba(255,194,75,.16); color: var(--warn); }
.badge.b-lead { background: rgba(79,140,255,.18); color: var(--accent); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(158px, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 860px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
.kcol { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.kcol-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 11px; font-size: 11.5px; font-weight: 700;
  border-top: 3px solid var(--c, var(--accent)); background: rgba(255,255,255,.04);
}
.kcol-sum { color: var(--text-dim); font-weight: 500; font-size: 10.5px; }
.kcol-body { padding: 8px; min-height: 90px; display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.kcol-body.over { background: rgba(79,140,255,.12); outline: 2px dashed rgba(79,140,255,.5); outline-offset: -4px; }
.kcard {
  background: rgba(20, 25, 40, .9); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 10px; cursor: grab; transition: transform .12s, border-color .12s;
}
.kcard:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.3); }
.kcard:active { cursor: grabbing; }
.kcard-t { font-size: 12px; font-weight: 600; line-height: 1.35; }
.kcard-c { font-size: 10.5px; margin: 4px 0 6px; }
.kcard-f { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.prob { flex: 1; height: 4px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.prob > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }

/* Actividades CRM */
.acts-list { display: flex; flex-direction: column; gap: 7px; }
.act-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  background: rgba(255,255,255,.045); border: 1px solid var(--border); border-radius: 11px;
}
.act-row.done { opacity: .5; }
.act-row.done .act-main > div:first-child { text-decoration: line-through; }
.act-row.late { border-color: rgba(255,92,108,.5); background: rgba(255,92,108,.07); }
.act-main { flex: 1; font-size: 12.5px; min-width: 0; }
.act-sub { font-size: 10.5px; margin-top: 2px; }
.act-ic { font-size: 16px; flex-shrink: 0; }
.mini-act { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; }
.mini-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-d { flex-shrink: 0; }
.dim { color: var(--text-dim); }

/* Diálogo de formularios CRM/SUDO */
.crm-dialog-ov {
  position: fixed; inset: 0; z-index: 9500; background: rgba(5, 7, 12, .6);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
}
.crm-dialog {
  width: min(430px, 92vw); max-height: 86vh; overflow-y: auto;
  background: rgba(20, 24, 38, .98); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 20px 22px;
}
.crm-dialog h3 { margin-bottom: 14px; font-size: 16px; }
.dlg-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); margin-bottom: 11px; }
.dlg-field input, .dlg-field select {
  padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border);
  background: rgba(255,255,255,.06); color: var(--text); outline: none; font-size: 13px;
}
.dlg-field input:focus, .dlg-field select:focus { border-color: var(--accent); }
.dlg-del { margin: 4px 0 10px; text-align: center; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.dlg-ok { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; font-weight: 600; }
