:root {
  --accent: #0086e5;
  --bar: rgba(18, 28, 44, .78);
  --panel: #ffffff;
  --text: #1f2d3d;
  --muted: #7b8794;
  --border: #d9e0e8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); overflow: hidden; background: #0b1a2b; user-select: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Fondo ---------- */
.wallpaper { position: fixed; inset: 0; background-size: cover; background-position: center; }
.wp-0 { background:
  radial-gradient(circle at 20% 25%, #1e6fd9 0%, transparent 45%),
  radial-gradient(circle at 80% 70%, #00b3a4 0%, transparent 40%),
  radial-gradient(circle at 60% 15%, #6a3df0 0%, transparent 35%),
  linear-gradient(135deg, #0b1a2b, #12304f); }
.wp-1 { background: linear-gradient(135deg, #ff7e5f, #feb47b 40%, #6a82fb); }
.wp-2 { background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); }
.wp-3 { background: linear-gradient(135deg, #134e5e, #71b280); }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(8, 18, 32, .45); backdrop-filter: blur(8px); padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: rgba(255,255,255,.96);
  border-radius: 14px; padding: 36px 32px 26px; text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,.45); animation: pop .45s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.login-logo { width: 64px; height: 64px; margin-bottom: 10px; }
.login-card h1 { font-size: 22px; font-weight: 600; }
.login-card .muted { margin: 4px 0 22px; }
.login-card input { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 14px; font-size: 15px; margin-bottom: 12px; background: #f8fafc; outline: none; user-select: text; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,134,229,.18); background: #fff; }
.btn-primary { width: 100%; height: 44px; border: 0; border-radius: 8px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: filter .2s; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { height: 36px; padding: 0 16px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 14px; color: var(--text); }
.btn-secondary:hover { background: #f1f5f9; }
.login-error { min-height: 18px; margin-top: 10px; font-size: 13px; color: #e5484d; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------- Escritorio ---------- */
.desktop { position: fixed; inset: 0; }
.topbar { position: absolute; top: 0; left: 0; right: 0; height: 40px; z-index: 500;
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #fff;
  background: var(--bar); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-right: 10px; }
.brand img { width: 22px; height: 22px; }
.menus { display: flex; gap: 2px; }
.menu-btn { background: transparent; border: 0; color: #fff; font-size: 14px; padding: 7px 14px;
  border-radius: 6px; cursor: pointer; }
.menu-btn:hover, .menu-btn.active { background: rgba(255,255,255,.16); }
.spacer { flex: 1; }
.clock { font-size: 13px; opacity: .9; }

.menu-panel { position: absolute; top: 44px; z-index: 600; min-width: 220px;
  background: rgba(255,255,255,.97); border-radius: 12px; padding: 8px;
  box-shadow: 0 18px 45px rgba(0,0,0,.4); animation: drop .15s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px;
  background: none; border: 0; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); text-align: left; }
.menu-item:hover { background: #eef4fb; }
.menu-item img { width: 24px; height: 24px; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.apps-grid { display: grid; grid-template-columns: repeat(2, 130px); gap: 6px; padding: 4px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px;
  border: 0; background: none; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--text); text-align: center; }
.app-tile:hover { background: #eef4fb; }
.app-tile img { width: 52px; height: 52px; }

/* Iconos del escritorio */
.icons { position: absolute; top: 56px; left: 16px; bottom: 60px; display: flex; flex-direction: column;
  flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.d-icon { width: 92px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; border-radius: 10px; cursor: pointer; color: #fff; font-size: 12.5px;
  text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.d-icon:hover { background: rgba(255,255,255,.14); }
.d-icon img { width: 52px; height: 52px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }

/* ---------- Ventanas ---------- */
.win { position: absolute; display: flex; flex-direction: column; min-width: 280px; min-height: 180px;
  background: var(--panel); border-radius: 12px; overflow: hidden; resize: both;
  box-shadow: 0 20px 55px rgba(0,0,0,.45); animation: pop .25s ease; }
.win.maximized { top: 40px !important; left: 0 !important; width: 100% !important; height: calc(100% - 40px - 46px) !important; border-radius: 0; resize: none; }
.win.minimized { display: none; }
.win-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 12px; flex: none;
  background: linear-gradient(#f6f8fb, #e9eef4); border-bottom: 1px solid var(--border); cursor: move; }
.win-bar img { width: 20px; height: 20px; }
.win-title { flex: 1; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-btn { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-size: 15px; color: #526173; }
.win-btn:hover { background: rgba(0,0,0,.08); }
.win-btn.close:hover { background: #e5484d; color: #fff; }
.win-body { flex: 1; overflow: auto; user-select: text; }
.win-body iframe { width: 100%; height: 100%; border: 0; }

.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; z-index: 400;
  display: flex; align-items: center; gap: 6px; padding: 0 10px;
  background: var(--bar); backdrop-filter: blur(14px); }
.task { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; max-width: 190px;
  background: rgba(255,255,255,.1); border: 0; border-radius: 8px; color: #fff; font-size: 13px; cursor: pointer; }
.task:hover { background: rgba(255,255,255,.2); }
.task.active { background: rgba(255,255,255,.28); box-shadow: inset 0 -2px 0 var(--accent); }
.task img { width: 18px; height: 18px; }
.task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Contenido de apps ---------- */
.app-view { padding: 28px; text-align: center; }
.app-view img.big { width: 84px; height: 84px; margin-bottom: 12px; }
.app-view h2 { font-size: 20px; margin-bottom: 6px; }
.app-view p { color: var(--muted); font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.app-view .url { font-family: Consolas, monospace; font-size: 12px; color: var(--accent); word-break: break-all; margin-bottom: 18px; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 18px;
  border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; }
.btn-link:hover { filter: brightness(1.1); }
.note { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* Calculadora */
.calc { padding: 12px; background: #1d2733; height: 100%; display: flex; flex-direction: column; gap: 10px; }
.calc-screen { background: #121a23; color: #fff; text-align: right; font-size: 30px; padding: 14px; border-radius: 8px;
  min-height: 62px; overflow: hidden; font-family: Consolas, monospace; user-select: text; }
.calc-keys { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-keys button { border: 0; border-radius: 8px; background: #2c3a4a; color: #fff; font-size: 18px; cursor: pointer; min-height: 40px; }
.calc-keys button:hover { filter: brightness(1.25); }
.calc-keys .op { background: #3a4c61; }
.calc-keys .eq { background: var(--accent); }

/* Notas */
.notes { width: 100%; height: 100%; border: 0; resize: none; outline: none; padding: 16px; font-size: 15px;
  font-family: inherit; line-height: 1.5; background: #fffdf5; user-select: text; }

/* Formularios (perfil / ajustes) */
.form { padding: 22px 24px; }
.avatar { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1fa2ff, #0061c9); color: #fff; font-size: 30px; font-weight: 600; }
.form label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.form input[type=text], .form input[type=email] { width: 100%; height: 40px; border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px; font-size: 14px; outline: none; }
.form input:focus { border-color: var(--accent); }
.form .btn-row { margin-top: 18px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 64px; height: 44px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.sw.sel { border-color: var(--accent); }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.dot.sel { border-color: #1f2d3d; }
.saved { color: #1a9d55; font-size: 13px; margin-left: 8px; }

/* Móvil */
@media (max-width: 700px) {
  .win { top: 40px !important; left: 0 !important; width: 100% !important; height: calc(100% - 86px) !important; border-radius: 0; resize: none; }
  .brand span, .clock { display: none; }
  .icons { right: 8px; }
}
