@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg-primary: #0f1e33;
  --bg-secondary: #1e3a5f;
  --bg-neutral: #f5f6f8;
  --card: #ffffff;
  --line: #d7dde6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --action: #2e8b57;
  --accent: #c8a96a;
  --danger-bg: #fce9e9;
  --danger-line: #e4b8b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-neutral);
}

a {
  color: inherit;
}

.page {
  width: min(1160px, 94vw);
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(8, 19, 37, 0.05);
  padding: 22px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--action);
  color: #fff;
  box-shadow: 0 6px 18px rgba(46, 139, 87, 0.22);
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.btn-outline {
  background: #fff;
  color: #1d3557;
  border-color: #b8c2d3;
}

.btn-navy {
  background: var(--bg-secondary);
  color: #fff;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.alert {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: #8a2f2f;
}

.alert-success {
  background: #e9f8ef;
  border-color: #b6dec6;
  color: #245a3b;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
}

.brand-word {
  font-size: 28px;
  letter-spacing: 0.08em;
  font-weight: 800;
}

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

.top-links a {
  font-size: 14px;
  font-weight: 600;
  color: #d8e4f5;
  text-decoration: none;
}

.hero-title {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.18;
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.small-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.muted {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.label {
  font-size: 14px;
  font-weight: 500;
  color: #253247;
  display: grid;
  gap: 6px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bcc8da;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
}

input:focus {
  outline: none;
  border-color: #4d668b;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.footer-min {
  margin: 20px 0 28px;
  font-size: 13px;
  color: #637089;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-min a {
  color: inherit;
  text-decoration: none;
}

/* Landing */
.landing-shell {
  background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 60%, #244974 100%);
  color: #f3f7ff;
  min-height: 100vh;
}

.landing-hero {
  padding: 56px 0 34px;
  display: grid;
  gap: 22px;
}

.landing-hero p {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.5;
  color: #d6deea;
}

.landing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.landing-benefits {
  margin-top: 10px;
  display: grid;
  gap: 12px;
}

.benefit-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
}

.benefit-card strong {
  color: var(--accent);
  display: block;
  margin-bottom: 5px;
}

/* Login / signup */
.auth-shell {
  min-height: 100vh;
  background: linear-gradient(145deg, var(--bg-primary), #173359 70%, #204771);
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(470px, 96vw);
  display: grid;
  gap: 14px;
}

.auth-head h1 {
  margin: 0;
  color: #f3f7ff;
  font-size: 32px;
  font-weight: 800;
}

.auth-head p {
  margin: 8px 0 0;
  color: #cfd9e9;
  font-size: 14px;
}

.auth-main {
  display: grid;
  gap: 12px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}

.auth-links a {
  color: #3e5982;
  text-decoration: none;
  font-weight: 600;
}

/* Workspace */
.workspace-body {
  background: #f1f4f8;
}

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

.workspace-sidebar {
  background: #0e2433;
  color: #e6edf5;
  padding: 20px 16px;
  border-right: 1px solid #113043;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-size: 24px;
  letter-spacing: 0.06em;
  font-weight: 800;
  margin-bottom: 24px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  color: #d0dceb;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-nav a:hover {
  background: #17384c;
}

.sidebar-nav a.is-active {
  background: #1b3f56;
  color: #fff;
}

.workspace-main {
  padding: 20px;
}

.workspace-topbar {
  background: #fff;
  border: 1px solid #d7dde6;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(9, 25, 42, 0.06);
  padding: 18px 20px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.workspace-topbar h1 {
  margin: 0;
  font-size: 30px;
  color: #142738;
}

.workspace-topbar p {
  margin: 6px 0 0;
  color: #5f6f82;
  font-size: 14px;
}

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

.user-chip {
  background: #eef3f9;
  border: 1px solid #ced9e8;
  border-radius: 999px;
  padding: 7px 12px;
  color: #21405c;
  font-size: 12px;
  font-weight: 600;
}

/* App */
.app-shell {
  padding: 20px 0 30px;
}

.app-top {
  background: var(--bg-primary);
  color: #f3f7ff;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.stepper-card {
  padding: 14px 16px;
  margin-bottom: 14px;
}

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

.step {
  border: 1px solid #d2dbe9;
  border-radius: 12px;
  background: #f8faff;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.step.is-active {
  border-color: #b8c8de;
  background: #f3f7ff;
}

.step-index {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  background: #2b4f7f;
  flex: 0 0 auto;
}

.step strong {
  display: block;
  font-size: 13px;
  color: #1e3556;
}

.step small {
  display: block;
  font-size: 12px;
  color: #60718a;
}

.app-top h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
}

.app-top p {
  margin: 8px 0 0;
  color: #d3ddeb;
}

.app-top-right {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.app-top-right .user {
  color: #d8e4f5;
  font-size: 13px;
}

.app-layout {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 14px;
}

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

.form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.form-section .section-title {
  margin-bottom: 10px;
}

.section-note {
  margin: -2px 0 10px;
  font-size: 13px;
  color: #60718a;
}

.dropzone-wrap {
  display: grid;
  gap: 8px;
}

.file-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dropzone {
  border: 2px dashed #9eb0c9;
  border-radius: 12px;
  min-height: 120px;
  background: #f9fbff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px;
  gap: 6px;
  cursor: pointer;
}

.dropzone strong {
  font-size: 15px;
  color: #1f3f77;
}

.dropzone span {
  color: var(--text-secondary);
  font-size: 14px;
}

.input-help {
  margin: 0;
  font-size: 12px;
  color: #5f718b;
}

.dropzone.is-hover {
  border-color: #2f5d9b;
  background: #eef4ff;
}

.dropzone.is-valid {
  border-color: var(--action);
  background: #edf8f1;
}

.dropzone.is-error {
  border-color: #bb6767;
  background: #fff3f3;
}

.review-shell {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.review-head {
  display: grid;
  gap: 4px;
}

.review-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  font-size: 13px;
  color: #2f4561;
}

.selection-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.selection-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  border: 1px solid #d5deea;
  background: #f7fafc;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #2b3f58;
}

.review-table .cell-input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.review-table .row-select {
  width: 16px;
  height: 16px;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.row-actions .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.origin-text {
  font-size: 12px;
  color: #556a83;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  padding: 4px 8px;
  font-weight: 700;
}

.confidence-high {
  background: #e8f5ef;
  color: #2f6b57;
}

.confidence-medium {
  background: #f8efdf;
  color: #9b6622;
}

.confidence-low {
  background: #f9e5e5;
  color: #a94e4e;
}

.row-warning td {
  background: #fff8f0;
}

.row-invalid-live td {
  background: #fff3f3;
}

.warning-details td {
  background: #fff9f3;
  color: #7d5930;
  font-size: 12px;
}

.validation-box {
  border: 1px solid #cdd7e7;
  background: #fbfcff;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.validation-box .muted {
  font-weight: 600;
  color: #2f4a73;
}

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

.preview.is-hidden {
  display: none;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e3e9f1;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f5f8fd;
  color: #233c62;
  font-weight: 600;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-submit {
  min-width: 260px;
  min-height: 50px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
}

.processing-text {
  font-size: 14px;
  color: #2a4c7c;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.processing-text.is-hidden {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(17, 24, 39, 0.2);
  border-top-color: #172f50;
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

.spinner.is-hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.side-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.side-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.side-block ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 14px;
  display: grid;
  gap: 6px;
}

.rules-box summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #253f63;
}

.rules-box > ul {
  margin-top: 10px;
}

.downloads-grid {
  display: grid;
  gap: 12px;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.stat span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

.stat strong {
  font-size: 15px;
}

.total-line {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e0e6ef;
  font-weight: 600;
}

.log-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #2e4468;
  display: grid;
  gap: 4px;
}

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

  .workspace-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #17384c;
  }

  .workspace-main {
    padding: 12px;
  }

  .workspace-topbar {
    flex-direction: column;
  }

  .review-meta {
    grid-template-columns: 1fr;
  }

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

  .app-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
}
