:root {
  color-scheme: light;
  font-family: Arial, "Segoe UI", sans-serif;
  background: #f5f7f8;
  color: #182026;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.login-body {
  align-items: center;
  background: #eef3f5;
  display: flex;
  min-height: 100vh;
}

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

button {
  border: 1px solid #255266;
  background: #255266;
  color: white;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  background: #183b4b;
}

button:disabled {
  background: #d9e1e5;
  border-color: #c1ccd1;
  color: #6d7c83;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7d0d5;
  background: white;
  padding: 8px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #4e5c63;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.login-shell {
  margin: 0 auto;
  max-width: 420px;
  padding: 18px;
  width: 100%;
}

.login-panel {
  background: white;
  border: 1px solid #d6dfe3;
  padding: 24px;
}

.login-panel h1 {
  font-size: 24px;
  margin: 0 0 8px;
}

.login-panel p {
  color: #53646c;
  line-height: 1.55;
  margin: 0 0 18px;
}

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

.login-meta {
  margin-bottom: 16px;
}

.account-note {
  border-top: 1px solid #edf1f3;
  font-size: 12px;
  margin-top: 16px;
  padding-top: 12px;
}

a {
  color: #255266;
  font-weight: 700;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 14px;
}

.toolbar h1 {
  margin: 0;
  font-size: 24px;
}

.brand-block {
  min-width: 260px;
}

.brand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.brand-meta span,
.app-footer span {
  background: #eef3f5;
  border: 1px solid #ccd8dd;
  color: #33464f;
  font-size: 12px;
  padding: 5px 8px;
}

.toolbar p {
  margin: 4px 0 0;
  color: #5f6d73;
}

.actions,
.top-controls,
.view-menu,
.row,
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-controls {
  align-items: flex-end;
  flex-direction: column;
}

.view-menu {
  border: 1px solid #c7d0d5;
  background: #eef3f5;
  padding: 3px;
}

.menu-button {
  border-color: transparent;
  background: transparent;
  color: #255266;
}

.menu-button:hover,
.menu-button.active {
  border-color: #255266;
  background: #255266;
  color: white;
}

.hidden {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(420px, 1fr) minmax(320px, 420px);
  gap: 12px;
}

.portfolio-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  margin-bottom: 12px;
}

.summary-card {
  background: white;
  border: 1px solid #d8e1e5;
  color: #182026;
  display: grid;
  gap: 3px;
  min-height: 86px;
  padding: 12px;
  text-align: left;
}

.summary-card:hover {
  background: #f8fafb;
  border-color: #255266;
  color: #182026;
}

.summary-value {
  color: #255266;
  font-size: 24px;
  font-weight: 800;
}

.summary-label {
  font-size: 13px;
  font-weight: 700;
}

.summary-hint {
  color: #65747b;
  font-size: 12px;
}

.panel {
  background: white;
  border: 1px solid #dde4e8;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.main-panel {
  min-height: 620px;
}

.paper-list {
  display: none;
  gap: 8px;
  margin-top: 12px;
}

.paper-table-wrap {
  border: 1px solid #d6dfe3;
  margin-top: 12px;
  max-height: 660px;
  overflow: auto;
}

.paper-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 980px;
  width: 100%;
}

.paper-table th,
.paper-table td {
  border-bottom: 1px solid #e6ecef;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.paper-table th {
  background: #eef3f5;
  color: #2b3e47;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

.paper-table tr {
  cursor: pointer;
}

.paper-table tr:hover,
.paper-table tr.active {
  background: #f1f7f8;
}

.table-sub {
  color: #738187;
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 3px;
}

.status-badge {
  border: 1px solid #c7d0d5;
  display: inline-block;
  font-size: 11px;
  min-width: 58px;
  padding: 3px 6px;
  text-align: center;
}

.status-ready {
  background: #fff7dd;
  border-color: #e5cb79;
  color: #765e16;
}

.status-candidate {
  background: #e8f3fb;
  border-color: #adcbe1;
  color: #255266;
}

.status-done {
  background: #e8f5ed;
  border-color: #a8d2ba;
  color: #2d6b45;
}

.status-default {
  background: #f5f7f8;
  color: #4e5c63;
}

.paper-card {
  border: 1px solid #d6dfe3;
  padding: 10px;
  background: #fbfcfc;
  cursor: pointer;
}

.paper-card:hover,
.paper-card.active {
  border-color: #255266;
}

.paper-title {
  font-weight: 700;
  line-height: 1.35;
}

.paper-meta {
  color: #66757c;
  margin-top: 5px;
  font-size: 12px;
}

.count {
  color: #66757c;
  margin-top: 10px;
  font-size: 12px;
}

.workspace-status {
  background: #eef6f4;
  border: 1px solid #c7ddd7;
  color: #294840;
  font-size: 12px;
  margin-top: 10px;
  padding: 8px;
}

.output-panel {
  margin-top: 12px;
}

.compact-list {
  color: #425158;
  display: grid;
  font-size: 12px;
  gap: 7px;
  line-height: 1.5;
  margin: 0;
  padding-left: 18px;
}

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

.queue-item {
  background: #fbfcfc;
  border: 1px solid #d6dfe3;
  color: #24343b;
  display: grid;
  gap: 4px;
  padding: 8px;
  text-align: left;
}

.queue-item:hover {
  background: #f1f7f8;
  border-color: #255266;
  color: #182026;
}

.queue-item strong {
  font-size: 12px;
  line-height: 1.35;
}

.queue-item span {
  color: #66757c;
  font-size: 11px;
  line-height: 1.4;
}

.kmap-progress {
  background: #f7fafb;
  border: 1px solid #d8e3e7;
  margin-bottom: 10px;
  padding: 12px;
}

.progress-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-head strong {
  color: #182026;
}

.progress-head span {
  color: #50636b;
  font-size: 12px;
}

.progress-bar {
  background: #dce6ea;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
}

#kmapProgressBar {
  background: #2d6f83;
  height: 100%;
  transition: width 220ms ease;
  width: 0%;
}

.kmap-progress.failed #kmapProgressBar {
  background: #a74343;
}

.kmap-progress.complete #kmapProgressBar {
  background: #2f7d55;
}

.kmap-steps {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.kmap-steps li {
  color: #6d7c83;
  font-size: 12px;
}

.kmap-steps li.running {
  color: #255266;
  font-weight: 700;
}

.kmap-steps li.complete {
  color: #2f7d55;
}

.kmap-steps li.failed {
  color: #a74343;
  font-weight: 700;
}

.guide-view {
  background: white;
  border: 1px solid #dde4e8;
  padding: 18px;
}

.guide-header {
  border-bottom: 1px solid #dde4e8;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.guide-header h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.guide-header p,
.guide-section p,
.guide-section li {
  color: #425158;
  line-height: 1.65;
}

.guide-section {
  border-bottom: 1px solid #edf1f3;
  padding: 14px 0;
}

.guide-section:last-child {
  border-bottom: 0;
}

.guide-section h3 {
  margin: 0 0 10px;
  color: #182026;
  font-size: 17px;
}

.guide-section ol,
.guide-section ul {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.guide-command {
  background: #f3f6f7;
  border: 1px solid #dce5e9;
  color: #182026;
  min-height: 0;
}

.guide-table {
  border-collapse: collapse;
  display: block;
  margin-top: 10px;
  overflow-x: auto;
  width: 100%;
}

.guide-table th,
.guide-table td {
  border: 1px solid #dce5e9;
  min-width: 160px;
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.guide-table th {
  background: #eef3f5;
  color: #24343b;
}

.guide-table td {
  color: #425158;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0f1d24;
  color: #e8f2f5;
  padding: 12px;
  min-height: 120px;
  max-height: 460px;
  overflow: auto;
}

.feedback-panel {
  border-top: 1px solid #dde4e8;
  margin-top: 12px;
  padding-top: 12px;
}

.feedback-panel h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.feedback-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 220px) minmax(180px, 240px) 1fr auto;
  align-items: end;
}

.feedback-grid textarea {
  min-height: 64px;
}

.app-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  padding: 14px 0 2px;
}

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

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

  .paper-table-wrap {
    display: none;
  }

  .paper-list {
    display: grid;
  }

  .toolbar,
  .top-controls,
  .view-menu,
  .actions,
  .row,
  .filters,
  .feedback-grid {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-grid {
    display: flex;
  }
}
