:root {
  --background: #f4f6fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --primary: #172b4d;
  --accent: #7566ff;
  --line: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--background);
  color: var(--text);
}

a {
  color: inherit;
}

header {
  height: 68px;
  background: #101827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

header strong {
  font-size: 20px;
}

header small {
  display: block;
  color: #aeb8c8;
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 235px 1fr;
  min-height: calc(100vh - 68px);
}

nav {
  background: #182235;
  padding: 18px 12px;
}

nav a {
  display: block;
  color: #d8deea;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 9px;
  margin: 3px 0;
}

nav a:hover,
nav .ai {
  background: #293755;
  color: #ffffff;
}

main {
  padding: 28px;
  min-width: 0;
}

.public {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #111827, #302c65);
}

h1 {
  margin-top: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 15px;
}

.card,
section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.04);
}

.card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.card strong {
  display: block;
  font-size: 26px;
  margin-top: 9px;
}

section {
  margin-top: 20px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grid-form textarea {
  grid-column: 1 / -1;
}

input,
select,
textarea,
button {
  font: inherit;
  padding: 11px 12px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  width: 100%;
}

textarea {
  resize: vertical;
}

button {
  background: var(--primary);
  color: #ffffff;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.grid-form button {
  width: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  font-size: 14px;
}

th {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title a {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
}

.signed-contract-toggle {
  width: auto;
  padding: 10px 14px;
  background: linear-gradient(135deg, #5648db, #2577d9);
}

.signed-contract-panel {
  border-left: 5px solid #6557e8;
}

.signed-contract-panel h2 {
  margin-top: 0;
}

.signed-contract-panel label {
  color: var(--muted);
  font-size: 13px;
}

.signed-contract-panel label input {
  margin-top: 5px;
}

.document-link {
  color: #5045c7;
  font-weight: 700;
}

.login-card {
  background: #ffffff;
  width: min(420px, 92vw);
  padding: 34px;
  border-radius: 18px;
}

.login-card label {
  display: block;
  margin: 15px 0;
}

.login-card input {
  margin-top: 6px;
}

.alert {
  background: #fee2e2;
  padding: 10px;
  border-radius: 8px;
  color: #991b1b;
}

.success {
  background: #dcfce7;
  padding: 10px;
  border-radius: 8px;
  color: #166534;
}

.auth-link {
  margin: 20px 0 0;
  text-align: center;
}

.brand-logo {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: cover;
  object-position: 50% 28%;
  border-radius: 50%;
  margin: 0 auto 18px;
}

.brand-header {
  width: 38px;
  height: 38px;
  object-fit: cover;
  object-position: 50% 28%;
  vertical-align: middle;
  border-radius: 50%;
  margin-right: 8px;
}

.profile-form {
  max-width: 720px;
}

.ai-panel {
  border-left: 5px solid var(--accent);
}

.answer {
  margin-top: 18px;
  padding: 16px;
  background: #f0efff;
  border-radius: 10px;
}

.intelligence-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.intelligence-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.intelligence-heading h1 {
  margin: 5px 0 7px;
  font-size: 32px;
}

.intelligence-heading p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: #5b4ee8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
}

.core-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, .04);
}

.core-status span:last-child {
  display: flex;
  flex-direction: column;
}

.core-status small {
  color: var(--muted);
  margin-top: 2px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px #dcfce7;
}

.ai-workspace {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  min-height: 650px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(30, 41, 59, .08);
}

.ai-sidebar {
  padding: 28px 22px;
  color: #eef2ff;
  background: linear-gradient(165deg, #111936 0%, #19275d 60%, #342b78 100%);
}

.ai-sidebar img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 0 28px rgba(34, 211, 238, .28);
}

.ai-sidebar h2 {
  margin: 22px 0 8px;
  font-size: 19px;
}

.ai-sidebar > p {
  margin: 0 0 24px;
  color: #bfc9eb;
  font-size: 14px;
  line-height: 1.55;
}

.ai-capability {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.ai-capability > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: rgba(117, 102, 255, .3);
  color: #67e8f9;
}

.ai-capability div {
  display: flex;
  flex-direction: column;
}

.ai-capability small {
  margin-top: 3px;
  color: #aeb9dd;
  line-height: 1.3;
}

.ai-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-thread {
  flex: 1;
  padding: 30px;
  overflow: auto;
  background:
    radial-gradient(circle at 90% 10%, rgba(117, 102, 255, .08), transparent 28%),
    #fbfcff;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 82%;
  margin-bottom: 24px;
}

.message p {
  margin: 7px 0 0;
  padding: 14px 16px;
  border-radius: 4px 16px 16px 16px;
  background: #fff;
  border: 1px solid #e8ebf3;
  line-height: 1.6;
  white-space: pre-wrap;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .04);
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6557e8, #22b9de);
  color: #fff;
  font-weight: 800;
}

.intelligence-avatar {
  overflow: hidden;
  padding: 0;
  background: #080d25;
}

.intelligence-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-message {
  margin-left: auto;
  justify-content: flex-end;
  text-align: right;
}

.user-message p {
  text-align: left;
  color: #fff;
  border: 0;
  border-radius: 16px 4px 16px 16px;
  background: linear-gradient(135deg, #273b75, #6756db);
}

.message-meta {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.prompt-suggestions {
  display: flex;
  gap: 8px;
  padding: 14px 22px 8px;
  overflow-x: auto;
  border-top: 1px solid #edf0f6;
}

.prompt-suggestions button {
  width: auto;
  flex: 0 0 auto;
  padding: 8px 11px;
  color: #4a45a5;
  background: #f3f1ff;
  border: 1px solid #ded9ff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 8px 22px 5px;
  padding: 9px;
  border: 1px solid #cfd5e3;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .07);
}

.ai-composer textarea {
  min-height: 50px;
  max-height: 150px;
  border: 0;
  outline: none;
}

.ai-composer button {
  width: auto;
  padding: 12px 17px;
  border-radius: 11px;
  background: linear-gradient(135deg, #5648db, #2577d9);
}

.ai-disclaimer {
  margin: 5px 22px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  nav {
    display: flex;
    overflow: auto;
    gap: 5px;
  }

  nav a {
    white-space: nowrap;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  main {
    padding: 16px;
  }

  .intelligence-heading {
    flex-direction: column;
  }

  .ai-workspace {
    grid-template-columns: 1fr;
  }

  .ai-sidebar {
    display: none;
  }

  .message {
    max-width: 95%;
  }
}
