:root {
  color-scheme: light;
  --ink: #12223a;
  --muted: #6d7890;
  --soft: #edf6ff;
  --line: #d7e5f3;
  --bg: #f4f8fc;
  --panel: #ffffff;
  --blue: #187fd3;
  --blue-dark: #115994;
  --blue-deep: #0a3354;
  --blue-soft: #e6f3ff;
  --green: #158158;
  --green-soft: #e8f8f2;
  --yellow: #d69422;
  --yellow-soft: #fff3d8;
  --red: #d14343;
  --red-soft: #ffe8e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--ink);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(135deg, #0a3354, #115994 52%, #187fd3);
}

.login-screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.login-shell {
  width: min(980px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  overflow: hidden;
  border-radius: 10px;
  background: white;
  box-shadow: 0 28px 80px rgba(10, 51, 84, 0.34);
}

.login-panel {
  padding: 36px;
}

.login-brand {
  color: var(--ink);
  margin-bottom: 42px;
}

.login-brand span {
  color: var(--muted);
}

.login-panel h1 {
  font-size: 30px;
  margin: 0 0 14px;
  line-height: 1.12;
}

.login-copy {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-form input,
.top-search input,
.ask input,
.user-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: #fbfdff;
  font: inherit;
}

.login-form input:focus,
.top-search input:focus,
.ask input:focus,
.user-form input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(47, 142, 229, 0.14);
}

.login-form button,
.ask button,
.hero-action,
.user-form button {
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  background: var(--blue);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.login-context {
  display: grid;
  align-content: end;
  gap: 12px;
  padding: 38px;
  color: white;
  background:
    linear-gradient(135deg, rgba(10, 51, 84, 0.92), rgba(17, 89, 148, 0.84)),
    url("assets/brand/kezi-distribution-top.svg") center 18% / 220px auto no-repeat;
}

.login-context span {
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 800;
  color: #d8f4ff;
}

.login-context strong {
  max-width: 420px;
  font-size: 34px;
  line-height: 1.06;
}

.login-context p {
  max-width: 430px;
  margin: 0;
  color: #e7f7ff;
  line-height: 1.55;
}

.sidebar {
  width: 238px;
  min-height: 100vh;
  padding: 18px 12px;
  background: linear-gradient(180deg, #0a3354, #115994);
  color: white;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  margin: 4px 8px 26px;
}

.brand-logo {
  width: 58px;
  height: 38px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 5px;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  letter-spacing: 0;
}

.brand span {
  display: block;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  margin-top: 2px;
}

.nav-label {
  margin: 18px 10px 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  text-align: left;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

main {
  flex: 1;
  min-width: 0;
  padding: 18px 22px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 420px) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.page-title h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-dark);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
}

.top-search {
  display: grid;
  gap: 6px;
}

.top-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload {
  border: 0;
  background: var(--green);
  color: white;
  padding: 11px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 800;
}

.upload input {
  display: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  padding: 7px 8px;
  white-space: nowrap;
}

.user-chip span {
  color: var(--muted);
  font-size: 13px;
}

.user-chip button,
.documents-head button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfe;
  color: var(--ink);
  padding: 7px 10px;
  cursor: pointer;
}

h2,
h3,
p {
  margin-top: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-hero,
.admin-hero,
.panel,
.metrics article,
.task-summary article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(10, 51, 84, 0.06);
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.profile-card {
  display: grid;
  align-content: start;
  gap: 18px;
  border-top: 4px solid var(--green);
}

.profile-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.profile-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue-deep), var(--blue));
  color: white;
  font-size: 24px;
  font-weight: 900;
}

.avatar.small {
  width: 38px;
  height: 38px;
  font-size: 16px;
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.profile-details div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfdff;
}

.profile-details span,
.owner-line {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-details strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
}

.profile-metrics {
  margin-bottom: 0;
}

.admin-metrics {
  margin-bottom: 14px;
}

.workspace-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px;
  margin-bottom: 14px;
  border-top: 4px solid var(--blue);
}

.workspace-hero h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.workspace-hero p {
  margin: 0;
  color: var(--muted);
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px;
  margin-bottom: 14px;
  border-top: 4px solid var(--blue-dark);
}

.admin-hero h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.admin-hero p {
  margin: 0;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics article {
  padding: 16px;
}

.metrics span,
.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin: 10px 0 7px;
  color: var(--blue-dark);
}

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

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.tracks,
.agent-grid,
.timeline,
.doc-summary,
.documents-list,
.analysis-grid,
.process-list,
.task-list,
.user-list,
.admin-status,
.quick-actions {
  display: grid;
  gap: 10px;
}

.track,
.agent,
.phase,
.doc-summary > div,
.document-row,
.analysis-card,
.process-card,
.task-card,
.user-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 13px;
  background: #fbfdff;
}

.track strong,
.agent strong,
.phase strong {
  display: block;
  margin-bottom: 6px;
}

.track p,
.agent p,
.phase p,
.doc-summary p,
.document-row p,
.analysis-card p,
.process-card p,
.task-card p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.owner-line {
  margin-top: 8px;
  color: var(--blue-dark);
}

.steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.documents-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 20px 0 10px;
}

.documents-head h3 {
  margin: 0;
}

.copilot {
  max-width: 980px;
}

.chat {
  min-height: 390px;
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  background: #f8fbfe;
  display: grid;
  align-content: start;
  gap: 10px;
}

.message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 7px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(21, 80, 125, 0.06);
}

.message.ai {
  background: white;
  border: 1px solid var(--line);
}

.message.user {
  background: var(--blue);
  color: white;
  justify-self: end;
}

.ask {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.source-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.source {
  border-left: 3px solid var(--blue);
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.agent-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.tag,
.analysis-mode,
.status,
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 850;
}

.analysis-card h3,
.process-card h3,
.task-card h3 {
  margin-bottom: 8px;
}

.analysis-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.process-card,
.task-card {
  display: grid;
  gap: 12px;
}

.process-meta,
.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.process-meta div,
.task-grid div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: white;
}

.process-meta span,
.task-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.task-summary article {
  padding: 12px;
}

.task-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.task-summary strong {
  font-size: 24px;
  color: var(--blue-dark);
}

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

.compact-card .task-top {
  display: block;
}

.compact-card .analysis-mode {
  margin-top: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.user-row strong {
  display: block;
  margin-bottom: 4px;
}

.user-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.user-form {
  display: grid;
  gap: 12px;
}

.admin-grid {
  margin-top: 14px;
}

.admin-status {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-status div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdff;
}

.admin-status span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.admin-status strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  background: #fbfdff;
  color: var(--blue-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.quick-actions button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.user-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.task-top h3 {
  margin-bottom: 6px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill.critical {
  background: var(--red-soft);
  color: var(--red);
}

.pill.high {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.pill.medium {
  background: var(--green-soft);
  color: var(--green);
}

@media (max-width: 980px) {
  body {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

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

  main {
    padding: 16px;
  }

  .topbar,
  .grid.two,
  .login-shell {
    display: block;
  }

  .top-search,
  .top-actions,
  .workspace-hero,
  .admin-hero {
    margin-top: 14px;
  }

  .login-context {
    display: none;
  }

  .metrics,
  .agent-grid,
  .process-meta,
  .task-summary,
  .task-grid,
  .profile-layout,
  .profile-details,
  .admin-status,
  .quick-actions {
    grid-template-columns: 1fr;
  }

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