/* KeepISE · tema pizarra como HomISE, acento ámbar */
:root {
  --bg: #0e131c; --card: #161d2b; --card2: rgba(255, 255, 255, .06); --line: rgba(255, 255, 255, .09);
  --txt: #e8edf6; --muted: #8e9bb2; --accent: #ffb703; --onaccent: #1b1400; --bad: #ff6b6b; --ok: #4cd08a;
  --nl: 22%; --ns: 34%; --nb: rgba(255, 255, 255, .1);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f2f4f8; --card: #ffffff; --card2: rgba(20, 30, 70, .05); --line: rgba(20, 30, 70, .1); --txt: #1a2233; --muted: #667089;
          --nl: 88%; --ns: 88%; --nb: rgba(20, 30, 70, .1); color-scheme: light; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login form { width: min(340px, 100%); display: grid; gap: 12px; text-align: center; }
.login img { margin: 0 auto; border-radius: 18px; }
.login h1 { margin: 4px 0 0; font-size: 28px; }
.login p { margin: 0 0 8px; color: var(--muted); }
.login input { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 16px; text-align: center; }
.err { color: var(--bad); min-height: 20px; font-size: 14px; }
.btn { border-radius: 12px; padding: 12px 18px; font-weight: 700; background: var(--card2); border: 1px solid var(--line); }
.btn.primary { background: var(--accent); color: var(--onaccent); border-color: transparent; }
.btn svg { stroke-width: 2.6; }

/* Cabecera */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 16px; outline: none; }
.search input:focus { border-color: var(--accent); }
.icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon:active { background: var(--card2); }
.sync { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.sync.pend { background: var(--accent); } .sync.off { background: var(--bad); }
.menu { position: absolute; right: 12px; top: calc(54px + var(--safe-t)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 200px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 8px; }
.menu button:active, .menu button:hover { background: var(--card2); }
.menu .sub { padding: 8px 12px; color: var(--muted); font-size: 12px; }
.hint { margin: 10px 14px 0; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.hint button { margin-left: auto; color: var(--muted); font-size: 20px; }

main { max-width: 1100px; margin: 0 auto; padding: 14px 14px calc(96px + var(--safe-b)); }

/* Notas */
.composer { width: 100%; max-width: 560px; display: block; margin: 0 auto 18px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--muted); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.sec { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; margin: 14px 4px 8px; }
.grid { column-count: 2; column-gap: 10px; }
@media (min-width: 640px) { .grid { column-count: 3; } }
@media (min-width: 960px) { .grid { column-count: 4; } }
.note { break-inside: avoid; margin: 0 0 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); cursor: pointer; overflow: hidden; display: block; width: 100%; text-align: left; }
.note[data-c]:not([data-c="0"]) { background: hsl(var(--h) var(--ns) var(--nl)); border-color: var(--nb); }
.note b { display: block; font-size: 16px; margin-bottom: 4px; word-break: break-word; }
.note p { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.note .pin { float: right; margin: 2px 0 0 6px; width: 15px; height: 15px; color: var(--muted); }
.note small { display: block; margin-top: 8px; font-size: 11px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty svg { width: 54px; height: 54px; opacity: .5; display: block; margin: 0 auto 10px; }
.c1 { --h: 0; } .c2 { --h: 28; } .c3 { --h: 48; } .c4 { --h: 110; } .c5 { --h: 170; } .c6 { --h: 210; } .c7 { --h: 265; } .c8 { --h: 330; }

/* Tareas */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.on { background: color-mix(in srgb, var(--accent) 22%, var(--card)); border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--txt); }
.chip em { font-style: normal; opacity: .7; margin-left: 5px; font-size: 12px; }
.add { display: flex; gap: 8px; margin-bottom: 12px; }
.add input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none; }
.add input:focus { border-color: var(--accent); }
.add .btn { padding: 0 16px; display: grid; place-items: center; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.task { display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 12px; min-height: 52px; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.cb { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; flex: none; color: transparent; transition: .12s; }
.cb svg { width: 16px; height: 16px; stroke-width: 3.4; }
.task.done .cb { background: var(--ok); border-color: var(--ok); color: #06210f; }
.task .tx { flex: 1; min-width: 0; padding: 10px 0; word-break: break-word; text-align: left; }
.task.done .tx { text-decoration: line-through; color: var(--muted); }
.task input.ed { flex: 1; min-width: 0; background: var(--card2); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; outline: none; }
.task .rm { opacity: .55; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.task .rm svg { width: 18px; height: 18px; }
.task .rm:hover, .task .rm:active { opacity: 1; color: var(--bad); }
.donehead { display: flex; align-items: center; gap: 8px; margin: 16px 4px 8px; color: var(--muted); font-size: 13px; font-weight: 700; width: calc(100% - 8px); text-align: left; }
.donehead .sp { flex: 1; }
.donehead .lnk { color: var(--accent); font-weight: 600; }
.progress { height: 4px; border-radius: 4px; background: var(--card2); margin: 0 0 12px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); transition: width .25s; }

/* Barra inferior y botón flotante */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 6px; padding: 6px 12px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bar button { flex: 1; max-width: 220px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 600; position: relative; }
.bar button.on { color: var(--accent); }
.bar b { position: absolute; top: 2px; left: calc(50% + 10px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--onaccent); font-size: 11px; display: grid; place-items: center; padding: 0 5px; }
.fab { position: fixed; right: 18px; bottom: calc(76px + var(--safe-b)); width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--onaccent); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .4); z-index: 19; }
.fab svg { width: 26px; height: 26px; stroke-width: 2.8; }
@media (min-width: 760px) { .fab { display: none; } }

/* Editor */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: grid; place-items: end center; }
.panel { width: min(640px, 100%); max-height: 100%; height: 100%; background: var(--card); display: flex; flex-direction: column; padding: calc(8px + var(--safe-t)) 14px calc(10px + var(--safe-b)); }
.panel[data-c]:not([data-c="0"]) { background: hsl(var(--h) var(--ns) var(--nl)); }
@media (min-width: 760px) { .sheet { place-items: center; } .panel { height: min(78vh, 640px); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); } }
.ph { display: flex; align-items: center; gap: 4px; }
.st { background: none; border: 0; outline: none; font-size: 22px; font-weight: 700; padding: 8px 2px; }
.sb { flex: 1; background: none; border: 0; outline: none; resize: none; padding: 6px 2px; font-size: 17px; line-height: 1.5; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: hsl(var(--h, 0) 60% 55%); }
.dot.c0 { background: var(--card2); border-color: var(--muted); }
.dot.on { border-color: var(--txt); box-shadow: 0 0 0 2px var(--bg) inset; }
#sPin.on { color: var(--accent); }
#sPin.on svg { fill: currentColor; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); background: #222b3d; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 80; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); max-width: 90vw; }
