:root {
  --ink: #173e37;
  --green: #176451;
  --paper: #f3f4ee;
  --line: #dce3da;
  --muted: #728078;
  --sage: #e6ece3;
  --gold: #c48b1c;
  --gold-bright: #e9bc66;
  --gold-bg: #fdf6e3;
  --gold-line: #ead29c;
  --lime: #558420;
  --lime-bright: #8cc23c;
  --lime-bg: #f1f7e6;
  --lime-line: #c5dda0;
  --danger: #ae4938;
  --danger-bg: #fdf5f3;
  --danger-line: #ebc2ba;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

[v-cloak] {
  display: none;
}

header {
  height: 76px;
  padding: 0 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-family: 'Songti SC', 'SimSun', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.brand span {
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  font-weight: 400;
  border-left: 1px solid var(--line);
  margin-left: 16px;
  padding-left: 16px;
}

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

header small,
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

h1 {
  font-size: 30px;
  letter-spacing: -0.5px;
  margin: 10px 0 8px;
}

h2 {
  font-size: 19px;
  margin: 0;
}

p {
  line-height: 1.7;
}

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

button {
  cursor: pointer;
  background: var(--green);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 18px;
  transition: 0.18s ease;
}

button:hover:not(:disabled) {
  filter: brightness(0.94);
}

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

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

button.secondary:hover:not(:disabled) {
  background: #fafbf8;
  filter: none;
}

button.text {
  background: none;
  color: var(--green);
  padding: 6px 8px;
  border: none;
}

button.text:hover:not(:disabled) {
  text-decoration: underline;
  filter: none;
}

.danger {
  color: var(--danger) !important;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd7cd;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #b0cbbd;
  border-color: var(--green);
}

label {
  display: block;
  margin: 14px 0;
  line-height: 1.8;
}

label input,
label select,
label textarea {
  margin-top: 5px;
}

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

/* 员工投票页 */
.vote-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.vote-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.vote-intro {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ticket {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  padding: 28px;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(23, 62, 55, 0.05);
}

.section-block + .section-block {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fruit-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.fruit-badge.gold {
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
}

.fruit-badge.lime {
  background: var(--lime-bg);
  border: 1px solid var(--lime-line);
}

.section-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.pill-selected {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-selected.gold {
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
  color: #8a5d07;
}

.pill-selected.lime {
  background: var(--lime-bg);
  border: 1px solid var(--lime-line);
  color: #3f6415;
}

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

.cand-btn {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  text-align: left;
  transition: all 0.15s ease;
}

.cand-btn:hover:not(:disabled) {
  border-color: var(--green);
  background: #f8faf6;
  filter: none;
}

.cand-btn .cand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cand-btn .cand-name {
  font-weight: 600;
  font-size: 14px;
}

.cand-btn .cand-role {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cand-btn.selected-gold {
  background: var(--gold-bg);
  border-color: var(--gold);
  color: #6b4706;
  box-shadow: 0 0 0 2px rgba(233, 188, 102, 0.35);
}

.cand-btn.selected-lime {
  background: var(--lime-bg);
  border-color: var(--lime);
  color: #365710;
  box-shadow: 0 0 0 2px rgba(140, 194, 60, 0.32);
}

.cand-btn:disabled {
  opacity: 0.44;
  background: #f5f6f3;
  cursor: not-allowed;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.char-count {
  font-weight: 400;
  color: var(--muted);
}

.voter-box {
  background: #f7f9f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.voter-box .voter-title {
  font-weight: 600;
  font-size: 14px;
}

.voter-box .voter-tip {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 10px;
}

.alert-error {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 7px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.submit-btn {
  width: 100%;
  margin-top: 18px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
}

.receipt-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.receipt-card {
  border-radius: 8px;
  padding: 14px;
}

.receipt-card.gold {
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
}

.receipt-card.lime {
  background: var(--lime-bg);
  border: 1px solid var(--lime-line);
}

.receipt-card .r-label {
  font-size: 12px;
  font-weight: 600;
}

.receipt-card.gold .r-label {
  color: #8a5d07;
}

.receipt-card.lime .r-label {
  color: #3f6415;
}

.receipt-card .r-name {
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0;
}

.receipt-card .r-reason {
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
  word-break: break-word;
}

/* 登录页 */
.login {
  max-width: 440px;
  margin: 42px auto;
  padding: 0 20px;
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  margin-top: 20px;
}

.login-card form button {
  width: 100%;
  margin-top: 8px;
}

/* 老板管理后台 */
.layout {
  display: grid;
  grid-template-columns: 215px 1fr;
  min-height: calc(100vh - 76px);
}

aside {
  padding: 32px 18px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

aside .eyebrow {
  padding: 0 12px 12px;
}

aside button {
  text-align: left;
  background: none;
  color: var(--muted);
  font-weight: 500;
}

aside button.active {
  background: var(--ink);
  color: #fff;
}

aside button:hover:not(.active) {
  background: #eaece5;
  color: var(--ink);
  filter: none;
}

.logout {
  margin-top: auto;
}

main.admin-main {
  padding: 34px 40px;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.heading h1 {
  margin: 6px 0 0;
}

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

.toolbar select {
  width: auto;
  min-width: 170px;
  padding: 9px 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--sage);
  padding: 20px;
  border-top: 2px solid var(--green);
}

.stat-card.gold {
  background: #f5efe0;
  border-top-color: var(--gold);
}

.stat-card.lime {
  background: #eaf1e0;
  border-top-color: var(--lime);
}

.stat-card b {
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1.1;
  display: block;
}

.stat-card b small {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 22px;
  margin-bottom: 20px;
}

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

.status-split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.status-box {
  border-radius: 8px;
  padding: 14px 16px;
}

.status-box.unvoted {
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
}

.status-box.voted {
  background: #f3f7f2;
  border: 1px solid var(--line);
}

.status-box-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.status-box.unvoted .status-box-title {
  color: var(--danger);
}

.status-box.voted .status-box-title {
  color: var(--green);
}

.name-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.name-chip {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  background: #fff;
  border: 1px solid var(--line);
}

.status-box.unvoted .name-chip {
  border-color: var(--danger-line);
  color: #8a3527;
  font-weight: 600;
}

.tag {
  display: inline-block;
  font-size: 12px;
  background: #e7f0e7;
  color: var(--green);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag.closed {
  background: #eceee9;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  padding: 12px;
  background: #f7f9f5;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf0eb;
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr:hover {
  background: #fafbf8;
}

.bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}

.bar-num {
  font-family: Georgia, serif;
  font-weight: 700;
  width: 22px;
}

.bar-track {
  flex: 1;
  max-width: 120px;
  height: 8px;
  border-radius: 999px;
  background: #eff2eb;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.bar-fill.gold {
  background: var(--gold-bright);
}

.bar-fill.lime {
  background: var(--lime-bright);
}

/* 明细筛选与卡片 */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.filter-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}

.filter-left input {
  max-width: 280px;
}

.seg-pills {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #f7f9f5;
}

.seg-pills button {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 8px 12px;
  font-size: 12px;
  border: none;
}

.seg-pills button.active {
  background: var(--ink);
  color: #fff;
}

.vote-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vote-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px;
  background: #fcfdfb;
}

.vote-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #edf0eb;
}

.vote-card-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.inline-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-add input {
  flex: 1;
  min-width: 150px;
}

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

.demo-banner {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 7px;
  background: #eef4ec;
  border: 1px solid #c9d9c4;
  font-size: 12px;
  color: var(--ink);
}

/* 弹窗 & Toast */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 46, 40, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.dialog {
  background: #fff;
  border-radius: 12px;
  width: 480px;
  max-width: 100%;
  max-height: 92vh;
  overflow: auto;
  padding: 26px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 7px;
  z-index: 30;
  max-width: 90vw;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

@media (max-width: 800px) {
  header {
    height: 64px;
  }

  .brand {
    font-size: 23px;
  }

  .brand span {
    margin-left: 12px;
    padding-left: 12px;
    font-size: 13px;
  }

  header small {
    display: none;
  }

  .vote-shell {
    padding: 20px 14px 44px;
  }

  .ticket {
    padding: 20px 16px;
  }

  .cand-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .receipt-pair,
  .status-split,
  .vote-card-pair {
    grid-template-columns: 1fr;
  }

  .layout {
    display: block;
  }

  aside {
    padding: 10px 14px;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  aside .eyebrow {
    display: none;
  }

  aside button {
    white-space: nowrap;
    padding: 9px 12px;
    font-size: 13px;
  }

  .logout {
    margin-top: 0;
    margin-left: auto;
  }

  main.admin-main {
    padding: 20px 14px 40px;
  }

  .heading h1 {
    font-size: 24px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card b {
    font-size: 26px;
  }

  .panel {
    padding: 16px;
  }

  .filter-left input {
    max-width: none;
  }
}
