:root {
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #1c2733;
  --line: #253340;
  --text: #e9f2fa;
  --muted: #7d97ab;
  --accent: #2ea6de;
  --accent-2: #1f8fc4;
  --user: #1f6f9c;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 12px 16px 10px;
  background: linear-gradient(180deg, #16222e, #131d27);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5a6b78;
  box-shadow: 0 0 0 3px rgba(46,166,222,.12);
  transition: background .2s;
}
.dot.online { background: #4cd07d; }
.dot.busy { background: #f0b429; }

.title { font-weight: 600; letter-spacing: .1px; }
.sub { color: var(--muted); font-size: 12px; }

.views {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view[hidden] { display: none; }

/* ---------------------------------------------------------------- chat */

.log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}

.row { display: flex; }
.row.user { justify-content: flex-end; }
.row.assistant { justify-content: flex-start; }

.bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 14.5px;
}
.row.user .bubble {
  background: var(--user);
  border-bottom-right-radius: 5px;
}
.row.assistant .bubble {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.6;
}
.empty b { color: var(--text); font-weight: 600; }

.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 18px 8px;
  color: var(--muted);
  font-size: 12px;
}
.typing em { font-style: normal; margin-left: 4px; }
.typing .bounce {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing .bounce:nth-child(2) { animation-delay: .15s; }
.typing .bounce:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

#input {
  flex: 1;
  resize: none;
  max-height: 132px;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  outline: none;
}
#input:focus { border-color: var(--accent-2); }

#send {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #06131d;
  display: grid;
  place-items: center;
  transition: opacity .15s, transform .1s;
}
#send:active { transform: scale(.94); }
#send:disabled { opacity: .45; }

.error { color: #ff9c9c; }

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.tab {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  padding: 11px 8px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06131d;
  font-weight: 600;
}

/* ---------------------------------------------------------------- tasks */

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
}
.pane-title { font-weight: 600; font-size: 16px; }

.ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 4px;
  cursor: pointer;
}
.ghost.round { font-size: 22px; line-height: 1; padding: 2px 10px; }
.ghost:active { color: var(--text); }

.task-form {
  display: flex;
  gap: 8px;
  padding: 0 14px 12px;
}
#task-input {
  flex: 1;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  outline: none;
}
#task-input:focus { border-color: var(--accent-2); }
.plus {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #06131d;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.task .check {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #06131d;
  font-size: 13px;
  padding: 0;
}
.task.done .check { background: #4cd07d; border-color: #4cd07d; }
.task .text {
  flex: 1;
  font-size: 14.5px;
  overflow-wrap: anywhere;
}
.task.done .text { color: var(--muted); text-decoration: line-through; }
.task .del {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.task .del:active { color: #ff9c9c; }

.pane-empty {
  margin: 20px 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

/* ---------------------------------------------------------------- calendar */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 6px;
}
.cal-title { font-weight: 600; font-size: 16px; text-transform: capitalize; }

.cal-weekdays, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 12px;
}
.cal-weekdays {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding-bottom: 6px;
}
.cal-grid { flex: 1; align-content: start; }

.day {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid transparent;
}
.day.blank { background: transparent; }
.day.weekend { color: #9fc4da; }
.day.today {
  background: var(--accent);
  color: #06131d;
  font-weight: 700;
}

.cal-today {
  padding: 10px 16px 16px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
