:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #657184;
  --line: #dce3ed;
  --accent: #0f766e;
  --blue: #2563eb;
  --gold: #a16207;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --done: #166534;
  --done-soft: #dcfce7;
  --shadow: 0 14px 32px rgba(24, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.10), transparent 300px),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.auth {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

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

.auth-card input,
.search-box,
.modal input,
.modal textarea,
.modal select,
.credential-value,
.company-note {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.auth-card input,
.search-box,
.modal input,
.modal select {
  height: 42px;
  padding: 0 12px;
}

.auth-card input:focus,
.search-box:focus,
.modal input:focus,
.modal textarea:focus,
.modal select:focus,
.credential-value:focus,
.company-note:focus {
  border-color: rgba(15, 118, 110, 0.64);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.auth-actions,
.toolbar,
.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-actions {
  justify-content: flex-end;
}

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

h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.1;
  letter-spacing: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.toolbar {
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.icon-button,
.small-button,
.small-icon {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border-radius: 8px;
}

.primary-button {
  min-width: 84px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.20);
}

.ghost-button,
.icon-button {
  min-width: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
}

.small-button,
.small-icon,
.drag-handle {
  color: var(--muted);
  background: #f4f6fa;
}

.small-button {
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.small-icon,
.drag-handle {
  width: 30px;
  min-height: 30px;
  border-radius: 7px;
  font-size: 16px;
}

.drag-handle {
  display: inline-grid;
  place-items: center;
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 18px;
}

.control-actions {
  justify-content: flex-end;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.column {
  min-height: 560px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.column.drop-target {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.column-header,
.column-tools,
.company-head,
.company-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.column-header,
.company-head {
  justify-content: space-between;
}

.column-header {
  padding: 2px 2px 12px;
}

.column-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  font-size: 17px;
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.column[data-category="innovation"] .dot {
  background: var(--blue);
}

.column[data-category="specialized"] .dot {
  background: var(--gold);
}

.count {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  place-items: center;
  color: var(--muted);
  background: #f0f3f8;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.company-list {
  min-height: 470px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.company {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(24, 32, 51, 0.07);
}

.company.complete {
  border-color: rgba(22, 101, 52, 0.28);
  background: linear-gradient(180deg, rgba(220, 252, 231, 0.42), #fff 116px);
}

.company.dragging {
  opacity: 0.55;
}

.company-name {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
  user-select: text;
}

.company-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mobile-stage-control {
  display: none;
}

.company-note {
  min-height: 42px;
  margin: 7px 0 12px;
  padding: 8px 10px;
  color: var(--muted);
  background: #f7f9fc;
  border-color: transparent;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.company-meta,
.credential-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.company-meta {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.status-pill {
  width: fit-content;
  padding: 4px 8px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.company.complete .status-pill {
  color: var(--done);
  background: var(--done-soft);
}

.materials-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.credential-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 6px 8px;
  background: #f7f9fc;
  border-radius: 8px;
}

.credential-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.credential-value {
  overflow: hidden;
  background: transparent;
  border-color: transparent;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  padding: 4px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.progress {
  height: 8px;
  overflow: hidden;
  background: #edf1f6;
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.progress-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.file-panel[hidden] {
  display: none;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 8px;
  align-items: start;
  min-height: 30px;
}

.file-item input {
  width: 18px;
  height: 18px;
  margin: 5px 0 0;
  accent-color: var(--accent);
}

.file-name {
  min-width: 0;
  padding-top: 4px;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.55;
  user-select: text;
}

.file-item input:checked + .file-name {
  color: var(--muted);
  text-decoration: line-through;
}

.add-file {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 10px;
}

.add-file input {
  height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  border: 1px dashed #c7d0dd;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

.backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: start;
  justify-items: center;
  overflow: auto;
  padding: 20px;
  background: rgba(15, 23, 42, 0.40);
  z-index: 10;
}

.backdrop.open {
  display: grid;
}

.modal {
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.modal-header {
  position: sticky;
  top: -20px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 0 0 12px;
  margin-bottom: 16px;
  background: #fff;
}

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

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal textarea {
  min-height: 100px;
  max-height: 240px;
  resize: vertical;
  padding: 10px 12px;
}

#companyFiles,
#defaultFilesEdit {
  min-height: 150px;
}

.modal-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px -20px -20px;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 14px;
  color: #fff;
  background: #172033;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
  font-size: 14px;
  z-index: 20;
}

.toast.show {
  display: block;
}

@media (max-width: 1020px) {
  .topbar,
  .controls {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .control-actions {
    justify-content: flex-start;
  }

  .board {
    display: flex;
    gap: 14px;
    align-items: stretch;
    overflow-x: auto;
    margin-inline: -24px;
    padding: 4px 24px 20px;
    scroll-padding-inline: 24px;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .column {
    flex: 0 0 min(430px, calc(100vw - 64px));
    min-height: 460px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .company-list {
    min-height: 360px;
  }

  .drag-handle {
    display: none;
  }

  .mobile-stage-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-stage-select {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 34px 0 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}

@media (max-width: 560px) {
  .app {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .auth {
    min-height: calc(100dvh - 32px);
  }

  .auth-card {
    padding: 20px;
  }

  .topbar {
    align-items: start;
  }

  h1 {
    font-size: 30px;
  }

  .toolbar,
  .control-actions,
  .auth-actions {
    width: 100%;
  }

  .toolbar,
  .control-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar .ghost-button:last-child {
    grid-column: 1 / -1;
  }

  .ghost-button,
  .primary-button {
    width: 100%;
    min-height: 44px;
  }

  .board {
    gap: 10px;
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }

  .column {
    flex-basis: calc(100vw - 32px);
    padding: 12px;
  }

  .column-header {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -12px -12px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }

  .company {
    padding: 12px;
  }

  .company-head {
    align-items: start;
  }

  .company-actions {
    flex: 0 0 auto;
  }

  .small-button,
  .small-icon,
  .icon-button {
    min-height: 40px;
  }

  .small-icon {
    width: 40px;
  }

  .credential-row {
    grid-template-columns: 42px minmax(0, 1fr) 40px;
  }

  .file-item {
    grid-template-columns: 28px minmax(0, 1fr) 40px 40px;
  }

  .file-item input {
    width: 20px;
    height: 20px;
  }

  .backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 18px;
    border-radius: 16px 16px 0 0;
  }

  .modal-header {
    top: -18px;
    padding-top: 4px;
  }

  .modal-actions {
    bottom: -18px;
    margin: 18px -18px -18px;
    padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  }

  .toast {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px);
  }
}

/* Application shell */
:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #16212e;
  --muted: #6d7987;
  --line: #dce3e8;
  --accent: #0f766e;
  --blue: #3267c8;
  --gold: #b36b00;
  --nav: #132735;
  --nav-soft: #1b3647;
  --shadow: 0 8px 20px rgba(21, 40, 56, 0.06);
}

body {
  background: var(--bg);
}

.app {
  width: 100%;
  max-width: none;
  padding: 0;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 26px 16px 20px;
  color: #e8f0f4;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #12313b;
  background: #84d7bd;
  border-radius: 7px;
  font-size: 16px;
}

.sidebar-label {
  margin: 0 8px 9px;
  color: #8fa5b3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.category-nav {
  display: grid;
  gap: 4px;
}

.category-nav a,
.nav-action {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 10px;
  color: #d7e4eb;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

.category-nav a:hover,
.nav-action:hover {
  background: var(--nav-soft);
}

.category-nav b {
  margin-left: auto;
  color: #9fb4c0;
  font-size: 12px;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fd0b1;
}

.nav-dot.innovation { background: #7faaf8; }
.nav-dot.specialized { background: #f2b85a; }

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(231, 242, 248, 0.14);
}

.nav-action {
  width: 100%;
  border: 0;
}

.main-content {
  min-width: 0;
  padding: 34px clamp(24px, 4vw, 56px) 56px;
}

.topbar {
  align-items: start;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1 {
  margin-bottom: 6px;
  font-size: 32px;
  line-height: 1.2;
}

.toolbar {
  gap: 8px;
}

.toolbar .ghost-button,
.control-actions .ghost-button {
  padding-inline: 13px;
  font-size: 13px;
}

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

.summary-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  align-content: center;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.summary-card.completed strong { color: var(--done); }

.controls {
  margin-bottom: 18px;
}

.search-box {
  max-width: 520px;
  background: #fff;
}

.board {
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
}

.column {
  min-height: 460px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 7px;
  box-shadow: none;
}

.column-header {
  padding: 16px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.column-title { font-size: 16px; }
.company-list { min-height: 380px; gap: 0; }

.company {
  padding: 15px 16px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.company:last-child { border-bottom: 0; }

.company.complete {
  background: #f4fbf7;
  border-color: var(--line);
}

.company-name { font-size: 15px; }

.company-actions { gap: 5px; }
.small-button { color: #526273; background: #eef2f5; }
.small-icon { color: #526273; background: #eef2f5; }

.company-note {
  margin: 10px 0;
  padding: 7px 0;
  background: transparent;
  border-bottom: 1px solid #e5eaed;
  border-radius: 0;
}

.credential-grid { gap: 5px; }
.credential-row { padding: 4px 6px; background: #f7f9fa; border-radius: 5px; }
.progress-row { margin-top: 12px; margin-bottom: 0; }
.file-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e6ebee; }
.file-list { gap: 6px; }
.add-file { margin-top: 12px; }

.auth {
  min-height: 100vh;
  background: #edf3f3;
}

.auth-card {
  border-radius: 7px;
  box-shadow: 0 16px 44px rgba(21, 40, 56, 0.10);
}

@media (max-width: 1150px) {
  .workspace { grid-template-columns: 210px minmax(0, 1fr); }
  .board { grid-template-columns: repeat(3, minmax(260px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
}

@media (max-width: 820px) {
  .workspace { display: block; }
  .sidebar { min-height: auto; padding: 14px 16px; }
  .brand { padding: 0 0 14px; }
  .sidebar-label, .sidebar-footer { display: none; }
  .category-nav { display: flex; overflow-x: auto; }
  .category-nav a { flex: 0 0 auto; padding-inline: 8px; }
  .main-content { padding: 24px 18px 44px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { margin: 0; padding: 0 0 10px; scroll-padding-inline: 0; }
  .column { flex-basis: min(430px, calc(100vw - 56px)); }
}

@media (max-width: 560px) {
  .topbar { grid-template-columns: 1fr; }
  .toolbar { display: flex; width: auto; }
  .toolbar .ghost-button { width: auto; min-height: 38px; }
  .summary-card { min-height: 88px; padding: 14px; }
  .summary-card strong { font-size: 24px; }
  .controls { grid-template-columns: 1fr; }
  .control-actions { display: flex; width: auto; }
  .control-actions .ghost-button { width: auto; min-height: 38px; }
  .column { flex-basis: calc(100vw - 36px); }
}

