:root {
  --blue-900: #204f97;
  --blue-800: #2e63b0;
  --blue-100: #dbe7fb;
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1a2840;
  --muted: #63718a;
  --line: #d7dee8;
  --ok: #dff2dd;
  --warn: #fbe6b2;
  --risk: #ffd2d2;
  --shadow: 0 8px 25px rgba(16, 33, 64, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #f9fbff, var(--bg) 50%);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 1fr;
  background: #f4f5f8;
}

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

.login-panel {
  padding: 34px 42px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 40px;
}

.login-brand img {
  width: 188px;
  max-width: 100%;
  display: block;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ccd7e7;
  box-shadow: 0 18px 40px rgba(25, 39, 68, 0.12);
  border-radius: 20px;
  padding: 34px 32px;
}

.login-card h1 {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.1;
}

.login-subtitle {
  margin-top: 10px;
  color: #596780;
  font-size: 20px;
}

.login-card .field {
  margin-top: 28px;
}

.login-card .field span {
  color: #2f3d55;
  font-weight: 700;
}

.login-card .field input {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #ccd7e7;
  background: #f5f7fb;
  padding: 13px 12px;
  font-size: 18px;
}

.btn-login {
  margin-top: 16px;
  width: 100%;
  background: #2c5ca4;
  color: #fff;
  border-radius: 10px;
  padding: 13px 12px;
  font-size: 24px;
  font-weight: 700;
}

.btn-login:hover {
  background: #244f8c;
}

.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-message {
  margin-top: 14px;
  font-size: 14px;
  color: #566684;
  min-height: 20px;
}

.login-message.error {
  color: #a23636;
}

.login-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(0deg, rgba(20, 24, 30, 0.38), rgba(20, 24, 30, 0.38)),
    url("https://images.unsplash.com/photo-1511818966892-d7d671e672a2?auto=format&fit=crop&w=1800&q=80")
      center/cover no-repeat;
}

.login-visual-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(180deg, rgba(17, 20, 28, 0.2), rgba(17, 20, 28, 0.5));
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, var(--blue-900), #224582 70%);
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  padding: 10px 6px;
  width: 100%;
}

.brand-logo {
  width: 190px;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu-item {
  text-decoration: none;
  color: #e7efff;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.menu-item.active,
.menu-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 14px;
  flex-wrap: wrap;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c4dafd;
  color: #18396f;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.profile-name {
  font-weight: 700;
  font-size: 14px;
}

.profile-mail {
  font-size: 12px;
  opacity: 0.8;
}

.profile-logout {
  margin-left: auto;
  border-color: rgba(195, 211, 237, 0.42);
  background: rgba(255, 255, 255, 0.06);
  color: #eef4ff;
}

.profile-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  padding: 28px;
  display: grid;
  gap: 18px;
}

.view {
  display: grid;
  gap: 18px;
}

.view.hidden {
  display: none;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

h1 {
  font-size: clamp(26px, 2.2vw, 36px);
}

.subtitle {
  margin-top: 8px;
  color: var(--muted);
}

.workspace-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.workspace-subtitle strong {
  color: #203454;
}

.workspace-separator {
  color: #90a0b8;
}

.chip {
  background: #e2edff;
  color: #1b407c;
  border: 1px solid #bfd2f5;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.quick-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.quick-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.quick-card span {
  margin-top: 8px;
  display: block;
  color: var(--muted);
}

.quick-card.active {
  border-color: #acc2e8;
  background: #f7fbff;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.rat-toolbar {
  justify-content: space-between;
}

.search-input {
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  font: inherit;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.listing-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.listing-table th,
.listing-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #e4e9f1;
  text-align: left;
  vertical-align: top;
}

.listing-table th {
  color: #495a74;
  font-weight: 700;
  background: #f9fbff;
}

.listing-table tbody tr:hover td {
  background: #f9fbff;
}

.empty-cell {
  color: #6a7b96;
  text-align: center;
}

.table-chip {
  display: inline-block;
  border: 1px solid #d1dced;
  background: #f4f8ff;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  border: 1px solid #cbd8ed;
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
  font-size: 13px;
  color: #314c78;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.project-meta-grid span {
  display: block;
  color: #60708a;
  font-size: 12px;
}

.project-meta-grid strong {
  margin-top: 4px;
  display: inline-block;
}

.stage-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #c7d6ec;
  background: #edf4ff;
  color: #305e9b;
}

.stage-badge.ok {
  border-color: #9fd793;
  background: #d7f1d2;
  color: #205f1a;
}

.stage-badge.warn {
  border-color: #e1bf70;
  background: #f8e7bc;
  color: #765000;
}

.stage-badge.progress {
  border-color: #9ed1e8;
  background: #daf0fa;
  color: #1f5f7b;
}

.step {
  font-weight: 800;
  color: #244e92;
  margin-bottom: 12px;
}

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

.field,
.switch-field {
  display: grid;
  gap: 6px;
}

.field span,
.switch-field span {
  font-size: 13px;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}

.field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fff;
}

.field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  resize: vertical;
  min-height: 220px;
}

.switch-field {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 10px;
  min-height: 44px;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.upload-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 12px;
}

.source-tabs {
  display: inline-flex;
  background: #f4f8ff;
  border: 1px solid #d4e0f2;
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 12px;
}

.source-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  padding: 7px 11px;
  cursor: pointer;
}

.source-option input {
  margin: 0;
}

.source-option:has(input:checked) {
  background: #fff;
  border: 1px solid #c8d8f2;
}

.input-panel {
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

.upload-box {
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #9bb4dc;
  background: #f7faff;
  border-radius: 12px;
  padding: 22px;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box strong {
  display: block;
  margin-bottom: 6px;
}

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

.actions-col {
  display: grid;
  gap: 10px;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.text-tools {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-txt {
  border: 1px dashed #b5c6e3;
  border-radius: 10px;
  padding: 8px 12px;
  background: #f7faff;
  cursor: pointer;
}

.upload-txt input {
  display: none;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.btn-primary {
  background: #e5463e;
  color: #fff;
}

.btn-primary:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  border: 1px solid #c3d3ed;
  background: #fff;
  color: #2e578f;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.inline-actions {
  display: flex;
  gap: 8px;
}

.file-list {
  margin: 12px 0 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-list li {
  background: #f1f5fc;
  border: 1px solid #cfdbed;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.status {
  margin-top: 12px;
  color: var(--muted);
}

.progress {
  height: 8px;
  border-radius: 999px;
  margin-top: 10px;
  background: #edf2fb;
  overflow: hidden;
}

.progress span {
  width: 0;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, #4f7ecf, #2f63af);
  transition: width 0.3s ease;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.entity-form-panel {
  border: 1px solid #cfe0fa;
  background: #f7fbff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

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

.entity-form-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

h2 {
  font-size: 20px;
}

.empty {
  color: var(--muted);
}

.transcript-panel,
.recommendation-panel,
.ropa-container {
  min-height: 120px;
}

.transcript-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.transcript-item summary {
  font-weight: 700;
  cursor: pointer;
}

.transcript-item p {
  margin-top: 8px;
  color: #334661;
  white-space: pre-wrap;
}

.rec-group {
  border-left: 4px solid #c0cbdb;
  padding: 8px 10px;
  border-radius: 4px;
  background: #f8faff;
  margin-bottom: 10px;
}

.rec-group.high {
  border-left-color: #d93e3e;
  background: #fff2f2;
}

.rec-group.medium {
  border-left-color: #d19e2e;
  background: #fff8e7;
}

.rec-group.low {
  border-left-color: #4c70b8;
  background: #eef4ff;
}

.rec-title {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 4px;
}

.rec-body {
  color: #334661;
  font-size: 14px;
}

.ropa-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.ropa-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ropa-card h3 {
  font-size: 18px;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.confidence {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  font-size: 12px;
  font-weight: 800;
  color: #2e62ad;
}

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

.field-table td {
  border-top: 1px solid var(--line);
  padding: 9px 4px;
  vertical-align: top;
}

.field-table td:first-child {
  width: 220px;
  color: #4a5b75;
  font-weight: 700;
}

.editable-row.row-empty td {
  background: #fff6f6;
}

.editable-row.pending-change td {
  background: #fff9ec;
}

.editable-row.issue-high td {
  background: #fff3f3;
}

.editable-row.issue-medium td {
  background: #fff9ec;
}

.editable-row.issue-low td {
  background: #f3f7ff;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.required-mark {
  border: 1px solid #c6d5eb;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  color: #5a6f90;
  font-weight: 700;
}

.field-info {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #b2c7e6;
  background: #f0f5ff;
  color: #2f5ca0;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.empty-alert {
  display: none;
  background: #ffdede;
  border: 1px solid #f1b5b5;
  color: #a53737;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
}

.empty-alert.show {
  display: inline-block;
}

.field-cell {
  position: relative;
}

.field-input {
  width: 100%;
  border: 1px solid #ccd8ea;
  border-radius: 8px;
  padding: 8px 9px;
  font: inherit;
  color: #1f2d45;
  resize: vertical;
  min-height: 56px;
  background: #fbfdff;
}

.field-input:focus {
  outline: none;
  border-color: #6691d2;
  box-shadow: 0 0 0 3px rgba(78, 121, 193, 0.15);
}

.value {
  color: #1f2d45;
}

.value-empty {
  color: #9aa9c0;
}

.source {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #61728d;
}

.field-recommendation {
  display: none;
  margin-top: 8px;
  border-left: 3px solid #b9c8df;
  border-radius: 6px;
  background: #f7faff;
  padding: 8px 10px;
}

.field-recommendation.show {
  display: block;
}

.field-recommendation.high {
  border-left-color: #d54545;
  background: #fff4f4;
}

.field-recommendation.medium {
  border-left-color: #cfa33d;
  background: #fff9ed;
}

.field-recommendation.low {
  border-left-color: #4f76bc;
  background: #eef4ff;
}

.field-recommendation-message,
.field-recommendation-fill {
  margin: 0 0 6px;
  font-size: 13px;
  color: #2c3e5a;
}

.field-recommendation-fill {
  color: #3f567a;
}

.field-recommendation-action {
  border: 1px solid #bfd2eb;
  border-radius: 7px;
  padding: 4px 8px;
  background: #fff;
  color: #264f8f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.field-confidence {
  display: inline-block;
  margin-left: 6px;
  margin-top: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: #edf4ff;
  color: #2e62ad;
}

.field-assistant {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(460px, 95vw);
  background: #fff;
  border: 1px solid #d2ddee;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(20, 42, 78, 0.14);
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 40;
}

.field-cell:hover .field-assistant,
.field-assistant.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.assistant-title {
  font-weight: 800;
  color: #224b89;
  font-size: 12px;
  margin-bottom: 8px;
}

.assistant-item {
  border-left: 3px solid #b9c8df;
  border-radius: 5px;
  padding: 6px 8px;
  margin-bottom: 7px;
  background: #f7faff;
}

.assistant-item.high {
  border-left-color: #d54545;
  background: #fff3f3;
}

.assistant-item.medium {
  border-left-color: #cfa33d;
  background: #fff9ec;
}

.assistant-item.low {
  border-left-color: #4f76bc;
  background: #eff4ff;
}

.assistant-item p {
  margin: 0 0 6px;
  font-size: 13px;
  color: #2e405d;
}

.assistant-action {
  border: 1px solid #c1d2eb;
  border-radius: 8px;
  padding: 4px 8px;
  background: #fff;
  color: #244c89;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.assistant-ok {
  margin: 0;
  color: #4f6485;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 24px;
    min-height: 100vh;
  }

  .login-card {
    width: min(540px, 100%);
  }

  .login-visual {
    display: none;
  }

  .split,
  .upload-controls,
  .hero-grid,
  .quick-cards,
  .project-meta-grid,
  .entity-form-grid {
    grid-template-columns: 1fr;
  }

  .text-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand-text,
  .menu-item,
  .profile div {
    display: none;
  }

  .brand-logo {
    width: 52px;
  }

  .sidebar {
    align-items: center;
    padding: 16px 8px;
  }

  .menu {
    width: 100%;
  }

  .menu-item {
    justify-self: center;
    width: 44px;
    height: 44px;
  }

  .profile {
    border-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 16px;
    gap: 26px;
  }

  .login-brand img {
    width: 150px;
  }

  .login-card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .login-card h1 {
    font-size: 34px;
  }

  .login-subtitle {
    font-size: 17px;
  }

  .btn-login {
    font-size: 20px;
  }

  .main {
    padding: 14px;
  }

  .action-row {
    justify-content: stretch;
  }

  .actions-col {
    width: 100%;
  }

  .field-table td:first-child {
    width: 130px;
  }

  .field-assistant {
    left: 0;
    right: auto;
    width: min(92vw, 420px);
  }
}
