/* ============ Reset ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 主题色 */
  --brand: #32c86f;
  --brand-dark: #28a95c;
  --brand-light: #e9f9ef;
  --brand-lighter: #f3fcf7;
  --brand-border: #c6efd6;

  /* 中性色 */
  --bg: #f7f8f9;
  --surface: #ffffff;
  --border: #ebedef;
  --border-strong: #dcdfe3;

  --text: #1a1d1f;
  --text-secondary: #5c6369;
  --text-muted: #9099a1;

  /* 语义色 */
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

a { color: var(--text); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand); }

/* ============ 顶栏 ============ */
.masked {
  color: var(--text-muted);
  letter-spacing: 3px;
  font-weight: 500;
  user-select: none;
  cursor: help;
}

.nav {
  height: 64px;
  padding: 0 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav > span:first-child {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav > span:first-child::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.nav > span:last-child {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav a { color: var(--text-secondary); font-weight: 500; }
.nav a:hover { color: var(--brand); }

/* ============ 容器 ============ */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.25;
  color: #32c86f;
  margin-bottom: 20px;
}

h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ============ 按钮 ============ */
.btn,
.toolbar button,
form button {
  display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0px 30px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.backbtn{
    background: #32c86f;
    color: #fff;
    border-radius: 5px;
    height: 36px;
    line-height: 36px;
    padding: 0px 30px;
    display: inline-block;
    margin-top: 12px;
    margin-right: 8px;
    font-size: 15px;
    font-weight: 600;
}
.btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: 5px;
    font-size: 15px;
    font-weight: 700;
    /* letter-spacing: 2px; */
    font-family: inherit;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn:hover,
.toolbar button:hover,
form button:hover,
.backbtn:hover{
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
  box-shadow: 0 2px 8px rgba(50,200,111,.25);
}

.btn-gray {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-gray:hover {
  background: var(--bg);
  border-color: var(--text-muted);
  color: var(--text);
  box-shadow: none;
}

/* ============ 卡片 ============ */
.card {
  background: #32c86f1a;
  border: 1px solid #32c86f1a;
  border-radius: var(--radius);
  padding: 32px;
}

/* ============ 表单 ============ */
/*.form { max-width: 560px; }*/

.form label {
  display: block;
  margin-bottom: 20px;
  font-size: 14px;
    font-weight: 600;
  color: var(--text-secondary);
}

.form input,
.form select,
.form textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  margin-top: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.form textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.form button { margin-top: 12px; margin-right: 8px; }

/* ============ 工具栏 ============ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.toolbar form {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 420px;
}

.toolbar input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.toolbar input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.toolbar button { 
    height: 36px;
    border-radius: 5px;
}

/* ============ 表格 ============ */
table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.05);
}

th, td {
  padding: 14px 20px;
  text-align: left;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

th {
  background: #32c86f;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--brand-lighter); }
tbody tr:last-child td { border-bottom: none; }

.price {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ============ 状态标签 ============ */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-draft   { background: #f4f5f6; color: #6b7280; border-color: #e8eaec; }
.status-sent    { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.status-deal    { background: var(--brand-light); color: #1e8f4c; border-color: var(--brand-border); }
.status-expired { background: #fef2f2; color: #b91c1c; border-color: #fee2e2; }
.status-cancelled {
  background: #f4f5f6;
  color: #a3a3a3;
  border-color: #e8eaec;
  text-decoration: line-through;
}

/* 日志动作标签 */
.status-create { background: var(--brand-light); color: #1e8f4c; border-color: var(--brand-border); }
.status-update { background: #fffbeb; color: #a16207; border-color: #fef3c7; }
.status-cancel { background: #fef2f2; color: #b91c1c; border-color: #fee2e2; }
.status-view   { background: #f4f5f6; color: #525252; border-color: #e8eaec; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  background: rgb(255 0 0);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ============ 提醒条 ============ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: #fafafa;
  border: 1px solid #fafafa;
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.1);
  border-left: 3px solid #32c86f;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  font-size: 15px;
  color: #565656;
  line-height: 1.5;
}
.alert b{
    color: #262626;
}
/* ============ 状态下拉框 ============ */
.status-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.status-select:hover { border-color: var(--brand); }
.status-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.status-select:disabled { opacity: .5; cursor: wait; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 80px;
  right: 48px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  animation: toastInOut 2s ease;
}

@keyframes toastInOut {
  0%   { opacity: 0; transform: translateY(-8px); }
  15%  { opacity: 1; transform: translateY(0); }
  85%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* ============ 文字辅助 ============ */
.muted {
  color: #848484;
    font-size: 16px;
    font-weight: 600;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
}

td a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color .15s;
}
td a:hover { color: var(--brand); }

/* ============ 登录页 ============ */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}

.login-page .card {
  width: 400px;
  padding: 48px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 24px rgba(0,0,0,.04);
}

.login-page h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-align: center;
  margin-bottom: 32px;
  color: var(--text);
}

.login-page input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.login-page input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.login-page button {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  font-size: 14px;
}

/* ============ 统计卡片 ============ */
.stat-grid {
  /*display: grid;*/
  /*grid-template-columns: repeat(3, 1fr);*/
  /*gap: 16px;*/
  display: flex;
    justify-content: space-between;
  margin-bottom: 32px;
}
.recent-card {
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  min-height: 200px;
  gap: 0;                 /* 覆盖 .stat-card 的 gap */
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.recent-header .stat-label {
  margin-bottom: 0;
  font-weight: 600;
  font-size: 17px;
}

.recent-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.recent-list {
  flex: 1;
  overflow-y: auto;
  max-height: 120px;
  margin: 0 -8px;
  padding: 0 8px;
  display: flex;
    flex-wrap: wrap;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  transition: background .12s;
  color: var(--text);
  text-decoration: none;
  width: 32%;
    background: var(--brand-lighter);
    margin-right: 2%;
    margin-bottom: 2%;
}
.recent-item:nth-child(3n){
    margin-right: 0;
}
.recent-item:hover {
  background: var(--brand-lighter);
  color: var(--text);
}

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

.recent-company {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.recent-meta {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-right {
  text-align: right;
  flex-shrink: 0;
}

.recent-amount {
  font-size: 17px;
    font-weight: 600;
    color: #ff0000;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.recent-time {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.recent-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 140px;
}

/* 滚动条 */
.recent-list::-webkit-scrollbar { width: 6px; }
.recent-list::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 3px;
}
.recent-list::-webkit-scrollbar-thumb:hover { background: #c0c0c0; }

/* 小屏堆叠 */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: column; align-items: stretch; gap: 20px; }
}
.stat-card {
    width: 73%;
  background: var(--surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: 15px;
  transition: border-color .15s;
}

.stat-card:hover { border-color: var(--brand-border); }
.stat-grid .stat-card:first-child{
    width: 25%;
    display: flex;
    flex-wrap: wrap;
}
.stat-grid .stat-card:first-child .stat-card-item{
    width: 48%;
    margin-bottom: 25px;
}
.stat-grid .stat-card:first-child .stat-card-item:last-child{
    margin-bottom: 0;
}
.stat-label {
  font-size: 15px;
    font-weight: 600;
    color: #32c86f;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-value.accent { color: #ff0000; }

@media (max-width: 900px) {
  .container { padding: 24px 20px 60px; }
  .nav { padding: 0 20px; }
  .stat-grid { grid-template-columns: 1fr; }
}