:root{
  --bg:#ffffff;
  --card:#ffffff;
  --text:#0b0b0f;
  --muted:#6b7280;
  --border:rgba(15,23,42,.08);
  --shadow:0 10px 30px rgba(0,0,0,.08);
  --shadow2:0 4px 14px rgba(0,0,0,.08);
  --radius:18px;
  --radius2:14px;
  --blur:14px;
  --accent:#0b0b0f;
  --accent2:#2563eb;
  --ease:cubic-bezier(.2,.9,.2,1);
}

html[data-theme="dark"]{
  --bg:#070b14;
  --card:rgba(255,255,255,.045);
  --text:#f2f5fb;
  --muted:rgba(255,255,255,.58);
  --border:rgba(255,255,255,.10);
  --shadow:0 16px 46px rgba(0,0,0,.55);
  --shadow2:0 10px 26px rgba(0,0,0,.55);
  --accent:#f2f5fb;
  --accent2:#7aa7ff;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "SF Pro Text", Segoe UI, Roboto, Arial;
  background: var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit}
::selection{background:rgba(59,130,246,.25)}

.wrap{max-width:1120px;margin:0 auto;padding:22px}
@media (max-width:860px){.wrap{padding:14px}}

.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  position:sticky;top:0;z-index:20;
  padding:12px 0;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(var(--blur));
}

html[data-theme="dark"] .topbar{
  background: rgba(5,6,8,.72);
}

.brand{
  display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.2px;
}
.logo{
  width:34px;height:34px;border-radius:12px;
  background:linear-gradient(135deg, rgba(59,130,246,.9), rgba(16,185,129,.85));
  box-shadow: var(--shadow2);
}
.pills{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 12px;border:1px solid var(--border);
  border-radius:999px;background:rgba(255,255,255,.75);
  backdrop-filter: blur(var(--blur));
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
html[data-theme="dark"] .pill{background:rgba(255,255,255,.06);box-shadow:none}
.pill:active{transform:translateY(1px)}
.pill svg{width:16px;height:16px;opacity:.9}

.h1{font-size:24px;font-weight:850;margin:0}
.sub{color:var(--muted);margin-top:6px;line-height:1.4}
.small{font-size:12px;color:var(--muted)}

.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:14px}
.grid > *{min-width:0}
.col-12{grid-column:span 12}
.col-8{grid-column:span 8}
.col-6{grid-column:span 6}
.col-4{grid-column:span 4}
.col-3{grid-column:span 3}
@media (max-width:860px){.col-8,.col-6,.col-4,.col-3{grid-column:span 12}}


.card{
  display:block;
  width:100%;
  background: linear-gradient(to bottom, rgba(255,255,255,.96), rgba(255,255,255,.90));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter: blur(var(--blur));
  padding:16px;
  position:relative;
  overflow:hidden;
}
html[data-theme="dark"] .card{
  background: linear-gradient(to bottom, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

.widget{
  display:block;
  cursor:pointer;
  min-height:110px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
  will-change: transform;
}
.widget:hover{transform: translateY(-2px)}
.widget:active{transform: translateY(0px)}
.kpiRow{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.kpiNum{font-size:30px;font-weight:900;letter-spacing:-.3px}
.kpiIcon{
  width:38px;height:38px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(to bottom, rgba(255,255,255,.90), rgba(255,255,255,.70));
  border:1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
html[data-theme="dark"] .kpiIcon{
  background: linear-gradient(to bottom, rgba(255,255,255,.08), rgba(255,255,255,.03));
  box-shadow:none;
}
.kpiIcon svg{width:18px;height:18px;opacity:.92}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 14px;border:0;border-radius:14px;
  background: linear-gradient(to bottom, rgba(255,255,255,.16), rgba(255,255,255,0)), var(--accent);
  color:#fff;
  font-weight:800;cursor:pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26), 0 4px 12px rgba(0,0,0,.12);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .18s var(--ease);
}
.btn.secondary{
  background: linear-gradient(to bottom, rgba(255,255,255,.95), rgba(255,255,255,.78));
  color:var(--text);
  border:1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.60), 0 4px 12px rgba(0,0,0,.06);
}
html[data-theme="dark"] .btn.secondary{
  background: linear-gradient(to bottom, rgba(255,255,255,.07), rgba(255,255,255,.03));
  box-shadow:none;
}
.btn:active{
  transform:translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 6px rgba(0,0,0,.12);
}
.btn svg{width:18px;height:18px}
.field{width:100%;padding:12px 12px;border:1px solid var(--border);border-radius:14px;background:rgba(255,255,255,.85);outline:none}
html[data-theme="dark"] .field{background:rgba(255,255,255,.06);color:var(--text)}

.divider{height:1px;background:var(--border);margin:12px 0}

.toast{
  position:fixed;left:50%;bottom:18px;transform:translateX(-50%);
  background:rgba(0,0,0,.80);color:#fff;
  padding:10px 12px;border-radius:999px;font-size:13px;
  opacity:0;pointer-events:none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
  z-index:60;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(-2px)}

.overlay{
  position:fixed;inset:0;display:none;z-index:50;
}
.overlay.show{display:block}
.overlay .backdrop{
  position:absolute;inset:0;
  background:rgba(10,10,12,.40);
  backdrop-filter: blur(var(--blur));
  opacity:0;
  transition: opacity .22s var(--ease);
}
.overlay.show .backdrop{opacity:1}
.sheet{
  position:absolute;left:50%;top:52%;
  transform: translate(-50%,-50%) scale(.98);
  width:min(980px, calc(100vw - 22px));
  max-height: calc(100vh - 22px);
  overflow:auto;
  border-radius: 22px;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  opacity:0;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
html[data-theme="dark"] .sheet{background:rgba(15,23,42,.68)}
.overlay.show .sheet{
  opacity:1;
  transform: translate(-50%,-50%) scale(1);
}
.sheetHeader{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 14px 10px;
  position:sticky;top:0;z-index:2;
  background: linear-gradient(to bottom, rgba(255,255,255,.92), rgba(255,255,255,.60), rgba(255,255,255,.10));
  backdrop-filter: blur(var(--blur));
  border-bottom:1px solid var(--border);
}
html[data-theme="dark"] .sheetHeader{
  background: linear-gradient(to bottom, rgba(15,23,42,.88), rgba(15,23,42,.55), rgba(15,23,42,.12));
}
.sheetBody{padding:14px}
.xbtn{
  width:40px;height:40px;border-radius:14px;
  display:grid;place-items:center;
  border:1px solid var(--border);
  background:rgba(255,255,255,.75);
  cursor:pointer;
  transition: transform .18s var(--ease);
}
html[data-theme="dark"] .xbtn{background:rgba(255,255,255,.06)}
.xbtn:active{transform:translateY(1px)}
.xbtn svg{width:18px;height:18px}

.skeleton{
  height:12px;border-radius:999px;
  background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.02), rgba(0,0,0,.06));
  background-size: 240px 100%;
  animation: sk 1.1s linear infinite;
}
html[data-theme="dark"] .skeleton{
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.03), rgba(255,255,255,.08));
}
@keyframes sk{0%{background-position:-240px 0}100%{background-position:240px 0}}

.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px 10px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}
.table th{color:var(--muted);font-weight:800;font-size:12px;text-transform:uppercase;letter-spacing:.08em}

.sheetFooter{
  display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;
  padding:12px 14px;
  border-top:1px solid var(--border);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(var(--blur));
  position:sticky;
  bottom:0;
}
html[data-theme="dark"] .sheetFooter{
  background: rgba(5,6,8,.55);
}
@media (max-width:860px){
  .sheet{top:auto;bottom:0;left:0;transform: translate(0,0) scale(.98);width:100vw;max-height:92vh;border-bottom-left-radius:0;border-bottom-right-radius:0}
  .overlay.show .sheet{transform: translate(0,0) scale(1)}
}

.tileGrid{display:grid;grid-template-columns:repeat(12,1fr);gap:10px}
.tile{grid-column:span 4;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 12px;border:1px solid var(--border);border-radius:16px;background:linear-gradient(to bottom, rgba(255,255,255,.96), rgba(255,255,255,.88));box-shadow:0 4px 14px rgba(0,0,0,.06)}
html[data-theme="dark"] .tile{background:linear-gradient(to bottom, rgba(255,255,255,.07), rgba(255,255,255,.03));box-shadow:none}
.tileTitle{font-weight:900}
.tileSub{font-size:12px;color:var(--muted);margin-top:2px}
.tileIcon{width:40px;height:40px;border-radius:14px;display:grid;place-items:center;border:1px solid var(--border);background:rgba(255,255,255,.80)}
html[data-theme="dark"] .tileIcon{background:rgba(255,255,255,.06)}
.tileIcon svg{width:18px;height:18px;opacity:.9}
@media (max-width:860px){.tile{grid-column:span 12}}

.ev{display:flex;flex-direction:column;gap:10px}
.evRow{display:flex;gap:12px;align-items:flex-start;padding:10px 10px;border:1px solid var(--border);border-radius:16px;background:rgba(255,255,255,.70)}
html[data-theme="dark"] .evRow{background:rgba(255,255,255,.04)}
.evTime{min-width:120px;font-weight:900}
@media (max-width:860px){.evTime{min-width:92px}}
.evTitle{font-weight:900}
.evMeta{font-size:12px;color:var(--muted);margin-top:2px;line-height:1.35}
.badge{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:999px;background:rgba(255,255,255,.80);font-size:12px}
html[data-theme="dark"] .badge{background:rgba(255,255,255,.06)}

.logoImg{width:34px;height:34px;border-radius:12px;object-fit:contain;background:transparent}
.shortcutsBar{display:flex;align-items:flex-start;justify-content:center;gap:14px;flex-wrap:wrap;margin-top:10px}
.scItem{display:flex;flex-direction:column;align-items:center;gap:6px}
.scBtn{width:84px;height:84px;border-radius:16px;border:1px solid var(--border);background:linear-gradient(to bottom, rgba(255,255,255,.96), rgba(255,255,255,.82));box-shadow:0 4px 14px rgba(0,0,0,.06);display:grid;place-items:center}
html[data-theme="dark"] .scBtn{background:linear-gradient(to bottom, rgba(255,255,255,.08), rgba(255,255,255,.03));box-shadow:none}
.scBtn img{width:20px;height:20px;border-radius:6px}
.scLbl{font-size:12px;color:var(--muted);line-height:1.1;text-align:center;max-width:72px}

.dot{position:absolute;top:10px;right:10px;min-width:10px;height:10px;border-radius:999px;background:#ef4444;box-shadow:0 6px 14px rgba(239,68,68,.35)}
.dot.num{height:18px;min-width:18px;padding:0 6px;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:900;color:#fff}

.noteArea{width:100%;min-height:160px;resize:vertical;padding:12px 12px;border:1px solid var(--border);border-radius:16px;background:linear-gradient(to bottom, rgba(255,255,255,.96), rgba(255,255,255,.86));outline:none}
html[data-theme="dark"] .noteArea{background:linear-gradient(to bottom, rgba(255,255,255,.07), rgba(255,255,255,.03));color:var(--text)}
.saveHint{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:8px}

.bottomAction{display:flex;justify-content:flex-end}
@media (max-width:860px){.bottomAction{justify-content:stretch}}

.heroLogoWrap{display:flex;justify-content:center;margin-top:2px}
.heroLogo{width:76px;height:76px;object-fit:contain;filter: drop-shadow(0 10px 20px rgba(0,0,0,.10))}
html[data-theme="dark"] .heroLogo{filter: drop-shadow(0 16px 26px rgba(0,0,0,.55))}
.cardGlow{position:relative}
.cardGlow::after{
  content:"";
  position:absolute;inset:-1px;
  border-radius: var(--radius);
  pointer-events:none;
  background: radial-gradient(600px 220px at 20% 0%, rgba(122,167,255,.10), transparent 55%),
              radial-gradient(600px 220px at 80% 0%, rgba(255,255,255,.14), transparent 55%);
  opacity:.35;
}
html[data-theme="dark"] .cardGlow::after{
  opacity:.28;
}
.shortcutsBar{justify-content:center}
.scBtn{position:relative}
.scBtn svg{width:18px;height:18px}
.scBtn img{display:block;width:34px;height:34px;border-radius:10px}
.scBtn .scSvg{width:18px;height:18px}
.scBtn:hover{transform:translateY(-1px)}
.scBtn:active{transform:translateY(0px)}
.scManage{align-self:flex-start}

.calMetaLine{display:flex;flex-direction:column;gap:4px}
.calCountdown{font-size:11px;color:var(--muted);margin-top:2px}
.evTime{min-width:140px}
.evRow{align-items:flex-start}
@media (max-width:860px){.evTime{min-width:110px}}

.noteTop{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.noteTabs{display:flex;gap:8px;flex-wrap:wrap}
.noteTab{padding:8px 10px;border-radius:999px;border:1px solid var(--border);background:rgba(255,255,255,.75);font-size:12px;font-weight:900;cursor:pointer}
html[data-theme="dark"] .noteTab{background:rgba(255,255,255,.06)}
.noteTab.active{background:rgba(11,11,15,.08)}
html[data-theme="dark"] .noteTab.active{background:rgba(255,255,255,.10)}
.noteActions{display:flex;gap:8px}

#overlay .sheetHeader .small{display:none}
#overlay .sheet .card{background:transparent;border:none;box-shadow:none;padding:0}
#overlay .sheet .card .divider{margin-top:12px}

/* Overlay v15: full white sheet, no inner header bar, floating close */
#overlay .sheet{
  position:relative;
  background:#fff !important;
  border-radius:22px !important;
  overflow:hidden !important;
  border:1px solid rgba(0,0,0,.06) !important;
  box-shadow:0 24px 60px rgba(0,0,0,.18) !important;
}
html[data-theme="dark"] #overlay .sheet{
  background:rgba(10,14,22,.94) !important;
  border:1px solid rgba(255,255,255,.08) !important;
  box-shadow:0 28px 70px rgba(0,0,0,.65) !important;
}
#overlay .sheetHeader{display:none !important;}
#overlay .sheetBody{
  padding:22px 22px 18px 22px !important;
}
#overlay .xbtn{
  position:absolute !important;
  top:14px !important;
  right:14px !important;
  width:44px !important;
  height:44px !important;
  border-radius:16px !important;
  border:1px solid var(--border) !important;
  background:rgba(255,255,255,.92) !important;
  box-shadow:0 10px 26px rgba(0,0,0,.12) !important;
  backdrop-filter: blur(10px);
  z-index:5;
}
html[data-theme="dark"] #overlay .xbtn{
  background:rgba(255,255,255,.10) !important;
  box-shadow:0 16px 40px rgba(0,0,0,.60) !important;
}
@media (max-width:860px){
  #overlay .sheetBody{padding:18px 14px 14px 14px !important;}
  #overlay .xbtn{top:10px !important; right:10px !important;}
}


/* Overlay v17: enable scrolling inside overlay */
#overlay .sheet{
  max-height: calc(100vh - 40px) !important;
  display:flex !important;
  flex-direction:column !important;
}
#overlay .sheetBody{
  overflow:auto !important;
  -webkit-overflow-scrolling: touch;
  flex:1 1 auto !important;
}

