﻿:root {
  --ink: #17212b;
  --muted: #65758a;
  --line: #f0dcc9;
  --panel: #ffffff;
  --bg: #fffaf5;
  --brand: #f97316;
  --brand-dark: #c2410c;
  --accent: #fb923c;
  --danger: #b42318;
  --ok: #18864b;
  --shadow: 0 16px 40px rgba(124, 45, 18, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.login-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}

.login-brand {
  display: grid;
  gap: 10px;
  justify-items: start;
  color: var(--brand);
  margin-bottom: 4px;
}

.login-hint,
.login-error {
  margin: 0;
  font-size: 13px;
}

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

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: #ffffff;
  color: var(--ink);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 30px rgba(124, 45, 18, .04);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 150px;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.login-brand .brand-logo {
  width: min(300px, 100%);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.account-box label {
  color: var(--muted);
  font-size: 13px;
}

.account-box {
  display: grid;
  gap: 8px;
}

.account-box strong {
  color: var(--brand-dark);
}

.account-box span {
  color: var(--muted);
  font-size: 13px;
}

.account-box select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  text-align: left;
  color: var(--ink);
  background: transparent;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #fff1e6;
  color: var(--brand-dark);
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar,
.section-head,
.panel-head,
.modal-head,
menu {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar {
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

p {
  color: var(--muted);
}

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

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
}

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

.primary-btn:hover {
  background: var(--brand-dark);
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: #fff7ed;
  font-size: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid,
.content-grid,
.cards-grid,
.performance-grid,
.ranking-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 16px;
}

.metric-card,
.panel,
.customer-card,
.perf-card,
.rank-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 28px;
}

.content-grid {
  grid-template-columns: 2fr 1fr;
}

.panel {
  padding: 18px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

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

.stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf5;
  min-height: 96px;
}

.stage strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}

.stage span {
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border-left: 4px solid var(--accent);
  background: #fff7ed;
  padding: 10px 12px;
  border-radius: 6px;
}

.list-item strong {
  display: block;
}

.list-item span {
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  background: #fffaf5;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #fff1e6;
  color: var(--brand-dark);
}

.status.due {
  background: #fff1e5;
  color: #9a5b0a;
}

.status.late {
  background: #fff0ee;
  color: var(--danger);
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.customer-card,
.perf-card,
.rank-card {
  padding: 16px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff7ed;
  font-size: 12px;
  text-decoration: none;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.progress {
  height: 10px;
  background: #fff1e6;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.performance-grid,
.ranking-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.rank-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 8px;
  font-weight: 800;
}

dialog {
  width: min(680px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(23, 33, 43, .25);
}

dialog::backdrop {
  background: rgba(16, 32, 45, .55);
}

#recordForm {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-note {
  margin: 0;
  font-size: 13px;
}

menu {
  padding: 18px 0 0;
  margin: 0;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-item {
    text-align: center;
    padding: 10px 6px;
  }

  .metric-grid,
  .content-grid,
  .pipeline,
  .cards-grid,
  .performance-grid,
  .ranking-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions button,
  .section-head button {
    width: 100%;
  }

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


.lower-head { margin-top: 22px; }
.target-pair {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--ink);
  font-size: 14px;
}
.crown {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff4cc;
  color: #8a5a00;
  font-size: 12px;
}
.cheer {
  margin-top: 4px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}
.muted-rank { background: #f0dcc9; color: var(--brand-dark); }
.main-rank { border-color: #fed7aa; }


.pep-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  box-shadow: var(--shadow);
}
.pep-panel span {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}
.pep-panel strong {
  font-size: 16px;
  line-height: 1.45;
}

