:root{
  --bg:#dfe5ee; --panel:#eef3f9; --ink:#0f172a; --muted:#667085; --line:#c9d1db;
  --brand:#2563eb; --brand-2:#3b82f6; --accent:#22d3ee;
  --ok:#22c55e; --warn:#f59e0b; --bad:#ef4444; --vio:#a855f7;
  --radius:14px;
}
body.dark{
  --bg:#0f172a; --panel:#111827; --ink:#e5e7eb; --muted:#94a3b8; --line:#1f2937;
  --brand:#60a5fa; --brand-2:#3b82f6; --accent:#22d3ee;
  --ok:#22c55e; --warn:#fbbf24; --bad:#f87171; --vio:#c084fc;
}

[hidden]{display:none!important}
*{box-sizing:border-box}
body{margin:0; font-family:"Tahoma","Segoe UI",system-ui,sans-serif; color:var(--ink); background:var(--bg); transition:background .25s,color .25s; position:relative}

/* Splash */
#splash{position:fixed; inset:0; background:var(--bg); z-index:9999; display:flex; align-items:center; justify-content:center}
#splash .bubble{width:120px; height:120px; border-radius:24px; background:var(--panel); box-shadow:0 12px 30px rgba(0,0,0,.18); display:flex; align-items:center; justify-content:center; position:relative; animation:pop .8s ease}
#splash .dot{width:10px; height:10px; border-radius:50%; background:linear-gradient(145deg, var(--brand-2), var(--accent)); filter:drop-shadow(0 0 5px rgba(59,130,246,.6)); animation:pulse 1.1s ease infinite}
#splash .word{position:absolute; font-size:22px; font-weight:900; color:var(--ink); opacity:0; animation:fadeIn .5s ease .3s forwards}
@keyframes pop{from{transform:scale(.9);opacity:.7}to{transform:scale(1);opacity:1}}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.15)}}
@keyframes fadeIn{to{opacity:1}}

/* Header */
header{background:var(--panel); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50}
.header-inner{max-width:1200px; margin:auto; padding:10px 16px; display:flex; align-items:center; justify-content:space-between; gap:12px}
.brand{display:flex; align-items:center; gap:10px; font-weight:900; letter-spacing:.2px}
.logo{width:36px; height:36px; border-radius:10px; background:transparent; position:relative; box-shadow:inset 0 0 0 2px var(--brand)}
.logo::after{content:""; position:absolute; width:9px; height:9px; border-radius:50%; background:linear-gradient(145deg, var(--brand-2), var(--accent)); top:8px; inset-inline-start:8px; box-shadow:0 0 6px rgba(59,130,246,.8)}
.brand-title{display:flex; align-items:center; gap:6px; font-size:18px}
.header-actions{display:flex; align-items:center; gap:10px}

.inp{background:#f8fbff; border:1px solid var(--line); color:var(--ink); padding:10px 12px; border-radius:12px; outline:none; min-width:220px}
.inp.mid{min-width:280px}
.btn{border:1px solid var(--line); background:var(--panel); color:var(--ink); padding:9px 14px; border-radius:12px; font-weight:800; cursor:pointer; transition:transform .08s, background .2s, color .2s, border-color .2s, box-shadow .2s; box-shadow:0 2px 8px rgba(0,0,0,.06)}
.btn:hover{background:var(--brand); color:#fff; border-color:transparent; box-shadow:0 6px 16px rgba(37,99,235,.25)}
.btn:active{transform:scale(.98)}
.btn.icon{padding:8px 10px; width:40px; height:40px; display:flex; align-items:center; justify-content:center}
.btn.ghost{background:#f7f9fc}
.btn.primary{background:linear-gradient(145deg, var(--brand-2), var(--brand)); color:#fff; border-color:transparent}
.btn.danger{background:linear-gradient(145deg, #ef4444, #dc2626); color:#fff; border-color:transparent}
.w100{width:100%}

/* Settings */
.settings-wrap{position:relative}
.settings-pop{position:absolute; top:48px; inset-inline-start:0; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 16px 36px rgba(0,0,0,.2); padding:10px 12px; width:220px; display:flex; flex-direction:column; gap:10px; z-index:100}
.settings-pop .sw{display:flex; align-items:center; gap:8px; font-size:14px}

/* Layout */
.app{max-width:1200px; margin:18px auto; padding:0 16px 24px; display:grid; grid-template-columns:1fr 1fr; gap:16px}
@media (max-width:900px){.app{grid-template-columns:1fr}}

/* Cards */
.card{background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 2px 10px rgba(0,0,0,.08); overflow:hidden}

/* Calendar */
.calendar-head{display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--line); font-weight:900}
.calendar-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:8px; padding:12px}
.weekday{color:var(--muted); font-size:12px; text-align:center; user-select:none}
.day{position:relative; background:var(--panel); border:1px solid var(--line); border-radius:10px; min-height:92px; padding:6px; cursor:pointer; display:flex; flex-direction:column; gap:4px; transition:transform .12s, border-color .12s, box-shadow .12s}
.day:hover{transform:translateY(-2px); border-color:#9bb5ee; box-shadow:0 10px 18px rgba(0,0,0,.08)}
.day.today{outline:2px solid var(--brand-2); outline-offset:2px}
.day.selected{box-shadow:0 0 0 2px var(--brand-2); border-color:var(--brand-2)}
.day.other{opacity:.45}
.num{font-weight:900; font-size:14px}
.tags{display:flex; flex-direction:column; gap:2px}
.tagline{font-size:10px; color:var(--muted); line-height:1.15; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.badge-count{position:absolute; top:6px; inset-inline-end:6px; font-size:11px; font-weight:900; width:20px; height:20px; border-radius:50%; background:#ffcc00; border:1px solid #fff; color:#111; display:flex; align-items:center; justify-content:center}
.holiday{font-size:11px; color:#0f2a72; opacity:.95}
.pin-mini{position:absolute; bottom:6px; inset-inline-end:6px; font-size:14px}

/* Tasks */
.tasks-head{display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--line)}
.tasks-body{display:flex; flex-direction:column; gap:12px; padding:14px 14px 18px}
.small-hint{font-size:12px; color:var(--muted); padding:0 2px 6px 2px}
.status-row{display:grid; grid-template-columns:repeat(auto-fit, minmax(240px,1fr)); gap:12px}
.status-col{background:var(--panel); border:2px dashed var(--line); border-radius:12px; padding:10px; min-height:184px; transition:border-color .15s, background .15s}
.status-col.drag{border-color:var(--brand); background:rgba(37,99,235,.05)}
.status-title{display:flex; align-items:center; justify-content:space-between; color:var(--muted); font-size:13px; margin-bottom:8px}
.count{font-weight:900}
.task{background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px; margin-bottom:10px; cursor:grab; box-shadow:0 2px 8px rgba(0,0,0,.08); animation:fadeIn .22s ease; position:relative; touch-action:manipulation}
.task:active{cursor:grabbing}
@keyframes fadeIn{from{opacity:0; transform:translateY(4px)} to{opacity:1; transform:none}}
.task .title{font-weight:900; font-size:14px; display:flex; align-items:center; gap:6px}
.meta{color:var(--muted); font-size:12px; margin-top:6px; display:flex; gap:8px; flex-wrap:wrap}

/* Status icon */
.sticon{display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; color:#fff; background:var(--st,#999); font-size:12px; box-shadow:0 2px 6px rgba(0,0,0,.15)}

/* Progress bar (unchanged) */
.progress-line{position:absolute; top:0; left:0; height:6px; border-top-left-radius:12px; border-top-right-radius:12px; background:linear-gradient(90deg, #16a34a, #f59e0b, #ef4444); width:0%; transition:width .25s ease}

/* Notes section */
.notes-section{max-width:1200px; margin:0 auto 30px; padding:10px}
.notes-head{display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--line)}
.notes-body{display:grid; grid-template-columns:repeat(auto-fit, minmax(240px,1fr)); gap:10px; padding:12px}

/* iPhone-like note */
.note{
  background:#fff8cc; border:1px solid #f6c100; border-radius:12px;
  padding:12px; position:relative; box-shadow:0 2px 6px rgba(0,0,0,.08);
  overflow:hidden; min-height:74px
}
.note::before{
  content:"";
  position:absolute; inset:0;
  background:repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 22px,
    rgba(0,0,0,.06) 22px, rgba(0,0,0,.06) 23px);
  pointer-events:none
}
body.dark .note{
  background:#3b3418; border-color:#9a7d1a; color:#f1e9c6;
}
body.dark .note::before{
  background:repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 22px,
    rgba(255,255,255,.08) 22px, rgba(255,255,255,.08) 23px);
}
.note.pinned{outline:2px dashed #f59e0b}
.note-title{font-weight:900; font-size:14px}
.note-meta{font-size:12px; color:var(--muted); margin-top:4px}

/* Swipe actions (left) */
.note .swipe-actions{
  position:absolute; inset:0; display:flex; align-items:center;
  justify-content:flex-start; gap:8px; padding:0 10px;
  background:rgba(0,0,0,.04); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px);
  transform:translateX(-16px); opacity:0; pointer-events:none; transition:opacity .15s, transform .15s;
}
.note.show-actions .swipe-actions{opacity:1; pointer-events:auto; transform:translateX(0)}
.note .act{display:flex; align-items:center; gap:6px; padding:8px 10px;
  border-radius:10px; color:#fff; font-weight:800}
.note .act.archive{background:#6b7280}
.note .act.edit{background:#3b82f6}
.note .act.del{background:#ef4444}
.note .act.toTask{background:#22c55e}

/* FAB on the left */
.fab{
  position:fixed; inset-inline-start:20px; bottom:20px;
  width:64px; height:64px; border-radius:50%;
  border:none; font-size:28px; color:#fff;
  background:linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow:0 12px 28px rgba(59,130,246,.35), 0 2px 6px rgba(0,0,0,.08);
  cursor:pointer; transition:transform .12s
}
.fab:hover{transform:scale(1.05)}

/* Sheet */
.sheet{position:fixed; left:0; right:0; bottom:-100%; z-index:200;
  background:var(--panel); border-top:1px solid var(--line);
  box-shadow:0 -24px 60px rgba(0,0,0,.15);
  border-top-left-radius:18px; border-top-right-radius:18px;
  max-height:80vh; overflow:auto; transition:bottom .22s ease}
.sheet.open{bottom:0}
.sheet-head{display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--line)}
.sheet-body{padding:14px 16px; display:grid; gap:10px}
.sheet .row{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media (max-width:520px){.sheet .row{grid-template-columns:1fr}}
.field{display:flex; flex-direction:column; gap:6px}
.field label{font-size:12px; color:var(--muted)}
.sheet-actions{display:flex; gap:10px; justify-content:flex-end; padding:0 16px 14px}

/* Toast */
.toast-wrap{position:fixed; inset-inline-end:16px; bottom:16px; z-index:400; display:flex; flex-direction:column; gap:10px}
.toast{display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:14px; color:#0b1220; background:#fff; border:2px solid #111827; box-shadow:0 22px 44px rgba(0,0,0,.25); font-weight:700}
.toast.success{border-color:#16a34a}.toast.error{border-color:#ef4444}.toast.info{border-color:#3b82f6}.toast.warn{border-color:#f59e0b}
.toast .close,.toast .undo{margin-inline-start:6px; background:transparent; border:0; cursor:pointer; color:#111827; font-weight:900}

/* Modals */
.modal{position:fixed; inset:0; background:rgba(0,0,0,.15); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; z-index:300}
.modal-card{background:var(--panel); border:1px solid var(--line); border-radius:16px; width:min(840px,96vw); box-shadow:0 20px 50px rgba(0,0,0,.2); overflow:hidden}
.modal-card.wide{width:min(980px,98vw)}
.modal-head{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--line)}
.modal-body{padding:12px 14px}
.modal-actions{display:flex; gap:8px; flex-wrap:wrap}

/* Tabs (archive) */
.tabs{display:flex; gap:8px; padding:10px 14px; border-bottom:1px solid var(--line)}
.tab{border:1px solid var(--line); background:var(--panel); padding:8px 12px; border-radius:10px; cursor:pointer}
.tab.active{background:var(--brand); color:#fff; border-color:transparent}
.arch-list{display:grid; grid-template-columns:1fr; gap:10px}
.arch-item{background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px; display:flex; align-items:center; justify-content:space-between}
.arch-actions{display:flex; gap:8px}

/* Mobile tweaks */
@media (max-width:560px){
  .settings-pop{width:260px; right:auto; left:0}
  .settings-pop .sw{font-size:15px}
  .inp{min-width:unset}
  .tasks-head .title{gap:6px}
}
