* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden;
  font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1d1d1f; }
body { background: radial-gradient(circle at 20% 20%, #6fb1fc, #4364f7 45%, #1c1f6b); }
.hidden { display: none !important; }

button { font: inherit; padding: 6px 12px; border-radius: 7px; border: 1px solid #bbb; background: #fff; cursor: pointer; }
button:hover { background: #f5f5f5; }
button:disabled { opacity: .4; cursor: default; }

#menubar { position: fixed; top: 0; left: 0; right: 0; height: 24px; display: flex; align-items: center;
  gap: 14px; padding: 0 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25);
  background: rgba(255,255,255,.25); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 9999; }
#menubar .right { margin-left: auto; display: flex; gap: 14px; }
#menubar a { color: #fff; }

#icons { position: absolute; top: 44px; left: 16px; display: flex; flex-direction: column;
  flex-wrap: wrap; gap: 10px; max-height: calc(100% - 150px); }
.icon { width: 90px; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); user-select: none; }
.ico { font-size: 40px; line-height: 1.2; }
.icon span { font-size: 12px; word-break: break-word; }

#windows { position: absolute; inset: 0; pointer-events: none; }
.win { position: absolute; display: flex; flex-direction: column; min-width: 260px; min-height: 160px;
  background: rgba(246,246,246,.97); border-radius: 10px; overflow: hidden; pointer-events: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.win:not(.active) { opacity: .94; }
.win.max { left: 0 !important; top: 24px !important; width: 100% !important; height: calc(100% - 24px - 80px) !important; }

.titlebar { position: relative; height: 32px; display: flex; align-items: center; padding: 0 10px;
  background: linear-gradient(#ececec, #d6d6d6); border-bottom: 1px solid #bbb; cursor: default; }
.title { position: absolute; left: 0; right: 0; text-align: center; font-weight: 600; font-size: 13px;
  color: #333; pointer-events: none; }
.dots { display: flex; gap: 7px; z-index: 1; }
.dot { width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.dot.close { background: #ff5f57; }
.dot.max { background: #28c840; }

.content { flex: 1; min-height: 0; overflow: auto; background: #fff; }
.toolbar { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: #f0f0f0; border-bottom: 1px solid #ddd; }
.status { margin-left: auto; color: #666; font-size: 12px; }

.finder { display: flex; flex-direction: column; height: 100%; }
.finder b { padding: 6px 10px; }
.finder .list { flex: 1; overflow: auto; padding: 4px; }
.row { display: flex; gap: 8px; padding: 5px 8px; border-radius: 5px; user-select: none; }
.row:hover { background: #eef3ff; }
.row.sel { background: #0a84ff; color: #fff; }
.empty { color: #888; padding: 12px; }

.editorWrap { display: flex; flex-direction: column; height: 100%; }
.editor { flex: 1; width: 100%; border: 0; padding: 12px; resize: none; outline: none;
  font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.info { padding: 16px; line-height: 1.5; }

#dock { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px;
  padding: 8px 12px; border-radius: 18px; background: rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 9998; }
.dockItem { width: 56px; height: 56px; font-size: 30px; border: 0; border-radius: 14px;
  background: rgba(255,255,255,.6); transition: transform .15s; }
.dockItem:hover { transform: translateY(-6px) scale(1.1); }

.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, #6fb1fc, #4364f7 45%, #1c1f6b); z-index: 10000; }
.card { display: flex; flex-direction: column; gap: 10px; width: 300px; padding: 28px; border-radius: 16px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.card h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
.card input { padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 15px; }
.card button { padding: 10px; background: #0a84ff; color: #fff; border: 0; font-weight: 600; }
.card button.ghost { background: #eee; color: #333; }
.err { color: #c00; margin: 0; min-height: 1em; }

.ctxmenu { position: fixed; z-index: 10001; min-width: 170px; padding: 4px 0; border-radius: 8px;
  background: rgba(246,246,246,.96); border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: 13px; }
.ctxitem { padding: 5px 14px; cursor: default; color: #1d1d1f; }
.ctxitem:hover { background: #0a84ff; color: #fff; }
.ctxsep { height: 1px; background: #ddd; margin: 4px 0; }

.term { display: flex; flex-direction: column; height: 100%; padding: 8px; overflow: auto; cursor: text;
  background: #1e1e1e; color: #d4f5d4; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; }
.term-out { margin: 0; white-space: pre-wrap; word-break: break-word; flex: 1; }
.term-line { display: flex; align-items: center; }
.term-prompt { color: #7fd1ff; white-space: pre; }
.term-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: inherit; font: inherit; }

.writer-page { flex: 1; min-height: 0; overflow: auto; padding: 24px 32px; background: #fff; outline: none;
  font: 15px/1.6 Georgia, "Times New Roman", serif; color: #111; }
.writer-page h1 { font-size: 26px; margin: .6em 0 .4em; }
.writer-page h2 { font-size: 20px; margin: .6em 0 .4em; }
.pdfWrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #525659; }
.pdfWrap .empty { padding: 16px; background: #fff; color: #666; margin: 0; }
.pdfFrame { flex: 1; width: 100%; border: 0; }

.drop { outline: 2px dashed #0a84ff; outline-offset: -2px; background: rgba(10,132,255,.15) !important; }

/* Calendario sul Desktop */
#calWidget { position: fixed; top: 40px; right: 16px; width: 290px; max-height: calc(100% - 120px); overflow: auto;
  z-index: 5; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(0,0,0,.2);
  font-size: 12px; color: #1d1d1f; }
.calw-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.calw-head b { text-transform: capitalize; font-size: 14px; }
.calw-head button { padding: 2px 8px; font-size: 12px; }
.calw-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calw-dh { color: #888; font-weight: 600; padding: 2px 0; }
.calw-d { padding: 5px 0; border-radius: 6px; cursor: pointer; position: relative; }
.calw-d:hover { background: #eef3ff; }
.calw-d.empty { cursor: default; }
.calw-d.today { font-weight: 700; color: #0a84ff; }
.calw-d.sel { background: #0a84ff; color: #fff; }
.calw-d.has::after { content: ''; position: absolute; bottom: 1px; left: 50%; width: 4px; height: 4px;
  margin-left: -2px; border-radius: 50%; background: #ff9500; }
.calw-d.sel.has::after { background: #fff; }
.calw-sec { margin-top: 10px; font-weight: 600; color: #555; text-transform: capitalize; }
.calw-ev { display: flex; gap: 6px; align-items: flex-start; padding: 4px 0; border-bottom: 1px solid #eee; }
.calw-ev .t { color: #0a84ff; font-weight: 600; min-width: 38px; }
.calw-ev .x { margin-left: auto; border: 0; background: none; color: #c00; cursor: pointer; padding: 0 4px; }
.calw-empty { color: #999; padding: 4px 0; }
#calForm { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
#calForm input { font: inherit; padding: 4px; border: 1px solid #ccc; border-radius: 6px; }
#calForm input[type=text] { flex: 1; min-width: 100px; }
#calForm button { padding: 4px 8px; font-size: 12px; }
.icon.drop { border-radius: 10px; }
