:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --ink: #18212f;
  --muted: #6b7480;
  --line: #d9dee5;
  --line-soft: #e8ebef;
  --blue: #2266d1;
  --blue-soft: #eaf1ff;
  --green: #168a52;
  --green-soft: #e8f6ef;
  --amber: #b35d00;
  --amber-soft: #fff2df;
  --red: #c0343d;
  --red-soft: #fff0f1;
  --teal: #087d87;
  --teal-soft: #e5f7f8;
  --shadow: 0 12px 34px rgba(24, 33, 47, .08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

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

.brand-title {
  font-size: 20px;
  font-weight: 750;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.feishu-button, .primary-button, .secondary-button, .ghost-button, .danger-button {
  height: 38px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.feishu-button, .primary-button {
  background: var(--blue);
  color: #fff;
}

.login-link {
  width: 100%;
  text-decoration: none;
}

.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.6;
}

.password-login {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-soft);
}

.password-login input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.password-login input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.password-login button {
  width: 100%;
}

.oauth-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  word-break: break-all;
}

.demo-login-box {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.demo-login-box .ghost-button {
  width: 100%;
}

.secondary-button {
  background: var(--green);
  color: #fff;
}

.ghost-button {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #ffd1d5;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: #121a26;
  color: #dbe4ef;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.side-brand .brand-mark {
  width: 34px;
  height: 34px;
  background: #2b73d9;
}

.side-title {
  font-weight: 750;
}

.side-sub {
  font-size: 12px;
  color: #94a3b8;
}

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

.nav-item {
  height: 38px;
  border-radius: 7px;
  padding: 0 10px;
  color: #b8c4d3;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.nav-item.active, .nav-item:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: #aeb9c8;
  font-size: 12px;
  line-height: 1.55;
}

.main {
  min-width: 0;
}

.topbar {
  height: 62px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 18px;
  font-weight: 750;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dfe8f6;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 750;
}

.content {
  padding: 20px 22px 34px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
}

.admin-binding-layout {
  grid-template-columns: minmax(0, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(24,33,47,.03);
}

.panel-head {
  min-height: 52px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 750;
}

.panel-body {
  padding: 16px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.field-label-rich {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label-rich span {
  color: var(--ink);
  font-weight: 750;
}

.field-label-rich small {
  color: var(--muted);
  font-size: 12px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.field input, .field select, .field textarea, .search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  outline: none;
}

.field input, .field select, .search-input {
  height: 38px;
  padding: 0 11px;
}

.field textarea {
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.65;
}

.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(34,102,209,.11);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(460px, 100%);
  flex: 1;
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.tab {
  height: 36px;
  padding: 0 13px;
  background: transparent;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

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

.match-row {
  display: grid;
  grid-template-columns: 96px 54px minmax(0, 1fr) 150px 132px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.match-row.priority {
  border-color: #f6c56d;
  background: #fffaf1;
}

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

.team-logos {
  width: 54px;
  height: 34px;
  display: flex;
  align-items: center;
  position: relative;
}

.team-logos img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line-soft);
}

.team-logos img + img {
  margin-left: -8px;
}

.teams {
  min-width: 0;
}

.league {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.versus {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid transparent;
}

.badge.blue {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cbdcff;
}

.badge.green {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c6ead9;
}

.badge.amber {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ffd9a6;
}

.badge.red {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd1d5;
}

.badge.teal {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #bde9ed;
}

.metric-card {
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  margin-top: 8px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
}

.odds-grid {
  display: grid;
  gap: 12px;
}

.odds-group {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.odds-group-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 750;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.odds-options {
  display: grid;
  gap: 8px;
}

.rule-tip {
  margin: -2px 0 8px;
  border: 1px solid #cbdcff;
  background: var(--blue-soft);
  color: #1f4f9b;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.55;
}

.data-source-tip {
  margin: 0 0 14px;
}

.odds-meta {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.style-picker.compact {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px;
}

.style-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.style-chip b {
  display: block;
  font-size: 13px;
}

.style-chip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 3px;
}

.style-chip.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.odds-option {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.odds-option span {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.odds-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.odds-option.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.odds-group.disabled {
  background: #f6f7f9;
}

.odds-option.disabled,
.odds-option:disabled {
  opacity: .62;
  cursor: not-allowed;
  background: #f3f4f6;
}

.article-title-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 44px;
  padding: 0 13px;
  font-weight: 750;
  outline: none;
}

.article-editor {
  width: 100%;
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  line-height: 1.8;
  outline: none;
  resize: vertical;
}

.publish-fields {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.publish-payload-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.publish-payload-bar span {
  min-height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 12px;
}

.publish-payload-bar b {
  color: var(--ink);
}

.article-editor.small {
  min-height: 118px;
}

.article-editor.medium {
  min-height: 210px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th, .audit-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: var(--muted);
  font-weight: 700;
  background: var(--panel-soft);
}

.table-input {
  width: 180px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 250px;
}

.table-actions .ghost-button,
.table-actions .secondary-button,
.table-actions .danger-button {
  height: 32px;
  padding: 0 10px;
}

.table-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(34,102,209,.11);
}

.compact-table {
  font-size: 12px;
}

.compact-table th, .compact-table td {
  padding: 8px 7px;
  white-space: nowrap;
}

.diff-box {
  display: grid;
  gap: 10px;
}

.diff-line {
  border-left: 3px solid var(--line);
  padding: 9px 10px;
  background: var(--panel-soft);
  font-size: 13px;
  line-height: 1.65;
}

.diff-line.add {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.diff-line.edit {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #121a26;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 100;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px;
  }

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

  .sidebar-footer {
    display: none;
  }

  .grid.two, .grid.three, .editor-layout {
    grid-template-columns: 1fr;
  }

  .match-row {
    grid-template-columns: 78px 54px minmax(0, 1fr);
  }

  .match-row > .badges, .match-row > .button-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 62px;
    align-items: flex-start;
    padding: 12px;
    gap: 10px;
    flex-direction: column;
  }

  .content {
    padding: 14px 12px 24px;
  }

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

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