
:root {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  color: #202238;
  background: #f7f8fc;

  --purple: #6856d9;
  --purple-dark: #5140bd;
  --purple-light: #f0edff;
  --muted: #85899e;
  --border: #e9eaf2;
  --surface: #ffffff;
  --surface-soft: #fafaff;
  --success: #249b72;
  --warning: #c67b24;
  --danger: #d64e62;
  --shadow: 0 8px 28px rgba(42, 38, 91, 0.045);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(104, 86, 217, 0.25);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

/* BRAND */

.logo,
.ai-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  color: white;
  background: linear-gradient(145deg, #7967ee, #5542c5);
  border-radius: 13px;
  box-shadow: 0 5px 13px rgba(104, 86, 217, 0.19);
  font-weight: 800;
}

.ai {
  color: var(--purple);
}

/* AUTHENTICATION */

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 10%, #e9e5ff 0, transparent 35%),
    radial-gradient(circle at 90% 85%, #fff0eb 0, transparent 32%),
    #f7f8fc;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 36px;
  border: 1px solid #e8e6f3;
  border-radius: 24px;
  background: white;
  box-shadow: 0 18px 60px rgba(42, 38, 91, 0.09);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 35px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.auth-card > .eyebrow {
  margin-bottom: 10px;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: 29px;
  letter-spacing: -1px;
}

.auth-card > p:not(.eyebrow, .auth-error, .auth-switch) {
  margin: 0 0 27px;
  color: #777b8e;
  font-size: 13px;
  line-height: 1.7;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

#auth-form label {
  margin-top: 5px;
  color: #44465e;
  font-size: 12px;
  font-weight: 700;
}

#auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid #e2e2ed;
  border-radius: 10px;
  background: #fdfdff;
  color: #292a40;
  font-size: 13px;
}

#auth-form input:focus {
  border-color: #a89bf2;
  outline: 3px solid rgba(104, 86, 217, 0.1);
}

#auth-form input::placeholder {
  color: #a0a2b3;
}

.auth-submit {
  width: 100%;
  min-height: 47px;
  margin-top: 9px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #7563e7, #5946c8);
  color: white;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(104, 86, 217, 0.18);
}

.auth-submit:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.auth-error {
  margin: 4px 0;
  padding: 10px 12px;
  border: 1px solid #f3cbd1;
  border-radius: 9px;
  background: #fff4f5;
  color: #b62f46;
  font-size: 12px;
  line-height: 1.6;
}

.auth-switch {
  margin: 23px 0 0;
  color: #777b8e;
  font-size: 12px;
  text-align: center;
}

.auth-switch button {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 12px;
  font-weight: 750;
}

.auth-switch button:hover {
  color: var(--purple-dark);
  text-decoration: underline;
}

/* SIDEBAR */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 232px;
  padding: 27px 17px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.sidebar h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 31px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.side-label,
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.side-label {
  margin: 0 0 4px 11px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #777b8e;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
}

.nav:hover {
  background: #f8f7ff;
  color: var(--purple);
}

.nav.active {
  border-color: #e8e2ff;
  background: var(--purple-light);
  color: var(--purple);
}

/* PROFILE */

.profile {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 19px;
  border-top: 1px solid var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #eae6ff;
  color: var(--purple);
  font-weight: 800;
}

.profile-details {
  flex: 1;
  min-width: 0;
}

.profile strong,
.profile small {
  display: block;
  overflow-wrap: anywhere;
}

.profile strong {
  font-size: 12px;
}

.profile small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.logout-button {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e7e4f2;
  border-radius: 8px;
  background: white;
  color: #6856d9;
  font-size: 11px;
  font-weight: 700;
}

.logout-button:hover {
  border-color: #d8d0ff;
  background: var(--purple-light);
}

/* MAIN LAYOUT */

.main {
  max-width: 1700px;
  margin-left: 232px;
  padding: 31px clamp(20px, 3.5vw, 52px);
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar h1 {
  margin: 7px 0 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 800;
  letter-spacing: -1.1px;
}

.page-subtitle {
  color: #777b8e;
  font-size: 13px;
  line-height: 1.7;
}

.pill,
.count {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: white;
  font-size: 11px;
  white-space: nowrap;
}

.pill {
  color: var(--success);
  font-weight: 700;
}

/* WELCOME BANNER */

.welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  margin: 28px 0;
  padding: 28px 30px;
  border: 1px solid #e8e2ff;
  border-radius: 21px;
  background:
    radial-gradient(circle at 90% 10%, #fff1f0 0, transparent 36%),
    linear-gradient(115deg, #ece9ff, #f8f5ff 68%, #fff7f4);
}

.welcome h2 {
  margin: 9px 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -1.3px;
}

.welcome p:not(.eyebrow) {
  max-width: 540px;
  margin-bottom: 0;
  color: #686b80;
  font-size: 13px;
  line-height: 1.75;
}

.sparkle {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border: 1px solid #ffffffb8;
  border-radius: 23px;
  background: #ffffffa6;
  color: var(--purple);
  font-size: 38px;
}

/* WORKSPACE */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: 22px;
}

.panel {
  min-width: 0;
  padding: 23px 21px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 7px 0 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.count {
  border: 0;
  background: #f3f0ff;
  color: var(--purple);
  font-weight: 750;
}

/* DATE FILTER */

.date-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}

.date-filter label {
  color: #777b8e;
  font-size: 11px;
  font-weight: 700;
}

.date-filter input {
  max-width: 170px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: #44465e;
  font-size: 11px;
}

/* TASK TIMELINE */

#schedule {
  min-width: 0;
}

.task-row {
  display: grid;
  grid-template-columns: 58px 14px minmax(0, 1fr);
  gap: 9px;
  min-height: 88px;
}

.task-time {
  padding-top: 4px;
  color: #73778c;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.timeline-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-marker::before {
  position: absolute;
  top: 4px;
  bottom: -4px;
  width: 1px;
  background: #e9e7f7;
  content: "";
}

.timeline-dot {
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9988f3;
  box-shadow: 0 0 0 2px #eae6ff;
}

.task-card {
  min-width: 0;
  align-self: start;
  margin-bottom: 13px;
  padding: 13px;
  border: 1px solid #eeedf7;
  border-left: 3px solid #9585ec;
  border-radius: 12px;
  background: var(--surface-soft);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.task-card:hover {
  border-color: #ded8fb;
  box-shadow: 0 4px 13px rgba(67, 54, 141, 0.055);
  transform: translateY(-1px);
}

.task-card.completed {
  opacity: 0.65;
  border-left-color: var(--success);
}

.task-card.completed .task-title {
  text-decoration: line-through;
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.task-duration {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.task-actions button {
  padding: 6px 9px;
  border: 1px solid #e4e1f4;
  border-radius: 7px;
  background: white;
  color: #6153b9;
  font-size: 10px;
  font-weight: 650;
}

.task-actions button:hover {
  border-color: #cfc5ff;
  background: #f0edff;
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

/* CHAT PANEL */

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 570px;
  overflow: hidden;
  padding: 0 0 15px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 19px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(110deg, #fff, #fcfbff);
}

.ai-avatar {
  width: 41px;
  height: 41px;
  font-size: 21px;
}

.chat-header strong {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.chat-header small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-height: 250px;
  max-height: 460px;
  overflow-y: auto;
  padding: 21px 17px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 5px;
}

.messages::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #e5e2f3;
}

.message {
  max-width: 96%;
  padding: 13px 15px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-message {
  align-self: flex-start;
  border-color: #eeecf8;
  border-top-left-radius: 5px;
  background: #f6f5fc;
  color: #33344c;
}

.user-message {
  align-self: flex-end;
  border-top-right-radius: 5px;
  background: linear-gradient(135deg, #7563e7, #5d4bc9);
  color: #fff;
  box-shadow: 0 4px 10px rgba(104, 86, 217, 0.13);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 13px;
}

.suggestion {
  padding: 8px 11px;
  border: 1px solid #e3defd;
  border-radius: 20px;
  background: white;
  color: #6554c7;
  font-size: 10px;
  font-weight: 650;
}

.suggestion:hover {
  border-color: #cfc5ff;
  background: #f4f1ff;
  transform: translateY(-1px);
}

/* CHAT COMPOSER */

.chat-form {
  margin: 0 13px;
  padding: 11px 12px 9px;
  border: 1px solid #e1deef;
  border-radius: 14px;
  background: white;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.chat-form:focus-within {
  border-color: #b8acf7;
  box-shadow: 0 0 0 3px rgba(104, 86, 217, 0.08);
}

.chat-form textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 130px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: #292a40;
  font-size: 12px;
  line-height: 1.65;
}

.chat-form textarea::placeholder {
  color: #a0a2b3;
}

.send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 5px;
}

.send-row small {
  color: var(--muted);
  font-size: 9px;
}

.send-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #7563e7, #5946c8);
  color: white;
  font-size: 21px;
  box-shadow: 0 4px 10px rgba(104, 86, 217, 0.17);
}

.send-button:hover {
  background: var(--purple-dark);
  box-shadow: 0 5px 14px rgba(104, 86, 217, 0.25);
  transform: translateY(-1px);
}

.send-button:active {
  transform: scale(0.96);
}

.chat-note {
  margin: 12px 8px 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

/* ACCESSIBILITY AND EMPTY STATES */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#empty-state {
  padding: 35px 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

#empty-state h3 {
  color: #44465e;
}

/* FOOTER */

.app-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding: 18px 0;
  color: var(--muted);
  font-size: 10px;
}

/* RESPONSIVE LAYOUT */

@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 25px;
  }

  .panel {
    padding-right: 24px;
    padding-left: 24px;
  }

  .chat-panel {
    padding-right: 0;
    padding-left: 0;
  }
}

@media (max-width: 1100px) {
  .main {
    padding-right: 23px;
    padding-left: 23px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-panel {
    min-height: 500px;
  }
}

@media (max-width: 700px) {
  .auth-card {
    padding: 27px 22px;
    border-radius: 19px;
  }

  .auth-card h1 {
    font-size: 26px;
  }

  .sidebar {
    position: static;
    display: flex;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 13px 15px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar h2 {
    width: 100%;
    margin: 0 0 5px;
  }

  .side-label {
    display: none;
  }

  .profile {
    width: 100%;
    margin-top: 5px;
    padding-top: 12px;
  }

  .profile-details {
    flex: 1;
  }

  .logout-button {
    width: auto;
  }

  .nav {
    width: auto;
    flex: 1;
    justify-content: center;
    padding: 10px;
    font-size: 11px;
  }

  .main {
    margin-left: 0;
    padding: 22px 13px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .welcome {
    margin: 22px 0;
    padding: 22px 18px;
    border-radius: 17px;
  }

  .welcome h2 {
    font-size: 25px;
  }

  .welcome p:not(.eyebrow) {
    font-size: 12px;
  }

  .sparkle {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 27px;
  }

  .panel {
    padding: 18px 12px;
    border-radius: 15px;
  }

  .chat-panel {
    padding: 0 0 13px;
  }

  .task-row {
    grid-template-columns: 49px 11px minmax(0, 1fr);
    gap: 6px;
  }

  .task-time {
    font-size: 10px;
  }

  .task-card {
    padding: 11px;
  }

  .messages {
    max-height: 420px;
    padding: 17px 12px;
  }

  .message {
    max-width: 98%;
    padding: 11px 12px;
    font-size: 12px;
  }

  .chat-form {
    margin-right: 10px;
    margin-left: 10px;
  }

  .app-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
