:root{
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #5b6475;

  --blue: #2563eb;
  --blue2: #1d4ed8;
  --red: #ef4444;

  --card: rgba(255,255,255,0.86);
  --border: rgba(15, 23, 42, 0.10);

  --shadow: 0 12px 30px rgba(2, 6, 23, 0.10);
  --shadow2: 0 8px 20px rgba(2, 6, 23, 0.08);

  --radius: 18px;
  --radius2: 26px;
  --focus: rgba(37, 99, 235, 0.25);
}

[data-theme="dark"]{
  --bg: #0b1220;
  --text: #e6e8ee;
  --muted: #a9b0c0;

  --card: rgba(17, 24, 39, 0.74);
  --border: rgba(226, 232, 240, 0.12);

  --shadow: 0 12px 30px rgba(0,0,0,0.45);
  --shadow2: 0 8px 20px rgba(0,0,0,0.30);

  --focus: rgba(37, 99, 235, 0.22);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.container{
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

/* Background blobs */
.bg-blobs{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.blob{
  position: absolute;
  filter: blur(44px);
  opacity: 0.33;
  border-radius: 999px;
}
.b1{ width: 340px; height: 340px; left: -90px; top: 90px; background: var(--blue); }
.b2{ width: 420px; height: 420px; right: -160px; top: 110px; background: var(--red); opacity: 0.20; }
.b3{ width: 360px; height: 360px; left: 32%; bottom: -170px; background: #60a5fa; opacity: 0.18; }

/* Header */
.header{
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.70);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .header{
  background: rgba(11,18,32,0.70);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--red));
  box-shadow: var(--shadow2);
}
.brand-title{ font-weight: 900; letter-spacing: -0.2px; }
.brand-subtitle{ color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Nav */
.nav{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-link{
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
  font-weight: 700;
}
.nav-link:hover{
  border-color: var(--border);
  background: rgba(37, 99, 235, 0.06);
  color: var(--text);
}
.nav-link.active{
  border-color: rgba(37, 99, 235, 0.30);
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
}

.header-actions{ display: flex; gap: 10px; }

/* Main */
.main{ padding: 26px 0 40px; }

/* Pages */
.page{ display: none; animation: fade 0.18s ease; }
.page.active{ display: block; }

@keyframes fade{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* Typography */
.h1{
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: -0.6px;
}
.h2{
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}
.lead{
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 16px;
}
.muted{ color: var(--muted); }

/* Hero */
.hero{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 940px){
  .hero{ grid-template-columns: 1fr; }
}

.hero-actions{ display: flex; gap: 10px; flex-wrap: wrap; }

/* KPI */
.kpis{
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.kpi{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow2);
  min-width: 110px;
}
.kpi-num{ font-size: 18px; font-weight: 900; }
.kpi-label{ color: var(--muted); font-size: 12px; }

/* Cards */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 16px;
}
.big-card{ height: 100%; }

.card-header{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title{ font-weight: 900; letter-spacing: -0.2px; }
.card-subtitle{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.divider{
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* Pills */
.pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.45);
}
[data-theme="dark"] .pill{ background: rgba(17,24,39,0.40); }

.pill-blue{
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--blue);
  background: rgba(37, 99, 235, 0.10);
}
.pill-red{
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
  background: rgba(239, 68, 68, 0.10);
}

/* Buttons */
.btn{
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: white;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: var(--shadow2);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover{ filter: brightness(1.04); }
.btn:active{ transform: translateY(1px); }

.btn-outline{
  background: transparent;
  color: var(--blue);
  box-shadow: none;
}
.btn-ghost{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: none;
}
.btn-ghost:hover{
  background: rgba(37, 99, 235, 0.06);
  color: var(--text);
}

/* Layout grids */
.grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.grid-2{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 940px){
  .grid-3{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
}
.full{ grid-column: 1 / -1; }

/* Checklist */
.checklist{
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 10px;
}
.check{
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
  font-weight: 900;
  margin-right: 8px;
}

.tip{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  color: var(--muted);
  line-height: 1.5;
}

/* Page head */
.page-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.page-head-actions{ display: flex; gap: 8px; flex-wrap: wrap; }

/* Chat */
.chat-wrap{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}
@media (max-width: 940px){
  .chat-wrap{ grid-template-columns: 1fr; }
}

.chat-card{ padding: 0; overflow: hidden; }

.chat-top{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.chat-title{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}
.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.chat-log{
  height: 360px;
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.msg{
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  line-height: 1.45;
  white-space: pre-wrap;
}
.msg.user{
  margin-left: auto;
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.22);
}
.msg.bot{
  background: rgba(15, 23, 42, 0.03);
}

.chat-input{
  display: flex;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}

.chat-input input{
  flex: 1;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .chat-input input{
  background: rgba(17,24,39,0.55);
}
.chat-input input:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

/* Suggestions chips */
.chat-suggestions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 14px;
}
.chip{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}
[data-theme="dark"] .chip{
  background: rgba(17,24,39,0.35);
}
.chip:hover{
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

/* Mini list */
.mini-list{ display: grid; gap: 10px; }
.mini-item{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.25);
}
[data-theme="dark"] .mini-item{
  background: rgba(17,24,39,0.30);
}
.mini-badge{
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--red));
  border-radius: 12px;
  padding: 6px 8px;
  font-size: 12px;
}
.mini-title{ font-weight: 900; }

/* Calculator */
.calc{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 80px 1fr auto;
  gap: 10px;
  align-items: center;
}
@media (max-width: 640px){
  .calc{ grid-template-columns: 1fr; }
}
.calc input, .calc select{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .calc input,
[data-theme="dark"] .calc select{
  background: rgba(17,24,39,0.55);
}
.calc input:focus, .calc select:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

.result{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Timer */
.timer{ margin-top: 10px; }
.timer-big{
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 10px;
}
.timer-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.field{ display: grid; gap: 6px; }
.field input{
  width: 150px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .field input{
  background: rgba(17,24,39,0.55);
}
.field input:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

.timer-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Notes */
.notes{
  width: 100%;
  min-height: 220px;
  resize: vertical;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
  line-height: 1.5;
}
[data-theme="dark"] .notes{
  background: rgba(17,24,39,0.55);
}
.notes:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

.notes-footer{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Footer */
.footer{
  border-top: 1px solid var(--border);
  padding: 16px 0;
  background: rgba(255,255,255,0.55);
}
[data-theme="dark"] .footer{
  background: rgba(11,18,32,0.55);
}
.footer-inner{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Notes Hub */
.notes-grid{
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}
@media (max-width: 940px){
  .notes-grid{ grid-template-columns: 1fr; }
}

.notes-toolbar{
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
@media (max-width: 640px){
  .notes-toolbar{ grid-template-columns: 1fr; }
}

.notes-search{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .notes-search{
  background: rgba(17,24,39,0.55);
}
.notes-search:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

.notes-select{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .notes-select{
  background: rgba(17,24,39,0.55);
}
.notes-select:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

.notes-list{
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.notes-empty{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: rgba(15, 23, 42, 0.03);
}

.note-item{
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.15s ease;
}
[data-theme="dark"] .note-item{
  background: rgba(17,24,39,0.35);
}
.note-item:hover{
  background: rgba(37, 99, 235, 0.07);
}
.note-item.active{
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.10);
}

.note-item-top{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.note-item-title{
  font-weight: 900;
  letter-spacing: -0.2px;
}
.note-tag{
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255,255,255,0.35);
}
[data-theme="dark"] .note-tag{
  background: rgba(17,24,39,0.35);
}

.note-item-preview{
  font-size: 13px;
  line-height: 1.35;
}
.note-item-time{
  font-size: 12px;
  margin-top: 8px;
}

.notes-actions-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.file-btn{
  position: relative;
  overflow: hidden;
}
.file-btn input{
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.editor-top{
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;  
}
@media (max-width: 640px){
  .editor-top{ grid-template-columns: 1fr; }
}

.editor-title{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
  font-weight: 900;
}
[data-theme="dark"] .editor-title{
  background: rgba(17,24,39,0.55);
}
.editor-title:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}
#page-tasks .tasks-grid{
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 940px){
  #page-tasks .tasks-grid{ grid-template-columns: 1fr; }
}

#page-tasks .tasks-form{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 10px;
  align-items: center;
}
@media (max-width: 720px){
  #page-tasks .tasks-form{ grid-template-columns: 1fr; }
}

#page-tasks .tasks-input{
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
  font-size: 14px;
  line-height: 1.2;
}
[data-theme="dark"] #page-tasks .tasks-input{
  background: rgba(17,24,39,0.55);
}

#page-tasks .tasks-input:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

#page-tasks .tasks-controls{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}
@media (max-width: 720px){
  #page-tasks .tasks-controls{ grid-template-columns: 1fr; }
}

/* Task list wrapper */
#page-tasks .task-list{
  margin-top: 12px;
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

/* Empty state */
#page-tasks .tasks-empty{
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: rgba(15, 23, 42, 0.03);
}

/* Task row */
#page-tasks .task-row{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.35);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow2);
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
[data-theme="dark"] #page-tasks .task-row{
  background: rgba(17,24,39,0.35);
}

#page-tasks .task-row:hover{
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.22);
}

#page-tasks .task-row:active{
  transform: translateY(1px);
}

/* Left side */
#page-tasks .task-left{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

#page-tasks .task-check{
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

/* Editable title (input) */
#page-tasks .task-title{
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
  font-weight: 900;
  letter-spacing: -0.2px;
}
[data-theme="dark"] #page-tasks .task-title{
  background: rgba(17,24,39,0.55);
}

#page-tasks .task-title:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

/* Right side */
#page-tasks .task-right{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

#page-tasks .task-due{
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] #page-tasks .task-due{
  background: rgba(17,24,39,0.55);
}

#page-tasks .task-due:focus{
  box-shadow: 0 0 0 4px var(--focus);
  border-color: rgba(37,99,235,0.30);
}

/* Delete button spacing */
#page-tasks .task-del{
  padding: 10px 12px;
  border-radius: 14px;
}

/* Done state */
#page-tasks .task-row.done{
  opacity: 0.78;
}
#page-tasks .task-row.done .task-title{
  text-decoration: line-through;
  color: var(--muted);
}

/* Overdue state */
#page-tasks .task-row.overdue{
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.07);
}
#page-tasks .task-row.overdue:hover{
  border-color: rgba(239, 68, 68, 0.40);
  background: rgba(239, 68, 68, 0.10);
}

/* Mobile polish */
@media (max-width: 520px){
  #page-tasks .task-row{
    flex-direction: column;
    align-items: stretch;
  }
  #page-tasks .task-right{
    width: 100%;
    justify-content: space-between;
  }
  #page-tasks .task-due{
    width: 100%;
  }
}