:root {
  --bg: #eef4f3;
  --panel: #ffffff;
  --text: #102027;
  --muted: #667782;
  --line: #dce5e8;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --accent: #c2410c;
  --soft: #f7faf9;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8f7f4 0%, #f8fafc 52%, #fff7ed 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-card {
  width: 480px;
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}

.login-brand h1 {
  margin: 0;
  font-size: 30px;
}

.login-brand p,
.page-head p,
.panel-head span,
.topbar span,
.login-tip {
  color: var(--muted);
}

.login-form {
  margin-top: 38px;
  display: grid;
  gap: 20px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #40535d;
  font-size: 14px;
}

.login-form input,
.filter-row input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--soft);
  outline: none;
}

.login-form button,
.filter-row button,
.ghost-btn {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.login-tip {
  margin: 22px 0 0;
  font-size: 13px;
}

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

.sidebar {
  background: #15222b;
  color: #d9e5e8;
  padding: 26px 20px;
}

.sidebar-brand {
  margin-bottom: 34px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar button {
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  text-align: left;
}

.sidebar button.active {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: 72px 1fr;
  min-width: 0;
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-identity {
  display: grid;
  gap: 5px;
}

.account-menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.avatar-button {
  width: 44px;
  height: 44px;
  border: 1px solid #cfe3df;
  border-radius: 50%;
  background: #eef6f5;
  color: var(--brand-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.avatar-button:hover {
  border-color: #9fc9c1;
  background: #e5f3f0;
}

.avatar-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.account-menu-popover {
  position: absolute;
  top: 54px;
  right: 0;
  z-index: 20;
  width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.account-menu-profile {
  display: grid;
  gap: 4px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-menu-profile strong {
  font-size: 14px;
}

.account-menu-profile span {
  color: var(--muted);
  font-size: 12px;
}

.link-button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  padding: 0 10px;
}

.link-button:hover {
  background: #eef6f5;
}

.ghost-btn {
  background: #eef6f5;
  color: var(--brand-dark);
  border: 1px solid #cfe3df;
  padding: 0 18px;
}

.content {
  padding: 34px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-head h2,
.panel h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.page-head p {
  margin: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.metric-card {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.metric-card span,
.metric-card em,
td small {
  color: var(--muted);
  font-style: normal;
}

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

.panel {
  padding: 24px;
}

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

.panel-head h3 {
  margin: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.pagination div {
  display: flex;
  gap: 8px;
}

.pagination button {
  height: 34px;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  background: #eef6f5;
  color: var(--brand-dark);
  padding: 0 12px;
  cursor: pointer;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

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

th {
  color: #52656e;
  font-size: 13px;
  background: #f8fafc;
}

td strong,
td small {
  display: block;
}

.status-pill {
  display: inline-flex;
  height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 13px;
}

.table-action {
  min-width: 64px;
  height: 32px;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.table-action.danger {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-clip {
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.filter-row {
  display: flex;
  gap: 12px;
}

.filter-row input {
  width: 320px;
}

.filter-row.wide input {
  width: 360px;
}

.filter-row select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.filter-row button {
  padding: 0 22px;
}

.wide-table-panel > .filter-row {
  margin-bottom: 16px;
}

.subnav {
  display: flex;
  gap: 8px;
  margin: -4px 0 18px;
  border-bottom: 1px solid var(--line);
}

.subnav button {
  height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #52656e;
  cursor: pointer;
  font-weight: 700;
  padding: 0 18px;
}

.subnav button.active {
  border-bottom-color: var(--brand);
  color: var(--text);
}

.wide-table-panel {
  overflow-x: auto;
}

.wide-table-panel table {
  min-width: 1040px;
}

.operation-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 140px minmax(180px, 1fr) minmax(150px, 0.8fr) 120px;
  gap: 12px;
  align-items: end;
}

.operation-form label {
  display: grid;
  gap: 8px;
  color: #40535d;
  font-size: 13px;
}

.operation-form input,
.operation-form select,
.redeem-row-actions input,
.account-row-actions input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.operation-form button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(16, 32, 39, 0.28);
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.channel-edit-modal {
  width: min(720px, 100%);
}

.channel-edit-modal.large,
.channel-detail-modal {
  width: min(860px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--line);
}

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

.modal-head span {
  color: var(--muted);
}

.modal-error {
  margin: 18px 24px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 13px;
}

.modal-close-btn {
  height: 34px;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  background: #eef6f5;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
  padding: 0 12px;
}

.modal-body {
  padding: 20px 24px 24px;
}

.password-change-form {
  grid-template-columns: 1fr;
  padding: 20px 24px 24px;
}

.password-change-form input {
  height: 44px;
}

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

.operation-form .modal-actions button {
  width: auto;
  min-width: 110px;
  padding: 0 18px;
}

.operation-form .modal-actions .link-button {
  background: #f8fafc;
  color: var(--brand-dark);
  border: 1px solid #cfe3df;
}

.channel-modal-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 20px 24px 24px;
}

.modal-body .channel-modal-form {
  padding: 0;
}

.channel-modal-form .modal-actions {
  grid-column: 1 / -1;
}

.detail-modal-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 20px 24px 24px;
}

.generation-result {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.generation-result > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  margin-bottom: 12px;
}

.generation-result table {
  min-width: 640px;
}

.modal-card > .generation-result {
  margin: 0 24px 24px;
}

.audit-filter-row {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.account-user-search,
.partner-user-search {
  margin-bottom: 14px;
}

.account-user-results,
.partner-user-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.account-user-results button,
.partner-user-results button,
.selected-account-user,
.selected-partner-user {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.account-user-results button,
.partner-user-results button {
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}

.account-user-results button.selected,
.partner-user-results button.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 105, 185, 0.12);
}

.account-user-results span,
.account-user-results em,
.partner-user-results span,
.partner-user-results em,
.selected-account-user span,
.selected-account-user em,
.selected-partner-user span,
.selected-partner-user em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.selected-account-user,
.selected-partner-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.account-row-actions {
  min-width: 252px;
}

.account-row-actions input {
  width: 108px;
}

.redeem-row-actions {
  min-width: 246px;
}

.redeem-row-actions input {
  width: 96px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}

.detail-main {
  grid-row: span 2;
}

.followup-panel {
  grid-column: 1 / -1;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-grid.single {
  grid-template-columns: 1fr;
}

.info-item {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

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

.info-item strong {
  font-size: 16px;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.followup-form {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.followup-form textarea {
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
  outline: none;
  font: inherit;
}

.followup-form div {
  display: grid;
  grid-template-columns: 160px 220px auto;
  gap: 12px;
  align-items: center;
}

.followup-form select,
.followup-form input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  font: inherit;
}

.followup-form button {
  width: 120px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.timeline-item div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.timeline-item span,
.timeline-item small {
  color: var(--muted);
}

.timeline-item p {
  margin: 0 0 10px;
  line-height: 1.7;
}

.empty-panel {
  min-height: 360px;
  display: grid;
  place-content: center;
  text-align: center;
}
