@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');
:root{--bg:#07130e;--panel:#0d1e16;--panel2:#12271d;--line:rgba(160,205,177,.12);--text:#edf7ef;--muted:#91a99a;--green:#42d99a;--green2:#1a9a68;--red:#ff7777;--amber:#f2c46c;--shadow:0 22px 70px rgba(0,0,0,.24)}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 75% -15%,rgba(31,120,79,.16),transparent 42%),var(--bg);color:var(--text);font-family:'Vazirmatn',Tahoma,sans-serif;min-height:100vh}button,input,textarea,select{font:inherit}button{cursor:pointer}.app-shell{display:flex;min-height:100vh}.sidebar{width:258px;background:rgba(8,22,15,.92);border-left:1px solid var(--line);padding:27px 18px 18px;display:flex;flex-direction:column;flex-shrink:0;z-index:10}.brand{display:flex;align-items:center;gap:12px;padding:0 9px 35px}.brand-mark{width:42px;height:42px;border-radius:14px;background:linear-gradient(145deg,#55e5a7,#16865a);display:grid;place-items:center;color:#062015;font-size:25px;font-weight:800;box-shadow:0 8px 28px #21a96a33}.brand b{display:block;letter-spacing:4px;font-size:17px}.brand small,.profile small{display:block;color:var(--muted);font-size:11px;margin-top:1px}.nav-label,.eyebrow{font-size:10px;letter-spacing:1.7px;color:#6f8b79;font-weight:700}.nav-label{padding:0 12px 12px}.nav-item{border:0;background:transparent;color:#a8bbae;width:100%;display:flex;align-items:center;gap:13px;padding:12px 13px;border-radius:11px;text-align:right;margin:3px 0;transition:.2s}.nav-item>span:first-child{font-size:19px;width:23px;text-align:center;color:#7f9d8a}.nav-item:hover{background:#ffffff08;color:var(--text)}.nav-item.active{background:linear-gradient(90deg,#1a9a6825,#1a9a680b);color:#eafff1;box-shadow:inset -2px 0 var(--green)}.nav-item.active>span:first-child{color:var(--green)}.nav-item em{margin-right:auto;font-style:normal;font-size:11px;background:#1b3b2b;color:var(--green);padding:2px 8px;border-radius:20px}.sidebar-bottom{margin-top:auto}.storage-state{font-size:10px;color:#8ba392;padding:13px 10px 17px;display:flex;align-items:center;gap:8px}.pulse{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #42d99a1b}.profile{border-top:1px solid var(--line);margin-top:16px;padding:17px 8px 0;display:flex;align-items:center;gap:10px}.avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#193c2b;color:var(--green);font-weight:800}.profile b{font-size:12px}.profile-dot{width:7px;height:7px;border-radius:50%;background:var(--green);margin-right:auto}.main{flex:1;min-width:0;padding:0 38px;display:flex;flex-direction:column;max-width:1600px;margin:auto}.topbar{height:112px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:15px}.topbar h1{font-size:23px;margin:4px 0 0}.top-actions{display:flex;align-items:center;gap:11px}.date-chip{font-size:11px;color:#a8bbae;background:#10251a;border:1px solid var(--line);padding:9px 13px;border-radius:10px}.icon-btn{border:1px solid var(--line);background:#102319;color:#cce4d3;border-radius:10px;width:38px;height:38px}.icon-btn:hover{border-color:#42d99a77;color:var(--green)}.primary-btn,.secondary-btn{border:0;border-radius:10px;padding:10px 16px;font-weight:700;font-size:12px}.primary-btn{background:linear-gradient(135deg,#4be2a2,#20a66f);color:#052016;box-shadow:0 7px 22px #22ad7130}.primary-btn:hover{filter:brightness(1.08)}.secondary-btn{background:#1b3025;color:#c6d9cc;border:1px solid var(--line)}.page{padding:29px 0 38px;flex:1;animation:appear .25s ease}@keyframes appear{from{opacity:.5;transform:translateY(4px)}to{opacity:1;transform:none}}footer{border-top:1px solid var(--line);padding:17px 0 22px;display:flex;justify-content:space-between;color:#617a69;font-size:10px}footer span:first-child{letter-spacing:2px;color:#8ca995;font-weight:800}.version{letter-spacing:1px}.welcome{display:flex;justify-content:space-between;align-items:end;margin-bottom:25px}.welcome h2{font-size:24px;margin:6px 0}.welcome p{margin:0;color:var(--muted);font-size:12px}.welcome-mark{font-size:12px;color:#75a98a;border:1px solid var(--line);border-radius:10px;padding:9px 13px}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:13px;margin-bottom:22px}.stat,.panel,.task-card,.routine-card,.calendar-wrap,.assistant-box,.setting-card{background:linear-gradient(145deg,#10251a,#0c1b13);border:1px solid var(--line);border-radius:15px;box-shadow:var(--shadow)}.stat{padding:17px 18px;position:relative;overflow:hidden}.stat:after{content:"";position:absolute;width:70px;height:70px;border-radius:50%;background:#42d99a0c;left:-18px;bottom:-25px}.stat .label{font-size:11px;color:var(--muted)}.stat strong{display:block;font-size:28px;margin-top:7px}.stat .sub{font-size:10px;color:#6e8c78}.stat-icon{float:left;color:var(--green);font-size:19px}.content-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(250px,.85fr);gap:16px}.panel{padding:19px}.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.panel-head h3{font-size:14px;margin:0}.text-link{border:0;background:none;color:var(--green);font-size:11px}.task-list{display:grid;gap:9px}.task-row{display:flex;align-items:center;gap:11px;padding:11px 12px;border:1px solid #ffffff0b;background:#ffffff04;border-radius:11px}.task-check{appearance:none;width:18px;height:18px;border:1px solid #557865;border-radius:6px;margin:0;flex-shrink:0;cursor:pointer}.task-check:checked{background:var(--green);border-color:var(--green)}.task-check:checked:after{content:'✓';display:block;color:#062016;text-align:center;font-size:13px;font-weight:900;line-height:16px}.task-main{min-width:0;flex:1}.task-title{font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.task-meta{font-size:10px;color:var(--muted);margin-top:4px}.done .task-title{text-decoration:line-through;color:#789081}.tag{font-size:9px;padding:4px 8px;border-radius:20px;background:#193c2a;color:#8de3b5;white-space:nowrap}.tag.high{background:#48391e;color:#f1c66d}.tag.urgent{background:#482728;color:#ff9b9b}.empty{padding:27px 12px;text-align:center;color:#7f9988;font-size:12px;border:1px dashed #ffffff18;border-radius:12px}.empty b{display:block;color:#c4d9ca;margin-bottom:5px}.routine-mini{display:flex;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid var(--line)}.routine-mini:last-child{border:0}.routine-time{font-size:11px;color:var(--green);direction:ltr}.routine-mini div:nth-child(2){flex:1}.routine-mini b{font-size:11px;display:block}.routine-mini small{font-size:10px;color:var(--muted)}.quick-actions{display:grid;grid-template-columns:repeat(2,1fr);gap:9px;margin-top:12px}.quick-action{background:#142d20;border:1px solid var(--line);color:#cce2d2;padding:13px;border-radius:11px;text-align:right;font-size:11px}.quick-action span{color:var(--green);font-size:18px;display:block;margin-bottom:5px}.toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-bottom:17px}.search{background:#0e2117;border:1px solid var(--line);color:var(--text);padding:10px 13px;border-radius:10px;min-width:210px;outline:none}.filter-select,.field select,.field input,.field textarea{background:#0a1b12;color:var(--text);border:1px solid #294333;border-radius:9px;padding:10px 11px;outline:none;width:100%}.search:focus,.field input:focus,.field textarea:focus,.field select:focus{border-color:#42d99a99}.toolbar .spacer{flex:1}.task-card,.routine-card{padding:14px 15px;display:flex;align-items:center;gap:12px;margin-bottom:9px}.task-card .task-main,.routine-card .task-main{flex:1}.card-actions{display:flex;gap:5px}.mini-btn{border:1px solid var(--line);background:#13291d;color:#a9c5b2;border-radius:8px;width:31px;height:31px}.mini-btn:hover{color:var(--green);border-color:#42d99a66}.routine-timebox{background:#193c2a;color:var(--green);padding:8px;border-radius:9px;direction:ltr;font-size:12px}.switch{accent-color:var(--green);width:17px;height:17px}.calendar-wrap{padding:19px}.calendar-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:17px}.calendar-head h3{margin:0;font-size:16px}.month-controls{display:flex;gap:7px;align-items:center}.month-controls button{width:32px;height:32px;border-radius:8px;border:1px solid var(--line);background:#142b1e;color:var(--green)}.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}.weekday{text-align:center;color:#779381;font-size:10px;padding:8px 0}.day{min-height:75px;border:1px solid #ffffff0d;background:#ffffff03;border-radius:10px;padding:7px;cursor:pointer;text-align:right;color:#cfe0d4}.day:hover,.day.selected{border-color:#42d99a88;background:#173625}.day.muted{opacity:.25;cursor:default}.day.today .day-num{color:var(--green);font-weight:800}.day-num{font-size:12px}.day-markers{display:flex;gap:3px;margin-top:8px}.day-markers i{width:5px;height:5px;border-radius:50%;background:var(--green)}.day-markers i.routine{background:var(--amber)}.selected-day{margin-top:17px;border-top:1px solid var(--line);padding-top:15px}.selected-day h4{font-size:12px;margin:0 0 10px}.assistant-box{max-width:850px;margin:0 auto;padding:24px}.assistant-intro{text-align:center;padding:22px 0}.assistant-orb{width:65px;height:65px;border-radius:22px;margin:0 auto 14px;background:linear-gradient(145deg,#45dfa0,#14764c);display:grid;place-items:center;color:#062016;font-size:31px;box-shadow:0 0 50px #2bbf7d35}.assistant-intro h2{font-size:19px}.assistant-intro p{font-size:12px;color:var(--muted)}.chat-log{min-height:150px;max-height:330px;overflow:auto;display:flex;flex-direction:column;gap:9px;padding:12px}.bubble{max-width:85%;padding:11px 14px;border-radius:13px;font-size:12px;line-height:1.9}.bubble.bot{background:#173222;align-self:flex-start;border-bottom-right-radius:3px}.bubble.user{background:#1c8058;color:#f1fff6;align-self:flex-end;border-bottom-left-radius:3px}.chat-form{display:flex;gap:8px;border-top:1px solid var(--line);padding-top:14px}.chat-form input{flex:1;min-width:0;background:#091a11;border:1px solid #294333;color:var(--text);border-radius:10px;padding:12px}.suggestions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}.suggestions button{border:1px solid var(--line);background:#14291d;color:#a9c8b5;border-radius:20px;padding:7px 10px;font-size:10px}.settings-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:13px}.setting-card{padding:18px}.setting-card h3{font-size:13px;margin:0 0 7px}.setting-card p{font-size:11px;color:var(--muted);line-height:1.9}.setting-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-top:1px solid var(--line);font-size:11px}.hidden{display:none!important}.modal{width:min(520px,calc(100% - 24px));background:#0d1e16;border:1px solid #365442;border-radius:17px;color:var(--text);padding:0;box-shadow:0 25px 100px #000b}.modal::backdrop{background:#000a;backdrop-filter:blur(5px)}.modal form{padding:22px}.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.modal-head h2{font-size:18px;margin:4px 0}.field{margin-bottom:13px}.field label{display:block;font-size:11px;color:#a7c0af;margin-bottom:7px}.field textarea{resize:vertical}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.weekday-picks{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0}.weekday-picks label{background:#193323;border:1px solid var(--line);border-radius:8px;padding:7px;font-size:10px}.check-row{display:flex;align-items:center;gap:8px;font-size:11px;color:#b5cbbd;margin-top:12px}.check-row input{accent-color:var(--green)}.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,20px);opacity:0;background:#1c3e2b;border:1px solid #42d99a66;color:#dffff0;padding:11px 18px;border-radius:10px;font-size:11px;z-index:30;transition:.25s;pointer-events:none}.toast.show{opacity:1;transform:translate(-50%,0)}.mobile-menu{display:none}body.light{--bg:#edf5ef;--panel:#fff;--panel2:#f4faf5;--line:rgba(25,85,48,.13);--text:#173323;--muted:#637d6b;background:#edf5ef}body.light .sidebar{background:#f8fcf9}body.light .stat,body.light .panel,body.light .task-card,body.light .routine-card,body.light .calendar-wrap,body.light .assistant-box,body.light .setting-card{background:#fff}body.light .date-chip,body.light .icon-btn,body.light .search,body.light .filter-select,body.light .field input,body.light .field textarea,body.light .field select{background:#f4faf5;color:#173323}body.light .task-row{background:#f7fbf8}body.light .modal{background:#fff;color:#173323}body.light .modal .field input,body.light .modal .field textarea,body.light .modal .field select{background:#f4faf5;color:#173323}
@media(max-width:900px){.sidebar{width:220px}.main{padding:0 23px}.stats{grid-template-columns:repeat(2,1fr)}.content-grid{grid-template-columns:1fr}}@media(max-width:650px){.sidebar{position:fixed;right:-270px;top:0;bottom:0;width:250px;transition:.25s;box-shadow:var(--shadow)}.sidebar.open{right:0}.main{padding:0 15px}.topbar{height:88px}.topbar h1{font-size:18px}.mobile-menu{display:block}.date-chip{display:none}.top-actions{gap:6px}.primary-btn{padding:9px 11px}.welcome{align-items:start;gap:10px}.welcome h2{font-size:20px}.welcome-mark{display:none}.stats{gap:8px}.stat{padding:13px}.stat strong{font-size:23px}.panel{padding:14px}.calendar-wrap{padding:11px}.day{min-height:55px;padding:5px}.day-num{font-size:10px}.weekday{font-size:9px}.settings-grid{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.task-card,.routine-card{padding:11px}.toolbar .search{width:100%;min-width:0}.toolbar{align-items:stretch}.toolbar .spacer{display:none}footer{font-size:9px;gap:8px}footer span:nth-child(2){display:none}}
/* Calendar refinements: compact month grid and a clear seven-day agenda. */
.calendar-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.calendar-view-toggle{display:flex;gap:4px;padding:4px;border:1px solid var(--line);border-radius:10px;background:#091a11}.calendar-view-toggle button{border:0;background:transparent;color:var(--muted);padding:7px 12px;border-radius:7px;font-size:10px}.calendar-view-toggle button.active{background:#1a704b;color:#eafff1}.calendar-grid.week-mode .week-day{min-height:104px;border:1px solid var(--line);background:#ffffff04;border-radius:10px;color:var(--text);padding:10px 6px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px}.week-day strong{font-size:19px}.week-day-name{font-size:10px;color:var(--muted)}.week-day-count{font-size:9px;color:var(--green);line-height:1.7;text-align:center}.week-day.selected{border-color:#42d99a88;background:#173625}.week-day.today strong{color:var(--green)}.calendar-grid.week-mode .weekday{padding-bottom:5px}@media(max-width:650px){.calendar-head{align-items:flex-start;gap:10px;flex-direction:column}.calendar-tools{width:100%;justify-content:space-between}.calendar-grid.week-mode{gap:3px}.calendar-grid.week-mode .week-day{min-height:88px;padding:7px 2px}.week-day-name{font-size:8px}.week-day-count{font-size:8px}.calendar-view-toggle button{padding:7px 9px}}

/* Loki emerald-and-gold identity refresh */
.brand-mark{
  width:48px;height:48px;flex:0 0 48px;padding:0;overflow:hidden;
  border-radius:15px;background:#020905;
  border:1px solid rgba(66,217,154,.72);
  box-shadow:0 0 0 1px rgba(242,196,108,.18),0 0 22px rgba(34,211,125,.28),inset 0 0 12px rgba(34,211,125,.16);
}
.brand-mark img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.brand b{letter-spacing:4px;color:#f1d28a;text-shadow:0 0 14px rgba(242,196,108,.2)}
.avatar{
  width:38px;height:38px;flex:0 0 38px;padding:0;overflow:hidden;
  border:1px solid rgba(66,217,154,.65);background:#020905;
  box-shadow:0 0 14px rgba(34,211,125,.18)
}
.avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.profile b{color:#f1d28a}
.assistant-orb{
  overflow:hidden;border:1px solid rgba(242,196,108,.5);
  background:#020905 url('./icon-192.png?v=11') center/cover no-repeat;
  box-shadow:0 0 32px rgba(34,211,125,.28),0 0 16px rgba(242,196,108,.12)
}
.assistant-orb{font-size:0}
footer span:first-child{color:#e8c778;text-shadow:0 0 12px rgba(242,196,108,.2)}
@media(max-width:650px){.brand-mark{width:44px;height:44px;flex-basis:44px}}


/* LOKI EMERALD / GOLD IDENTITY — exact supplied emblem */
.brand-mark{
  width:48px;height:48px;flex:0 0 48px;padding:0;overflow:hidden;
  border-radius:13px;background:#020905;
  border:1px solid rgba(73,255,160,.72);
  box-shadow:0 0 10px rgba(30,255,130,.38),0 0 26px rgba(20,220,110,.20);
}
.brand-mark img{
  display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit;
}
.profile .avatar{
  width:38px;height:38px;flex:0 0 38px;padding:0;overflow:hidden;
  border-radius:11px;background:#020905;border:1px solid rgba(73,255,160,.55);
  box-shadow:0 0 12px rgba(30,255,130,.20);
}
.profile .avatar img{
  display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit;
}
.assistant-orb{
  width:76px;height:76px;border-radius:20px;
  background:#020905 url("./icon-192.png?v=10") center/cover no-repeat;
  border:1px solid rgba(73,255,160,.7);
  color:transparent;font-size:0;
  box-shadow:0 0 16px rgba(30,255,130,.42),0 0 42px rgba(20,220,110,.22);
}
body{
  background:
    radial-gradient(ellipse at 50% -12%,rgba(0,255,125,.16),transparent 38%),
    radial-gradient(ellipse at 0% 100%,rgba(0,130,70,.10),transparent 34%),
    var(--bg);
}
.sidebar{background:linear-gradient(180deg,rgba(2,9,5,.98),rgba(5,20,12,.97));}
.brand b{letter-spacing:4.5px;color:#f3dfad;text-shadow:0 0 14px rgba(255,190,70,.16);}
.topbar{border-bottom-color:rgba(63,226,135,.16);}
.primary-btn{
  background:linear-gradient(135deg,#f2d18a 0%,#c58a2c 48%,#f3d995 100%);
  color:#160d02;box-shadow:0 7px 24px rgba(202,145,48,.20);
}
.primary-btn:hover{filter:brightness(1.08);}
.nav-item.active{background:linear-gradient(90deg,rgba(24,150,85,.24),rgba(24,150,85,.06));box-shadow:inset -2px 0 #45ef9a;}
.nav-item.active>span:first-child{color:#55efa0;}
.pulse{background:#55efa0;box-shadow:0 0 0 4px rgba(85,239,160,.14),0 0 12px rgba(85,239,160,.6);}
@media(max-width:650px){
  .brand-mark{width:44px;height:44px;flex-basis:44px;}
}


/* Identity cleanup: keep the original gold/emerald emblem crisp and consistent. */
.brand-mark{width:48px;height:48px;flex:0 0 48px;padding:0;overflow:hidden;border-radius:14px;background:#020905;border:1px solid rgba(73,255,160,.72);box-shadow:0 0 10px rgba(30,255,130,.30),0 0 22px rgba(20,220,110,.16)}
.brand-mark img{display:block;width:100%;height:100%;object-fit:contain;border-radius:inherit}
.profile .avatar{width:38px;height:38px;flex:0 0 38px;padding:0;overflow:hidden;border-radius:50%;background:#020905;border:1px solid rgba(242,196,108,.68);box-shadow:0 0 12px rgba(30,255,130,.18)}
.profile .avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.assistant-orb{width:76px;height:76px;border-radius:20px;overflow:hidden;background:#020905 url("./icon-192.png?v=10") center/cover no-repeat;border:1px solid rgba(73,255,160,.7);color:transparent;font-size:0;box-shadow:0 0 16px rgba(30,255,130,.35),0 0 34px rgba(20,220,110,.18)}
@media(max-width:650px){.brand-mark{width:44px;height:44px;flex-basis:44px}}

/* Functional brand image sizing: keep the supplied emblem inside its UI containers. */
.brand-mark{overflow:hidden}.brand-mark img{display:block;width:100%;height:100%;object-fit:contain;border-radius:inherit}.avatar{overflow:hidden}.avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%}

/* Theme engine v2 — presets are scoped to this user's document only. */
body[data-theme="loki"]{--bg:#07130e;--panel:#0d1e16;--panel2:#12271d;--line:rgba(160,205,177,.12);--text:#edf7ef;--muted:#91a99a;--green:#42d99a;--green2:#1a9a68;--theme-accent:#55efa0;--theme-accent-2:#c58a2c;--theme-glow:rgba(30,255,130,.22)}
body[data-theme="spider"]{--bg:#080a14;--panel:#101525;--panel2:#171f34;--line:rgba(111,151,255,.19);--text:#f0f4ff;--muted:#9aa8c4;--green:#ff365f;--green2:#176bdf;--theme-accent:#ff365f;--theme-accent-2:#2587ff;--theme-glow:rgba(36,113,255,.3)}
body[data-theme="cyber"]{--bg:#10091b;--panel:#1b1029;--panel2:#27153a;--line:rgba(207,126,255,.18);--text:#fbf0ff;--muted:#b9a0ca;--green:#d76bff;--green2:#8736d4;--theme-accent:#ed72ff;--theme-accent-2:#7d5cff;--theme-glow:rgba(180,74,255,.28)}
body[data-theme="obsidian"]{--bg:#090909;--panel:#151515;--panel2:#202020;--line:rgba(220,180,104,.18);--text:#f4f0e8;--muted:#aaa195;--green:#e4b85e;--green2:#9c7130;--theme-accent:#f0c875;--theme-accent-2:#b78335;--theme-glow:rgba(226,177,82,.23)}
body[data-theme="arctic"]{--bg:#071827;--panel:#0d2639;--panel2:#14364d;--line:rgba(116,206,245,.18);--text:#e9f8ff;--muted:#91b5c9;--green:#67d7ff;--green2:#238db8;--theme-accent:#79e1ff;--theme-accent-2:#2c9ecb;--theme-glow:rgba(56,190,245,.24)}
body[data-theme]:not([data-theme="loki"]){background:radial-gradient(ellipse at 75% -15%,var(--theme-glow),transparent 43%),var(--bg);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) .sidebar{background:linear-gradient(180deg,var(--bg),var(--panel));border-color:var(--line)}
body[data-theme]:not([data-theme="loki"]) .stat,
body[data-theme]:not([data-theme="loki"]) .panel,
body[data-theme]:not([data-theme="loki"]) .task-card,
body[data-theme]:not([data-theme="loki"]) .routine-card,
body[data-theme]:not([data-theme="loki"]) .calendar-wrap,
body[data-theme]:not([data-theme="loki"]) .assistant-box,
body[data-theme]:not([data-theme="loki"]) .setting-card{background:linear-gradient(145deg,var(--panel2),var(--panel));border-color:var(--line);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) .nav-item{color:var(--muted)}
body[data-theme]:not([data-theme="loki"]) .nav-item.active{background:color-mix(in srgb,var(--theme-accent) 15%,transparent);box-shadow:inset -2px 0 var(--theme-accent);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) .nav-item.active>span:first-child,
body[data-theme]:not([data-theme="loki"]) .pulse,
body[data-theme]:not([data-theme="loki"]) .eyebrow{color:var(--theme-accent)}
body[data-theme]:not([data-theme="loki"]) .pulse{background:var(--theme-accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--theme-accent) 16%,transparent),0 0 13px var(--theme-glow)}
body[data-theme]:not([data-theme="loki"]) .primary-btn{background:linear-gradient(125deg,var(--theme-accent),var(--theme-accent-2));color:#071018;box-shadow:0 7px 24px var(--theme-glow)}
body[data-theme]:not([data-theme="loki"]) .secondary-btn,
body[data-theme]:not([data-theme="loki"]) .icon-btn,
body[data-theme]:not([data-theme="loki"]) .date-chip,
body[data-theme]:not([data-theme="loki"]) .suggestions button{background:var(--panel2);border-color:var(--line);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) input,
body[data-theme]:not([data-theme="loki"]) textarea,
body[data-theme]:not([data-theme="loki"]) select{background:var(--bg);border-color:var(--line);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) .bubble.bot{background:var(--panel2);color:var(--text)}
body[data-theme]:not([data-theme="loki"]) .bubble.user{background:var(--theme-accent-2);color:#fff}
body[data-theme]:not([data-theme="loki"]) .tag{border-color:var(--line)}
body[data-theme="spider"] .brand-mark,body[data-theme="spider"] .assistant-orb{border-color:#ff365f;box-shadow:0 0 15px rgba(255,54,95,.35),0 0 30px rgba(37,135,255,.22)}
body[data-theme="spider"] .brand b{color:#eaf2ff;text-shadow:0 0 12px rgba(37,135,255,.4)}
body[data-theme="spider"] .primary-btn{background:linear-gradient(110deg,#ff365f 0%,#8b3eff 48%,#2587ff 100%);color:white}
body[data-theme="cyber"] .brand b{color:#f2baff}
body[data-theme="obsidian"] .brand b{color:#f0c875}
body[data-theme="arctic"] .brand b{color:#a8eaff;text-shadow:0 0 12px rgba(103,215,255,.28)}

/* Accessible, responsive preset picker. */
.theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.theme-option{position:relative;display:flex;align-items:center;gap:12px;min-width:0;text-align:right;padding:13px;border:1px solid var(--line);border-radius:13px;background:var(--panel2);color:var(--text);transition:border-color .18s,transform .18s,box-shadow .18s}
.theme-option:hover{transform:translateY(-2px);border-color:var(--theme-accent,var(--green))}
.theme-option.selected{border-color:var(--theme-accent,var(--green));box-shadow:0 0 0 1px var(--theme-accent,var(--green)),0 8px 24px var(--theme-glow,transparent)}
.theme-swatch{display:flex;flex:0 0 54px;width:54px;height:42px;overflow:hidden;border-radius:9px;background:#07130e;border:1px solid #ffffff24}
.theme-swatch i{display:block;flex:1}
.theme-loki .theme-swatch{background:#020905}.theme-loki .theme-swatch i:nth-child(1){background:#0c3825}.theme-loki .theme-swatch i:nth-child(2){background:#42d99a}.theme-loki .theme-swatch i:nth-child(3){background:#c58a2c}
.theme-spider .theme-swatch i:nth-child(1){background:#080a14}.theme-spider .theme-swatch i:nth-child(2){background:#ff365f}.theme-spider .theme-swatch i:nth-child(3){background:#2587ff}
.theme-cyber .theme-swatch i:nth-child(1){background:#10091b}.theme-cyber .theme-swatch i:nth-child(2){background:#ed72ff}.theme-cyber .theme-swatch i:nth-child(3){background:#7d5cff}
.theme-obsidian .theme-swatch i:nth-child(1){background:#090909}.theme-obsidian .theme-swatch i:nth-child(2){background:#55504a}.theme-obsidian .theme-swatch i:nth-child(3){background:#f0c875}
.theme-arctic .theme-swatch i:nth-child(1){background:#071827}.theme-arctic .theme-swatch i:nth-child(2){background:#238db8}.theme-arctic .theme-swatch i:nth-child(3){background:#79e1ff}
.theme-option-copy{display:flex;flex-direction:column;gap:3px;min-width:0}.theme-option-copy strong{font-size:12px}.theme-option-copy small{font-size:9px;line-height:1.6;color:var(--muted)}
.theme-check{margin-right:auto;flex:0 0 19px;width:19px;height:19px;display:grid;place-items:center;border-radius:50%;font-size:11px;color:var(--theme-accent,var(--green));background:color-mix(in srgb,var(--theme-accent,var(--green)) 15%,transparent)}
.theme-sync-note{margin:13px 0 0!important;font-size:10px!important}
@media(max-width:650px){.theme-grid{grid-template-columns:1fr}.theme-option{padding:11px}.theme-option-copy small{font-size:10px}}


/* Loki Theme Engine v3: every preset owns an independent dark/light palette. */
body[data-theme][data-theme-mode="dark"]{color-scheme:dark}
body[data-theme][data-theme-mode="light"]{color-scheme:light}
body[data-theme="loki"][data-theme-mode="dark"]{--bg:#07130e;--panel:#0d1e16;--panel2:#12271d;--line:rgba(160,205,177,.15);--text:#edf7ef;--muted:#91a99a;--green:#42d99a;--green2:#1a9a68;--theme-accent:#55efa0;--theme-accent-2:#c58a2c;--theme-glow:rgba(30,255,130,.2);--field-bg:#091a11;--surface-soft:#142d20;--surface-strong:#193c2a;--on-accent:#052016}
body[data-theme="spider"][data-theme-mode="dark"]{--bg:#080a14;--panel:#101525;--panel2:#171f34;--line:rgba(111,151,255,.2);--text:#f0f4ff;--muted:#9aa8c4;--green:#ff365f;--green2:#176bdf;--theme-accent:#ff365f;--theme-accent-2:#2587ff;--theme-glow:rgba(36,113,255,.3);--field-bg:#0b1020;--surface-soft:#17213a;--surface-strong:#202d4b;--on-accent:#fff}
body[data-theme="cyber"][data-theme-mode="dark"]{--bg:#10091b;--panel:#1b1029;--panel2:#27153a;--line:rgba(207,126,255,.2);--text:#fbf0ff;--muted:#b9a0ca;--green:#d76bff;--green2:#8736d4;--theme-accent:#ed72ff;--theme-accent-2:#7d5cff;--theme-glow:rgba(180,74,255,.28);--field-bg:#160d22;--surface-soft:#2a1740;--surface-strong:#382050;--on-accent:#16091f}
body[data-theme="obsidian"][data-theme-mode="dark"]{--bg:#090909;--panel:#151515;--panel2:#202020;--line:rgba(220,180,104,.2);--text:#f4f0e8;--muted:#aaa195;--green:#e4b85e;--green2:#9c7130;--theme-accent:#f0c875;--theme-accent-2:#b78335;--theme-glow:rgba(226,177,82,.23);--field-bg:#101010;--surface-soft:#29251e;--surface-strong:#383126;--on-accent:#17120a}
body[data-theme="arctic"][data-theme-mode="dark"]{--bg:#071827;--panel:#0d2639;--panel2:#14364d;--line:rgba(116,206,245,.2);--text:#e9f8ff;--muted:#91b5c9;--green:#67d7ff;--green2:#238db8;--theme-accent:#79e1ff;--theme-accent-2:#2c9ecb;--theme-glow:rgba(56,190,245,.24);--field-bg:#091e2e;--surface-soft:#17405a;--surface-strong:#20536f;--on-accent:#041923}
body[data-theme="loki"][data-theme-mode="light"]{--bg:#edf8f1;--panel:#ffffff;--panel2:#f4fbf6;--line:rgba(29,105,66,.16);--text:#183b2a;--muted:#668273;--green:#16885a;--green2:#0d6844;--theme-accent:#16885a;--theme-accent-2:#b27a25;--theme-glow:rgba(38,150,94,.13);--field-bg:#f7fcf8;--surface-soft:#e4f3e9;--surface-strong:#d5ecde;--on-accent:#fff}
body[data-theme="spider"][data-theme-mode="light"]{--bg:#f2f5ff;--panel:#ffffff;--panel2:#f7f8ff;--line:rgba(63,91,160,.17);--text:#1b2540;--muted:#687695;--green:#d92e54;--green2:#245fc4;--theme-accent:#df3158;--theme-accent-2:#246de0;--theme-glow:rgba(45,105,220,.13);--field-bg:#f7f8ff;--surface-soft:#e9edfb;--surface-strong:#dce4fa;--on-accent:#fff}
body[data-theme="cyber"][data-theme-mode="light"]{--bg:#fbf2ff;--panel:#ffffff;--panel2:#fff8ff;--line:rgba(135,71,164,.17);--text:#392044;--muted:#866b91;--green:#a83bd1;--green2:#7141c2;--theme-accent:#b84bdd;--theme-accent-2:#7955d6;--theme-glow:rgba(175,76,210,.13);--field-bg:#fff9ff;--surface-soft:#f4e7fa;--surface-strong:#ecd8f5;--on-accent:#fff}
body[data-theme="obsidian"][data-theme-mode="light"]{--bg:#f6f3ed;--panel:#ffffff;--panel2:#fbf9f5;--line:rgba(115,91,53,.18);--text:#30291f;--muted:#817666;--green:#9b702b;--green2:#76511d;--theme-accent:#a8792e;--theme-accent-2:#5c5140;--theme-glow:rgba(168,121,46,.12);--field-bg:#fcfaf6;--surface-soft:#f0eade;--surface-strong:#e7decd;--on-accent:#fff}
body[data-theme="arctic"][data-theme-mode="light"]{--bg:#edf8fc;--panel:#ffffff;--panel2:#f5fbfe;--line:rgba(45,123,157,.17);--text:#17394a;--muted:#63899a;--green:#168bb7;--green2:#116b91;--theme-accent:#168bb7;--theme-accent-2:#65bad8;--theme-glow:rgba(42,164,205,.13);--field-bg:#f7fcff;--surface-soft:#e3f3f9;--surface-strong:#d2ebf5;--on-accent:#fff}

/* Re-skin legacy hard-coded surfaces and accents so no preset leaks Loki green. */
body[data-theme] {background:radial-gradient(ellipse at 75% -15%,var(--theme-glow),transparent 44%),var(--bg)!important;color:var(--text)!important}
body[data-theme] .sidebar{background:linear-gradient(180deg,var(--panel),var(--bg))!important;border-color:var(--line)!important}
body[data-theme] .brand-mark{background:linear-gradient(145deg,var(--theme-accent),var(--theme-accent-2))!important;color:var(--on-accent)!important;box-shadow:0 8px 28px var(--theme-glow)!important}
body[data-theme] .nav-label,body[data-theme] .eyebrow,body[data-theme] .nav-item>span:first-child{color:var(--muted)!important}
body[data-theme] .nav-item{color:var(--muted)!important}
body[data-theme] .nav-item.active{background:color-mix(in srgb,var(--theme-accent) 15%,transparent)!important;color:var(--text)!important;box-shadow:inset -2px 0 var(--theme-accent)!important}
body[data-theme] .nav-item.active>span:first-child,body[data-theme] .routine-time,body[data-theme] .stat-icon,body[data-theme] .text-link,body[data-theme] .quick-action span{color:var(--theme-accent)!important}
body[data-theme] .nav-item em,body[data-theme] .tag,body[data-theme] .avatar,body[data-theme] .routine-timebox,body[data-theme] .quick-action{background:var(--surface-soft)!important;color:var(--theme-accent)!important}
body[data-theme] .stat,body[data-theme] .panel,body[data-theme] .task-card,body[data-theme] .routine-card,body[data-theme] .calendar-wrap,body[data-theme] .assistant-box,body[data-theme] .setting-card{background:linear-gradient(145deg,var(--panel2),var(--panel))!important;border-color:var(--line)!important;color:var(--text)!important}
body[data-theme] .stat:after{background:var(--theme-glow)!important}
body[data-theme] .date-chip,body[data-theme] .icon-btn,body[data-theme] .secondary-btn,body[data-theme] .mini-btn,body[data-theme] .month-controls button,body[data-theme] .suggestions button{background:var(--surface-soft)!important;border-color:var(--line)!important;color:var(--text)!important}
body[data-theme] .icon-btn:hover,body[data-theme] .mini-btn:hover{border-color:var(--theme-accent)!important;color:var(--theme-accent)!important}
body[data-theme] .primary-btn{background:linear-gradient(120deg,var(--theme-accent),var(--theme-accent-2))!important;color:var(--on-accent)!important;box-shadow:0 7px 24px var(--theme-glow)!important}
body[data-theme] .search,body[data-theme] .filter-select,body[data-theme] .field select,body[data-theme] .field input,body[data-theme] .field textarea,body[data-theme] .chat-form input{background:var(--field-bg)!important;border-color:var(--line)!important;color:var(--text)!important}
body[data-theme] .task-row,body[data-theme] .day{background:var(--surface-soft)!important;border-color:var(--line)!important;color:var(--text)!important}
body[data-theme] .task-row .task-meta,body[data-theme] .empty,body[data-theme] .stat .sub,body[data-theme] footer,body[data-theme] .storage-state{color:var(--muted)!important}
body[data-theme] .task-check{border-color:var(--theme-accent)!important;accent-color:var(--theme-accent)!important}
body[data-theme] .task-check:checked{background:var(--theme-accent)!important;border-color:var(--theme-accent)!important}
body[data-theme] .task-check:checked:after{color:var(--on-accent)!important}
body[data-theme] .day:hover,body[data-theme] .day.selected{border-color:var(--theme-accent)!important;background:color-mix(in srgb,var(--theme-accent) 13%,var(--panel))!important}
body[data-theme] .day.today .day-num,body[data-theme] .day-markers i{color:var(--theme-accent)!important;background:var(--theme-accent)!important}
body[data-theme] .assistant-orb{background:linear-gradient(145deg,var(--theme-accent),var(--theme-accent-2))!important;color:var(--on-accent)!important;box-shadow:0 0 42px var(--theme-glow)!important}
body[data-theme] .bubble.bot{background:var(--surface-soft)!important;color:var(--text)!important}
body[data-theme] .bubble.user{background:var(--theme-accent-2)!important;color:var(--on-accent)!important}
body[data-theme] .modal{background:var(--panel)!important;border-color:var(--line)!important;color:var(--text)!important}
body[data-theme] .field label,body[data-theme] .check-row{color:var(--muted)!important}
body[data-theme] .weekday-picks label{background:var(--surface-soft)!important;color:var(--text)!important;border-color:var(--line)!important}
body[data-theme] .toast{background:var(--surface-strong)!important;border-color:var(--theme-accent)!important;color:var(--text)!important}
body[data-theme] .pulse,body[data-theme] .profile-dot{background:var(--theme-accent)!important;box-shadow:0 0 0 4px var(--theme-glow)!important}
body[data-theme="spider"] .brand b{color:var(--text)!important;text-shadow:0 0 12px var(--theme-glow)}
body[data-theme="spider"] .primary-btn{background:linear-gradient(110deg,#ff365f 0%,#8b3eff 48%,#2587ff 100%)!important;color:#fff!important}
body[data-theme="loki"] .brand b{color:var(--text)}

.theme-mode-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:18px;padding:13px 0 5px;border-top:1px solid var(--line);font-size:11px;color:var(--text)}
.theme-mode-switch{display:flex;gap:5px;padding:4px;border:1px solid var(--line);border-radius:11px;background:var(--field-bg)}
.theme-mode-switch button{border:0;border-radius:8px;padding:8px 12px;background:transparent;color:var(--muted);font-size:11px}
.theme-mode-switch button.active{background:var(--theme-accent);color:var(--on-accent);box-shadow:0 3px 12px var(--theme-glow)}
body[data-theme] .welcome-mark{color:var(--theme-accent)!important;border-color:var(--line)!important;background:var(--surface-soft)!important}
body[data-theme] .stat .sub,body[data-theme] .task-meta,body[data-theme] .routine-mini small,body[data-theme] .brand small,body[data-theme] .profile small,body[data-theme] .welcome p,body[data-theme] .weekday,body[data-theme] .selected-day{color:var(--muted)!important}
body[data-theme] .empty b{color:var(--text)!important}
body[data-theme] footer span:first-child{color:var(--theme-accent)!important}
