:root {
  --bg: #0f172a;
  --bg2: #111c33;
  --card: #16233f;
  --line: #24344f;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --ok: #34d399;
  --err: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1e293b 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--err); }

/* LOGIN */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.login-card h1 { margin: 0; font-size: 1.4rem; }

/* APP LAYOUT */
.app { max-width: 1100px; margin: 0 auto; padding: 0 1rem 2rem; }
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  background: linear-gradient(var(--bg), rgba(15,23,42,0.85));
  backdrop-filter: blur(6px);
  z-index: 5;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.05rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.tabs { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}
.tab.active { color: var(--text); background: var(--card); border-color: var(--line); }

button {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0b1220;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
button:hover { filter: brightness(1.05); }

.panel { display: none; }
.panel.active { display: block; }

/* CHAT */
.messages {
  min-height: 50vh;
  max-height: 65vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.msg { max-width: 80%; padding: 0.7rem 0.9rem; border-radius: 14px; white-space: pre-wrap; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--accent2); color: #0b1220; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.composer { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.composer-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.chat-mode { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.chat-mode label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }

/* CARDS / FORMS */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } .msg { max-width: 92%; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.6rem; }

input, textarea, select {
  width: 100%;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  margin-top: 0.25rem;
}
textarea { resize: vertical; }
.row { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.inline input { width: auto; flex: 1; min-width: 120px; }
.inline select { width: auto; }

/* LISTS */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.list li {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
}
.list li .meta { color: var(--muted); font-size: 0.8rem; }
.list li.done .title { text-decoration: line-through; color: var(--muted); }
.list .title { flex: 1; }
.del { background: transparent; color: var(--err); border: none; cursor: pointer; font-size: 1rem; padding: 0 0.3rem; }
.schedule .time { font-variant-numeric: tabular-nums; color: var(--accent); min-width: 48px; }
