/* Bravio Assist, frontend-stijl.
   Alle kleuren en fonts lopen via CSS custom properties die app.js runtime
   vult vanuit GET /api/config. De defaults hieronder zijn het Bravio-fallbackthema. */

:root {
  --accent: #018585;
  --accent-ink: #fcfcf6;
  --dark: #012935;
  --dark2: #02181f;
  --soft: #58c3ae;
  --bg: #fcfcf6;
  --card: #fffdf8;
  --ink: #0c1a20;
  --muted: #455157;
  --line: #dfe6e2;
  --font-body: -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(2, 24, 31, 0.05), 0 8px 24px rgba(2, 24, 31, 0.06);
  --shadow-lg: 0 12px 40px rgba(2, 24, 31, 0.14);
  --danger: #a33a2e;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button {
  font-family: inherit;
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Generiek ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
.spinner.sm {
  width: 12px;
  height: 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 18px;
  font-size: 13.5px;
  line-height: 1.6;
}
.empty-ico {
  font-size: 32px;
  margin-bottom: 10px;
}
.mut {
  color: var(--muted);
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  max-width: 88vw;
}
.toast.show {
  opacity: 1;
}
.toast.error {
  background: #7e2c22;
}
.badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  line-height: 1;
}
.field-label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin: 14px 2px 6px;
  font-weight: 600;
}
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
input:not([type='file']),
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  transition: 0.15s;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.btn-primary {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  transition: 0.15s;
}
.btn-primary:hover {
  filter: brightness(1.06);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn-ghost {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  transition: 0.13s;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  transition: 0.13s;
  line-height: 1;
}
.icon-btn:hover {
  background: color-mix(in srgb, var(--soft) 16%, transparent);
  color: var(--ink);
}
.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.chip-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  transition: 0.13s;
  white-space: nowrap;
}
.chip-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  z-index: 90;
}
.boot-text {
  font-size: 13px;
  color: var(--muted);
}
.boot .btn-primary {
  width: auto;
  padding: 10px 22px;
  margin-top: 6px;
}

/* ---------- Login ---------- */
.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      600px 300px at 85% -60px,
      color-mix(in srgb, var(--soft) 22%, transparent),
      transparent 70%
    ),
    var(--bg);
}
.login-card {
  width: min(430px, 94vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 30px;
}
.login-logo {
  min-height: 12px;
  margin-bottom: 14px;
}
.login-logo img {
  height: 46px;
  width: auto;
  max-width: 100%;
}
.login-card h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  margin: 4px 0 6px;
  letter-spacing: -0.4px;
  color: var(--dark);
}
.login-sub {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
}
.login-error {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--card));
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
  border-radius: 9px;
  padding: 9px 12px;
}
#loginForm .btn-primary {
  margin-top: 20px;
}

/* ---------- App-shell ---------- */
#app {
  display: flex;
  min-height: 100dvh;
  max-width: 100vw;
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: linear-gradient(185deg, var(--dark) 0%, var(--dark2) 100%);
  color: rgba(255, 255, 255, 0.78);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  z-index: 60;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 18px;
}
.logo-plate {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 10px;
  padding: 6px 9px;
  box-shadow: var(--shadow);
}
.logo-plate img {
  height: 30px;
  width: auto;
  max-width: 120px;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.2px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  font-size: 9.5px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin-top: 1px;
}
.new-chat {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 600;
  transition: 0.15s;
  text-align: center;
}
.new-chat:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.nav-sec {
  margin: 20px 8px 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: rgba(255, 255, 255, 0.42);
}
.conv-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}
.conv-empty {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding: 8px 10px;
}
.conv {
  display: flex;
  align-items: center;
  border-radius: 9px;
  transition: 0.13s;
}
.conv:hover {
  background: rgba(255, 255, 255, 0.06);
}
.conv.active {
  background: color-mix(in srgb, var(--soft) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--soft) 28%, transparent);
}
.conv-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.78);
  padding: 7px 4px 7px 10px;
  text-align: left;
  font: inherit;
}
.conv.active .conv-open {
  color: #fff;
}
.conv-title {
  font-size: 13px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.42);
}
.conv-actions {
  display: none;
  gap: 0;
  padding-right: 4px;
  flex: 0 0 auto;
}
.conv:hover .conv-actions,
.conv:focus-within .conv-actions,
.conv.active .conv-actions {
  display: flex;
}
.conv-act {
  background: none;
  border: none;
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 6px;
  opacity: 0.66;
  transition: 0.13s;
  color: inherit;
}
.conv-act:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
.side-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: 12px 6px 2px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.member-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--soft) 30%, transparent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.member-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logout-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.68);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 8px;
  transition: 0.13s;
  white-space: nowrap;
}
.logout-btn:hover {
  border-color: var(--soft);
  color: #fff;
}

/* ---------- Main + topbar ---------- */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 24px;
  flex: 0 0 auto;
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--dark);
  padding: 2px 6px;
}
.topbar-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.topbar-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  white-space: nowrap;
}
.tasks-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: 0.13s;
  white-space: nowrap;
}
.tasks-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* ---------- Chat ---------- */
#chatScroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.messages {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 22px 8px;
}
.welcome {
  text-align: center;
  padding: 9vh 18px 20px;
  color: var(--muted);
}
.welcome-mark {
  width: 58px;
  height: 58px;
  object-fit: contain;
  margin-bottom: 14px;
}
.welcome h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--dark);
  margin: 0 0 8px;
}
.welcome p {
  margin: 0 auto;
  font-size: 14px;
  max-width: 46ch;
  line-height: 1.6;
}

.msg {
  display: flex;
  margin: 14px 0;
  gap: 10px;
  align-items: flex-start;
}
.msg.user {
  justify-content: flex-end;
}
.bubble {
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  min-width: 0;
}
.msg.user .bubble {
  background: color-mix(in srgb, var(--accent) 11%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 15px 15px 4px 15px;
  max-width: min(78%, 640px);
}
.msg.assistant .bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px 15px 15px 4px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 46px);
}
.avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 3px;
  margin-top: 2px;
}
.user-text {
  white-space: pre-wrap;
}
.msg-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.msg-error {
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger);
}
.msg-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* markdown-inhoud (gesanitiseerd) */
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md p {
  margin: 0 0 10px;
}
.md ul,
.md ol {
  margin: 6px 0 10px;
  padding-left: 22px;
}
.md li {
  margin: 3px 0;
}
.md h1,
.md h2,
.md h3,
.md h4 {
  font-family: var(--font-display);
  color: var(--dark);
  letter-spacing: -0.2px;
  margin: 16px 0 8px;
  line-height: 1.25;
}
.md h1 {
  font-size: 19px;
}
.md h2 {
  font-size: 17px;
}
.md h3 {
  font-size: 15.5px;
}
.md h4 {
  font-size: 14.5px;
}
.md a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--soft);
  background: color-mix(in srgb, var(--soft) 8%, transparent);
  border-radius: 0 9px 9px 0;
  color: var(--muted);
}
.md code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: color-mix(in srgb, var(--soft) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--soft) 24%, transparent);
  border-radius: 5px;
  padding: 1px 5px;
}
.md pre {
  background: var(--dark);
  color: #e7f2f1;
  border-radius: 10px;
  padding: 13px 15px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.md pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.md table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}
.md th,
.md td {
  border: 1px solid var(--line);
  padding: 6px 11px;
  text-align: left;
}
.md th {
  background: color-mix(in srgb, var(--soft) 12%, var(--card));
  font-weight: 600;
}
.md hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.md img {
  max-width: 100%;
  border-radius: 9px;
}

/* tool-chips tijdens het streamen */
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--soft) 15%, var(--card));
  border: 1px solid color-mix(in srgb, var(--soft) 36%, transparent);
  color: var(--ink);
}
.tool-chip.busy .tc-ico {
  display: inline-block;
  animation: spin 1.6s linear infinite;
}
.tool-chip.done {
  background: color-mix(in srgb, var(--soft) 26%, var(--card));
}
.tool-chip.done .tc-ico {
  animation: none;
}

/* typindicator */
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 5px 2px 2px;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--soft);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) {
  animation-delay: 0.18s;
}
.typing span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---------- Composer ---------- */
#composerWrap {
  flex: 0 0 auto;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 6px 22px 16px;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px 10px;
}
.qa-chip {
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: 0.13s;
}
.qa-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 2px 9px;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 6px 5px 11px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--soft) 15%, var(--card));
  border: 1px solid color-mix(in srgb, var(--soft) 34%, transparent);
  color: var(--ink);
  max-width: 280px;
}
.file-chip .fc-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.file-chip.busy {
  color: var(--muted);
  padding-right: 12px;
}
.msg-attach .file-chip {
  padding-right: 11px;
  background: color-mix(in srgb, var(--accent) 9%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}
.chip-x {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--muted);
  padding: 0 5px;
  border-radius: 50%;
  line-height: 1;
  transition: 0.13s;
}
.chip-x:hover {
  color: var(--danger);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 8px 9px;
  box-shadow: var(--shadow);
  transition: 0.15s;
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
}
#composerInput {
  flex: 1;
  min-width: 0;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  max-height: 180px;
  padding: 7px 4px;
  box-shadow: none;
}
#composerInput:disabled {
  opacity: 0.55;
}
.send-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: 0.15s;
  padding: 0;
}
.send-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.send-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.stop-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, var(--card));
  display: grid;
  place-items: center;
  padding: 0;
}
.stop-btn:hover {
  background: color-mix(in srgb, var(--danger) 16%, var(--card));
  color: var(--danger);
}

/* ---------- Takenpaneel ---------- */
#tasksPanel {
  flex: 0 0 auto;
  width: 0;
  overflow: hidden;
  transition: width 0.22s;
  background: var(--card);
  border-left: 1px solid transparent;
  position: sticky;
  top: 0;
  height: 100dvh;
}
body.tasks-open #tasksPanel {
  width: 340px;
  border-left-color: var(--line);
}
.tasks-inner {
  width: 340px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 12px;
}
.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.tasks-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--dark);
  margin: 0;
}
.tasks-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-form {
  background: color-mix(in srgb, var(--soft) 8%, var(--card));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 14px 14px;
  margin-top: 12px;
}
.task-form .field-label {
  margin-top: 12px;
}
.task-form-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.task-form-btns .btn-ghost {
  flex: 1;
}
.task-form-btns .btn-primary {
  flex: 1;
  width: auto;
}
.task-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 12px;
}
.task {
  display: flex;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  transition: 0.15s;
  align-items: flex-start;
}
.task:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.task.done {
  opacity: 0.55;
}
.task.done:hover {
  transform: none;
  box-shadow: var(--shadow);
}
.task.done .task-title {
  text-decoration: line-through;
}
.task-check {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--soft) 65%, var(--line));
  background: transparent;
  color: transparent;
  font-size: 13px;
  display: grid;
  place-items: center;
  transition: 0.13s;
  padding: 0;
  margin-top: 1px;
}
.task-check:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.task.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.task-check:disabled {
  cursor: default;
}
.task-body {
  flex: 1;
  min-width: 0;
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
}
.owner-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--soft) 22%, var(--card));
  color: var(--ink);
}
.due-chip {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--line) 55%, var(--card));
  color: var(--muted);
}
.due-chip.today {
  background: #fdf1dc;
  color: #8a5a0a;
  font-weight: 600;
}
.due-chip.overdue {
  background: #fbe3df;
  color: var(--danger);
  font-weight: 600;
}
.task-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.task-notes {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------- Scrim ---------- */
#scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--dark) 45%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 55;
}

/* ---------- Responsief ---------- */
@media (max-width: 1000px) {
  #tasksPanel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(380px, 94vw);
    transform: translateX(105%);
    transition: transform 0.22s;
    z-index: 70;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }
  body.tasks-open #tasksPanel {
    transform: none;
    width: min(380px, 94vw);
  }
  .tasks-inner {
    width: 100%;
  }
  body.tasks-open #scrim {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 760px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.22s;
  }
  body.nav-open #sidebar {
    transform: none;
  }
  body.nav-open #scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .menu-btn {
    display: block;
  }
  .topbar-sub {
    display: none;
  }
  #topbar {
    padding: 10px 14px;
  }
  .messages {
    padding: 16px 14px 6px;
  }
  #composerWrap {
    padding: 4px 12px 12px;
  }
  .msg.user .bubble {
    max-width: 88%;
  }
  .msg.assistant .bubble {
    max-width: calc(100% - 42px);
  }
  .welcome {
    padding-top: 6vh;
  }
  .login-card {
    padding: 26px 22px 24px;
  }
}
