:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #6a7380;
  --line: #e2e7ef;
  --primary: #0b57d0;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  background: radial-gradient(circle at top right, #e7f0ff, var(--bg));
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  width: min(420px, 92vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 8px 26px rgba(15, 32, 63, 0.08);
}

.login-card h1 {
  margin: 0;
}

.login-card form {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

input,
button {
  font-size: 14px;
}

input[type='password'],
input[type='file'] {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
}

button.secondary {
  color: var(--text);
  background: #e8eef8;
}

button.full-width {
  width: 100%;
  margin-top: 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.link-btn {
  display: inline-block;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  line-height: 1;
}

button.danger {
  background: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

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

.container {
  width: min(1200px, 94vw);
  margin: 20px auto;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  color: var(--text);
  background: #e8eef8;
}

.tab-btn.active {
  color: #fff;
  background: var(--primary);
}

.tab-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.tab-panel.active {
  display: block;
}

.upload-form {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.upload-progress.hidden {
  display: none;
}

.upload-progress-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #e8eef8;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0b57d0, #3f87ff);
  transition: width 0.15s ease;
}

.table-wrap {
  overflow: auto;
}

.password-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.passkey-form {
  display: flex;
  gap: 10px;
}

.password-form input {
  min-width: 180px;
  flex: 1;
}

.passkey-form input {
  min-width: 180px;
  flex: 1;
}

.passkey-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.passkey-item > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.passkey-item strong,
.passkey-item span {
  overflow-wrap: anywhere;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 6px;
  text-align: left;
  vertical-align: middle;
}

td .actions {
  display: flex;
  gap: 8px;
}

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

.error {
  color: var(--danger);
  min-height: 20px;
}

.board-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.board-status {
  color: var(--muted);
  min-height: 20px;
}

.board-status.error {
  color: var(--danger);
}

.board-editor {
  display: block;
  width: 100%;
  min-height: 65vh;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
  overflow: auto;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.board-editor.locked {
  background: #f3f6fb;
}

.board-editor:empty::before {
  content: attr(data-placeholder);
  color: #9aa4b2;
}

.board-editor .editor-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
}

.board-history {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.board-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-history-head h3 {
  margin: 0;
  font-size: 16px;
}

.board-versions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.board-version-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  padding: 10px;
}

.board-version-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.board-version-preview {
  margin-top: 6px;
  font-size: 13px;
}

.board-version-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.api-docs {
  line-height: 1.7;
}

.api-docs h3 {
  margin-top: 16px;
  margin-bottom: 8px;
}

.api-list {
  margin: 0;
  padding-left: 20px;
}

.api-key-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.api-code {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(680px, 96vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

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

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

/* ── Requirements ─────────────────────────────── */

.req-container {
  display: flex;
  gap: 14px;
  min-height: 50vh;
}

.req-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding-right: 14px;
}

.req-main {
  flex: 1;
  min-width: 0;
}

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

.req-project-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.req-project-list .proj-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-project-list .proj-action {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}

.req-project-list li:hover .proj-action,
.req-project-list li.active .proj-action {
  opacity: 0.65;
}

.req-project-list .proj-action:hover {
  opacity: 1;
}

.req-project-list .proj-action.delete:hover {
  color: #e5484d;
}

.req-project-list li:hover {
  background: #f0f4fa;
}

.req-project-list li.active {
  background: var(--primary);
  color: #fff;
}

.req-project-list .badge {
  font-size: 11px;
  background: #e8eef8;
  border-radius: 10px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.req-project-list li.active .badge {
  background: rgba(255, 255, 255, 0.25);
}

.req-add-project {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.req-add-project input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

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

.req-project-title {
  font-size: 16px;
  font-weight: 600;
}

.req-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.req-add-form.hidden {
  display: none;
}

.req-add-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.req-add-form select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 14px;
  background: #fff;
}

.req-items {
  display: grid;
  gap: 6px;
}

.req-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.req-item .drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  padding: 0 2px;
}

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

.req-item.dragging {
  opacity: 0.4;
}

.req-item.drag-over {
  border-top: 2px solid var(--primary);
}

.req-item .status-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  padding: 0;
  font-size: 14px;
  line-height: 26px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
}

.req-item .status-btn.todo {
  background: #e8eef8;
  color: var(--muted);
}

.req-item .status-btn.doing {
  background: #fff3cd;
  color: #856404;
}

.req-item .status-btn.done {
  background: #d4edda;
  color: #155724;
}

.req-item .content {
  flex: 1;
  min-width: 0;
  cursor: text;
}

.req-item .content.done {
  text-decoration: line-through;
  color: var(--muted);
}

.req-item .content-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
}

.req-item .priority {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.req-item .priority.high {
  background: #fde8e8;
  color: var(--danger);
}

.req-item .priority.medium {
  background: #fff3cd;
  color: #856404;
}

.req-item .priority.low {
  background: #e8eef8;
  color: var(--muted);
}

.req-item .delete-btn {
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.req-item .delete-btn:hover {
  color: var(--danger);
}

@media (max-width: 720px) {
  .upload-form {
    flex-direction: column;
  }

  .login-card form {
    flex-direction: column;
  }

  .password-form {
    flex-direction: column;
  }

  .passkey-form,
  .passkey-item {
    flex-direction: column;
    align-items: stretch;
  }

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

  .req-container {
    flex-direction: column;
  }

  .req-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 10px;
  }

  .req-add-form {
    flex-wrap: wrap;
  }
}
