:root {
  --bg: #f4efe7;
  --panel: #fffdf8;
  --ink: #1f2a2b;
  --muted: #56646b;
  --line: #dfd7cc;
  --brand: #006a63;
  --danger: #bf3d3d;
  --ok: #23744a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 20%, #f9d89d 0%, transparent 40%),
              radial-gradient(circle at 90% 10%, #9fd8d0 0%, transparent 35%),
              var(--bg);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  z-index: 0;
  opacity: 0.35;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #f2b56b;
  top: -90px;
  right: -80px;
}

.orb-2 {
  width: 260px;
  height: 260px;
  background: #7cc7bc;
  bottom: -100px;
  left: -80px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1400px, 96vw);
  margin: 24px auto;
}

.hidden {
  display: none !important;
}

.login-card {
  width: min(460px, 96vw);
  margin: 64px auto;
  background: color-mix(in srgb, var(--panel) 92%, white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(48, 53, 59, 0.08);
  display: grid;
  gap: 12px;
}

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

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-color: var(--brand);
}

.remember-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remember-line input {
  width: 16px;
  height: 16px;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(31, 42, 43, 0.1);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  border-color: var(--brand);
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 75%, #00947f));
  color: #fff;
}

.btn-danger {
  border-color: var(--danger);
  background: linear-gradient(140deg, var(--danger), color-mix(in srgb, var(--danger) 78%, #cc5a5a));
  color: #fff;
}

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

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.header-spacer {
  flex: 1;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-approve-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auto-approve-input {
  width: 88px;
  padding-right: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.btn-toggle-on {
  border-color: color-mix(in srgb, var(--brand) 60%, var(--line));
  background: #e2f4f1;
  color: #0b5f57;
}

.role-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: #164f49;
  background: #daf2ee;
  border: 1px solid #b7e3db;
  border-radius: 999px;
  padding: 2px 8px;
}

.panel {
  background: color-mix(in srgb, var(--panel) 90%, white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 30px rgba(48, 53, 59, 0.08);
}

.table-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}

.table-header h2 {
  margin: 0;
  font-size: 16px;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}

.mode-btn {
  min-width: 108px;
}

.mode-btn-active {
  border-color: var(--brand);
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 75%, #00947f));
  color: #fff;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.load-progress {
  min-width: 72px;
  text-align: center;
  justify-self: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #2e3c42;
}

.table-wrap {
  overflow: auto;
}

.claim-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.claim-status {
  flex: 1;
  text-align: center;
  min-height: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
}

th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
}

th {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  word-break: keep-all;
}

.score-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.score-header span {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.btn-sort {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 4px 6px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1;
}

.btn-sort-active {
  border-color: color-mix(in srgb, var(--brand) 60%, var(--line));
  background: #e2f4f1;
  color: #0b5f57;
}

.cell-select {
  width: 52px;
  text-align: center;
}

.row-select-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand);
}

.cell-title {
  font-weight: 600;
}

.cell-summary {
  color: #3b4b4f;
  white-space: pre-wrap;
}

.cell-symbol,
.cell-priority,
.cell-score,
.cell-created-at,
.cell-result {
  font-variant-numeric: tabular-nums;
}

.note-input {
  min-width: 220px;
}

.action-group {
  display: flex;
  gap: 6px;
}

.action-group .btn {
  min-width: 62px;
  height: 40px;
  white-space: nowrap;
}

.action-group .btn.btn-busy {
  opacity: 0.78;
}

.btn-approve {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
  color: var(--ok);
}

.btn-reject {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  color: var(--danger);
}

.hint {
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.status-ok {
  color: var(--ok);
}

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

tbody tr.row-reviewed-ok td {
  background: color-mix(in srgb, #1f6a47 16%, transparent);
}

tbody tr.row-reviewed-fail td {
  background: color-mix(in srgb, #8a2525 16%, transparent);
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 18% 16%, rgba(249, 216, 157, 0.58) 0, transparent 38%),
      radial-gradient(circle at 88% 10%, rgba(159, 216, 208, 0.52) 0, transparent 34%),
      linear-gradient(180deg, #f8f2e8 0%, #efe6da 100%);
  }

  .app-shell {
    width: min(100%, 100vw);
    margin: 12px auto 18px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .user-box {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
  }

  .user-box > div:first-child {
    width: 100%;
  }

  .user-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .user-actions .btn,
  .mode-switch .btn,
  .claim-actions .btn {
    min-height: 42px;
  }

  .auto-approve-box {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .auto-approve-input {
    width: 88px;
    flex: 0 0 88px;
  }

  .table-header {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 10px;
  }

  .table-actions,
  .mode-switch,
  .load-progress {
    width: 100%;
  }

  .mode-switch,
  .table-actions,
  .claim-actions {
    flex-wrap: wrap;
  }

  .mode-switch .btn {
    flex: 1 1 calc(50% - 4px);
  }

  .table-actions {
    justify-content: space-between;
  }

  .load-progress {
    text-align: left;
    justify-self: start;
  }

  .panel {
    padding: 12px;
    border-radius: 16px;
  }

  .claim-bar {
    position: sticky;
    bottom: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
    border-radius: 14px;
    background: rgba(255, 253, 248, 0.92);
    backdrop-filter: blur(8px);
  }

  .claim-status {
    text-align: left;
  }

  .claim-actions {
    justify-content: space-between;
  }

  .claim-actions .btn,
  .user-actions .btn {
    flex: 1 1 calc(50% - 4px);
  }

  .user-actions #btn-logout {
    flex-basis: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  thead {
    display: none;
  }

  tbody {
    display: block;
  }

  tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 253, 248, 0.95);
    box-shadow: 0 10px 24px rgba(48, 53, 59, 0.08);
  }

  tbody tr td {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, white);
    font-size: 13px;
  }

  tbody tr td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding-top: 2px;
  }

  tbody tr td:last-child {
    border-bottom: none;
  }

  tbody tr.row-reviewed-ok,
  tbody tr.row-reviewed-fail {
    border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
  }

  tbody tr.row-reviewed-ok td,
  tbody tr.row-reviewed-fail td {
    background: transparent;
  }

  .row-empty {
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .row-empty td,
  .cell-empty {
    display: block;
    padding: 14px 4px 0;
    border-bottom: none;
  }

  .row-empty td::before {
    content: none;
  }

  .cell-select {
    width: auto;
    text-align: left;
  }

  .cell-select::before {
    text-transform: none;
  }

  .row-select-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
  }

  .cell-title {
    font-size: 14px;
    line-height: 1.45;
  }

  .cell-summary {
    line-height: 1.55;
  }

  .note-input {
    min-width: 0;
    width: 100%;
  }

  .action-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .action-group .btn {
    min-width: 0;
    width: 100%;
    height: 42px;
  }

  .cell-note,
  .cell-actions {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .cell-result {
    font-weight: 600;
    line-height: 1.45;
  }

  .login-card {
    width: min(100%, calc(100vw - 20px));
    margin: 20px auto;
    padding: 18px;
    border-radius: 16px;
  }

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