:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --surface-blue: #edf5ff;
  --text: #192434;
  --muted: #7b8493;
  --faint: #a8b0bd;
  --line: #e9edf3;
  --green: #13ae67;
  --green-dark: #079455;
  --blue: #075ba8;
  --blue-deep: #064f97;
  --blue-bright: #12a9df;
  --amber: #f5a524;
  --red: #ee4d4f;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(7, 40, 86, 0.07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

body {
  width: 100%;
  overflow-x: hidden;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

input,
textarea,
select {
  font-size: 16px;
}

button,
a,
label,
select {
  touch-action: manipulation;
}

img,
svg {
  max-width: 100%;
}

button {
  border: 0;
}

.app {
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: 72px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0, rgba(244, 247, 251, 0) 156px),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  padding: calc(15px + env(safe-area-inset-top)) 15px 13px;
  border-bottom: 1px solid rgba(233, 237, 243, 0.72);
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(7, 40, 86, 0.08);
}

.title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bell-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f6f8fb;
  color: var(--text);
}

.bell-button span {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--red);
  border: 1px solid #fff;
  color: #fff;
  font-size: 9px;
  line-height: 13px;
  text-align: center;
  font-weight: 760;
}

.bell-button span:empty {
  width: 7px;
  min-width: 7px;
  height: 7px;
  top: 7px;
  right: 7px;
}

.bell-button svg {
  width: 19px;
  height: 19px;
}

.toast-popup {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(86vw, 360px);
  padding: 12px 15px;
  border-radius: 8px;
  background: rgba(25, 36, 52, 0.95);
  color: #fff;
  box-shadow: 0 16px 40px rgba(7, 40, 86, 0.2);
  transform: translateX(-50%);
  animation: toast-in 0.18s ease-out;
}

.toast-popup.error {
  background: rgba(132, 31, 34, 0.96);
}

.toast-popup.leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-popup span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #71e5a6;
}

.toast-popup.error span {
  color: #ffd3d3;
}

.toast-popup svg {
  width: 20px;
  height: 20px;
}

.toast-popup strong {
  font-size: 14px;
  font-weight: 760;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%);
  }
}

.identity {
  display: none;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.identity strong {
  min-width: 0;
  max-width: 132px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity select {
  max-width: 126px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
}

.screen {
  width: 100%;
  padding: 14px 14px 24px;
  max-width: 560px;
  margin: 0 auto;
  overflow-x: hidden;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.plain-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section {
  min-width: 0;
  margin-top: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
}

.section-head > * {
  min-width: 0;
}

.section-title {
  min-width: 0;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: #697386;
  padding: 6px 0;
  font-size: 14px;
  min-width: 0;
}

.hero-ledger {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 22px 18px 21px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0 12%, transparent 12% 100%) right 0 top 0 / 192px 100% no-repeat,
    linear-gradient(135deg, transparent 0 48%, rgba(18, 169, 223, 0.58) 48% 61%, rgba(255, 255, 255, 0.18) 61% 70%, rgba(18, 169, 223, 0.5) 70% 84%, transparent 84% 100%) right 0 bottom 0 / 230px 100% no-repeat,
    linear-gradient(135deg, #0865bd 0%, #075ba8 45%, #064d92 100%);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(6, 79, 151, 0.21);
}

.hero-row {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  min-height: 104px;
  gap: 0;
  align-items: stretch;
}

.metric-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 760;
}

.metric-value {
  margin-top: 12px;
  font-size: 58px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.metric-value span {
  margin-left: 7px;
  font-size: 20px;
  font-weight: 750;
}

.score-delta {
  display: inline-flex;
  align-items: center;
  margin-top: 17px;
  border-radius: 999px;
  background: #ffffff;
  color: #4b5565;
  padding: 5px 12px;
  font-size: 13px;
  box-shadow: 0 5px 13px rgba(2, 36, 78, 0.09);
}

.score-delta strong {
  color: var(--green-dark);
  margin-left: 5px;
}

.hero-rank {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.mini-stat {
  display: grid;
  align-content: center;
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  padding: 4px 0 4px 24px;
}

.mini-stat:last-child {
  border-right: 0;
}

.mini-stat strong {
  display: block;
  margin-top: 15px;
  color: #ffffff;
  font-size: 21px;
  line-height: 1;
  font-weight: 820;
  white-space: nowrap;
}

.mini-stat em {
  display: block;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-style: normal;
}

.mini-stat .metric-label {
  font-size: 14px;
  font-weight: 720;
}

.value-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  scrollbar-width: none;
}

.value-strip::-webkit-scrollbar {
  display: none;
}

.profile-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e8f7ef;
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 780;
}

.profile-name {
  font-size: 20px;
  font-weight: 760;
}

.profile-copy {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.outline-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  border: 1px solid rgba(7, 91, 168, 0.3);
  border-radius: var(--radius);
  color: var(--blue);
  background: var(--surface);
  padding: 8px 10px;
  white-space: nowrap;
}

.category-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.value-panel,
.action-panel {
  padding: 18px 0 16px;
}

.value-panel .section-head,
.action-panel .section-head {
  padding: 0 18px;
  margin-bottom: 12px;
}

.category-cell {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 12px 8px 10px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: center;
}

.category-cell:last-child {
  border-right: 0;
}

.category-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #eef5ff;
  color: var(--blue);
}

.category-cell:nth-child(2) .category-icon {
  background: #eef8f3;
  color: var(--green-dark);
}

.category-cell:nth-child(3) .category-icon {
  background: #fff7e6;
  color: var(--amber);
}

.category-cell:nth-child(4) .category-icon {
  background: #f5f0ff;
  color: #7c3aed;
}

.category-cell svg {
  width: 19px;
  height: 19px;
}

.category-name {
  max-width: 100%;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-points {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 820;
}

.category-split {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.progress {
  width: 42px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue-bright);
}

.chip {
  flex: 0 0 auto;
  border: 1px solid #d9ebe2;
  background: #f7fbf8;
  color: #28624a;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.quick-action {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 82px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 4px 3px;
}

.quick-action:last-child {
  border-right: 0;
}

.quick-action i,
.quick-action svg,
.icon-button i,
.icon-button svg,
.button i,
.button svg,
.nav-item i,
.nav-item svg,
.row-icon i,
.row-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.9;
}

.quick-action svg {
  width: 23px;
  height: 23px;
  color: var(--blue);
}

.quick-action span {
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.quick-action em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.list {
  overflow: hidden;
}

.home-ledger-list {
  background: var(--surface);
}

.ledger-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 14px;
  border-bottom: 1px solid var(--line);
}

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

.ledger-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--blue);
  background: #edf5ff;
}

.ledger-icon svg {
  width: 19px;
  height: 19px;
}

.ledger-deduct .ledger-icon {
  color: var(--red);
  background: #fff1f2;
}

.ledger-main {
  min-width: 0;
}

.ledger-main .row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-side {
  display: grid;
  justify-items: end;
  gap: 7px;
  white-space: nowrap;
}

.ledger-chevron {
  color: var(--faint);
}

.ledger-chevron svg {
  width: 16px;
  height: 16px;
}

.category-tag {
  color: var(--blue);
  background: var(--surface-blue);
  border-radius: 999px;
  padding: 2px 7px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.row-title {
  font-weight: 650;
  line-height: 1.35;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.points {
  font-weight: 760;
  white-space: nowrap;
}

.points.add {
  color: var(--green-dark);
}

.points.deduct {
  color: var(--red);
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 1.1;
  background: #eef2f7;
  color: #526070;
}

.status.pending,
.status.open,
.status.processing {
  background: #fff7e6;
  color: #9a5b00;
}

.status.approved,
.status.enabled,
.status.resolved {
  background: #eaf8f0;
  color: #067647;
}

.status.rejected,
.status.disabled {
  background: #fff1f2;
  color: #b42318;
}

.empty,
.loading,
.error {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--red);
}

.toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.segmented {
  display: flex;
  gap: 6px;
  background: #eef1f3;
  padding: 4px;
  border-radius: var(--radius);
}

.segment {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 5px rgba(17, 24, 39, 0.08);
}

.form {
  display: grid;
  min-width: 0;
  gap: 14px;
}

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

.type-choice {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 16px 14px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(7, 40, 86, 0.04);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.type-choice::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -22px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(18, 169, 223, 0.08);
}

.type-choice:hover {
  border-color: rgba(7, 91, 168, 0.22);
  box-shadow: 0 8px 22px rgba(7, 40, 86, 0.08);
  transform: translateY(-1px);
}

.type-choice svg {
  width: 26px;
  height: 26px;
  color: var(--blue);
  position: relative;
  z-index: 1;
}

.type-choice span {
  font-size: 18px;
  font-weight: 840;
  position: relative;
  z-index: 1;
}

.type-choice em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  position: relative;
  z-index: 1;
}

.type-choice.deduct svg {
  color: var(--red);
}

.type-choice.active {
  border-color: transparent;
  background:
    linear-gradient(135deg, rgba(18, 169, 223, 0.96), rgba(7, 91, 168, 0.98) 45%, rgba(6, 79, 151, 1)),
    var(--blue);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(7, 91, 168, 0.26);
}

.type-choice.active::after {
  background: rgba(255, 255, 255, 0.14);
}

.type-choice.active svg,
.type-choice.active em {
  color: rgba(255, 255, 255, 0.9);
}

.type-choice.deduct.active {
  background:
    linear-gradient(135deg, rgba(18, 169, 223, 0.96), rgba(7, 91, 168, 0.98) 44%, rgba(6, 79, 151, 1)),
    var(--blue);
}

.type-choice.deduct.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #ff6b6e;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field .select + .input {
  margin-top: 8px;
}

.field label {
  font-weight: 680;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.textarea {
  min-height: 94px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 91, 168, 0.12);
}

.upload-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 154px;
  border: 1px dashed #c8d7e8;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.upload-card:hover {
  border-color: rgba(7, 91, 168, 0.42);
  background: #f3f8ff;
  box-shadow: 0 4px 14px rgba(7, 40, 86, 0.06);
}

.upload-card.requires-file {
  border-color: rgba(245, 143, 0, 0.42);
  background: #fffaf0;
}

.upload-card.requires-file .upload-plus {
  background: #fff0d8;
  color: #b86600;
}

.upload-required-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  background: #fff0d8;
  color: #9a5a00;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 780;
}

.upload-card.upload-attention {
  border-color: rgba(214, 62, 62, 0.58);
  background: #fff6f3;
  animation: uploadAttention 0.42s ease;
}

.upload-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-plus {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--surface-blue);
  color: var(--blue);
}

.upload-plus svg {
  width: 22px;
  height: 22px;
}

.upload-card strong {
  font-size: 15px;
  font-weight: 780;
}

.upload-card em {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-card.has-file {
  border-style: solid;
  border-color: rgba(19, 174, 103, 0.32);
  background: #f2fbf6;
}

.upload-card.has-file .upload-plus {
  background: #dff7ea;
  color: var(--green-dark);
}

.upload-card.has-file .upload-required-badge {
  background: #dff7ea;
  color: var(--green-dark);
}

@keyframes uploadAttention {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

.upload-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 260px);
  margin-top: 4px;
}

.upload-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid #dce7f3;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 720;
  cursor: pointer;
}

.upload-action.primary {
  border-color: rgba(7, 91, 168, 0.22);
  background: var(--surface-blue);
  color: var(--blue);
}

.upload-action svg {
  width: 17px;
  height: 17px;
}

.button-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.button-row > * {
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 10px 13px;
  background: var(--blue);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.button.secondary {
  background: var(--surface-blue);
  color: var(--blue);
}

.button.danger {
  background: var(--red);
}

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

.button:disabled {
  opacity: 0.56;
}

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

.rule-picker-card {
  min-width: 0;
  padding: 14px;
}

.rule-picker-card .section-head {
  margin-bottom: 10px;
}

.category-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.category-chip-row::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #526070;
  padding: 6px 11px;
  white-space: nowrap;
}

.category-chip.active {
  border-color: rgba(7, 91, 168, 0.3);
  background: var(--surface-blue);
  color: var(--blue);
  font-weight: 730;
}

.selected-rule-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  border: 1px solid #d7e6f8;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.selected-rule-card > div {
  min-width: 0;
}

.selected-rule-card.empty-rule {
  grid-template-columns: 1fr auto;
  border-style: dashed;
  background: #fbfcfe;
}

.selected-rule-card:hover {
  border-color: rgba(7, 91, 168, 0.34);
  background: #f3f8ff;
  box-shadow: 0 4px 14px rgba(7, 40, 86, 0.06);
}

.rule-card-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-blue);
  color: var(--blue);
}

.rule-card-arrow svg {
  width: 17px;
  height: 17px;
}

.rule-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.rule-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0);
  transition: background 0.16s ease;
}

.rule-sheet.open .rule-sheet-backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.rule-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: 78vh;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  padding: 9px 14px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.18s ease;
  box-shadow: 0 -18px 38px rgba(15, 23, 42, 0.18);
}

.rule-sheet.open .rule-sheet-panel {
  transform: translateY(0);
}

.sheet-grabber {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #d7dde6;
}

.sheet-rule-list {
  max-height: calc(78vh - 148px);
  margin-top: 12px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.icon-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f6f8fb;
  color: var(--text);
}

.rule-option {
  width: 100%;
  min-width: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.rule-option.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 91, 168, 0.1);
}

.rule-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.rule-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.success {
  padding: 18px;
  border: 1px solid #cfe0f6;
  background: #f3f8ff;
  color: #075ba8;
  border-radius: var(--radius);
}

.rulebook-hero,
.rank-campaign {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  padding: 18px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 18%, transparent 18% 100%) right top / 190px 100% no-repeat,
    linear-gradient(135deg, #075ba8, #064f97);
}

.rulebook-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 760;
}

.rulebook-hero h2,
.rank-campaign h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.rulebook-hero p,
.rank-campaign p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.rulebook-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 14px 11px;
  border-bottom: 1px solid var(--line);
}

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

.rulebook-group {
  border-bottom: 1px solid var(--line);
}

.rulebook-group:last-child {
  border-bottom: 0;
}

.rulebook-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 760;
}

.rulebook-group summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.rule-summary-row,
.reward-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.reward-rule-row strong {
  color: var(--green-dark);
  white-space: nowrap;
}

.rule-admin-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rule-admin-overview div {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 10px;
  box-shadow: 0 6px 16px rgba(7, 40, 86, 0.04);
}

.rule-admin-overview span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-admin-overview strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 840;
}

.rule-editor-panel {
  margin-top: 12px;
  overflow: hidden;
}

.rule-editor-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.rule-editor-panel summary::-webkit-details-marker,
.rule-category-group summary::-webkit-details-marker {
  display: none;
}

.rule-editor-panel summary strong,
.rule-editor-panel summary span {
  display: block;
}

.rule-editor-panel summary strong {
  font-size: 15px;
}

.rule-editor-panel summary span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.rule-editor-panel summary i,
.rule-editor-panel summary svg,
.rule-category-group summary i,
.rule-category-group summary svg {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.rule-editor-panel[open] summary i,
.rule-editor-panel[open] summary svg,
.rule-category-group[open] summary i,
.rule-category-group[open] summary svg {
  transform: rotate(180deg);
}

.rule-editor-panel > form {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.rule-admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rule-admin-toolbar .segmented {
  flex: 1;
  min-width: 0;
}

.rule-admin-toolbar .segment {
  flex: 1;
  font-weight: 760;
}

.rule-admin-toolbar > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.rule-status-section {
  display: grid;
  gap: 10px;
}

.rule-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.rule-status-head div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rule-status-head strong {
  font-size: 15px;
}

.rule-status-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rule-category-stack {
  display: grid;
  gap: 9px;
}

.rule-category-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(7, 40, 86, 0.04);
}

.rule-category-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.rule-category-group summary strong,
.rule-category-group summary span {
  display: block;
}

.rule-category-group summary strong {
  font-size: 15px;
}

.rule-category-group summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.rule-admin-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.rule-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.rule-admin-row.disabled {
  background: #fafbfc;
}

.rule-admin-main {
  min-width: 0;
}

.rule-admin-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rule-admin-title strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-admin-main p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rule-admin-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.rule-admin-tags span {
  border-radius: 999px;
  background: #f1f5f9;
  color: #5b6675;
  padding: 3px 7px;
  font-size: 11px;
}

.rule-admin-row.add .rule-admin-tags span:first-child {
  background: #e9f8f0;
  color: var(--green-dark);
}

.rule-admin-row.deduct .rule-admin-tags span:first-child {
  background: #fff1f2;
  color: var(--red);
}

.rule-admin-actions {
  display: grid;
  justify-items: end;
  align-content: space-between;
  gap: 10px;
}

.rule-admin-actions > div {
  display: flex;
  gap: 8px;
}

.rule-admin-actions .link-button {
  gap: 4px;
  min-height: 28px;
  font-size: 12px;
}

.rule-admin-actions svg {
  width: 15px;
  height: 15px;
}

.rule-admin-empty {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.rule-admin-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.value-detail-hero {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.value-detail-score {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 8px;
}

.value-detail-score > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.value-detail-score span {
  color: var(--muted);
  font-size: 12px;
}

.value-detail-score strong {
  font-size: 28px;
  line-height: 1;
}

.value-detail-score em {
  font-size: 20px;
  font-style: normal;
}

.rank-campaign {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
  border: 0;
  background: linear-gradient(135deg, var(--blue-deep) 0%, var(--blue) 58%, #0b75bc 100%);
  color: #ffffff;
  padding: 0;
  box-shadow: 0 14px 34px rgba(7, 91, 168, 0.22);
}

.rank-campaign-main {
  display: grid;
  gap: 9px;
  padding: 18px 18px 14px;
}

.rank-season-label {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 9px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 760;
}

.rank-campaign h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.12;
  font-weight: 880;
}

.rank-campaign p {
  max-width: 420px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.rank-campaign-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.rank-campaign-note svg {
  width: 15px;
  height: 15px;
}

.reward-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
}

.reward-mini-grid div {
  display: grid;
  gap: 4px;
  min-height: 82px;
  background: rgba(255, 255, 255, 0.1);
  padding: 11px 12px;
}

.reward-mini-grid span,
.reward-mini-grid em {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-style: normal;
}

.reward-mini-grid em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-mini-grid strong {
  font-size: 21px;
  line-height: 1;
}

.rank-tabs {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 8px 22px rgba(7, 40, 86, 0.05);
}

.rank-tabs .segment {
  flex: 1;
  font-weight: 760;
}

.rank-tabs .segment.active {
  background: var(--blue);
  color: #ffffff;
  box-shadow: none;
}

.rank-stage {
  display: grid;
  gap: 9px;
}

.rank-leader-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(7, 91, 168, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(7, 91, 168, 0.08), rgba(255, 255, 255, 0) 45%),
    #ffffff;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(7, 40, 86, 0.08);
}

.rank-leader-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-bright), var(--blue), var(--amber));
  content: "";
}

.rank-crown {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
}

.rank-crown svg {
  width: 23px;
  height: 23px;
}

.rank-leader-copy {
  min-width: 0;
}

.rank-leader-copy span,
.rank-leader-copy em,
.rank-leader-copy small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rank-leader-copy strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  line-height: 1.16;
  font-weight: 880;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-leader-copy small {
  margin-top: 5px;
  color: #4f6c8e;
}

.leader-points {
  display: grid;
  justify-items: end;
  min-width: 70px;
}

.leader-points span {
  color: var(--muted);
  font-size: 11px;
}

.leader-points strong {
  color: var(--green-dark);
  font-size: 28px;
  line-height: 1;
  font-weight: 880;
}

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

.rank-chaser-card {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 132px;
  border: 1px solid rgba(7, 91, 168, 0.12);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
  box-shadow: 0 8px 20px rgba(7, 40, 86, 0.05);
}

.rank-chaser-card.rank-2 {
  border-color: rgba(18, 169, 223, 0.3);
  background: #f6fbff;
}

.rank-chaser-card.rank-3 {
  border-color: rgba(245, 165, 36, 0.3);
  background: #fffaf2;
}

.rank-chaser-card.empty {
  border-style: dashed;
  background: #fbfdff;
}

.rank-slot-label {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--blue);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 760;
}

.rank-chaser-card strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 840;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-chaser-card em,
.rank-gap {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rank-chaser-score {
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1;
  font-weight: 880;
}

.rank-slot-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.rank-slot-action svg {
  width: 15px;
  height: 15px;
}

.rank-empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 20px;
}

.rank-empty > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--surface-blue);
  color: var(--blue);
}

.rank-empty p {
  margin: 0;
  color: var(--muted);
}

.notification-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.notification-summary div {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 14px 8px;
  border-right: 1px solid var(--line);
}

.notification-summary div:last-child {
  border-right: 0;
}

.notification-summary span {
  color: var(--muted);
  font-size: 12px;
}

.notification-summary strong {
  font-size: 24px;
  line-height: 1;
}

.notification-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

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

.notification-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef2f7;
  color: #526070;
}

.notification-row.approved .notification-icon {
  background: #eaf8f0;
  color: var(--green-dark);
}

.notification-row.rejected .notification-icon {
  background: #fff1f2;
  color: var(--red);
}

.notification-comment {
  margin-top: 8px;
  border-radius: 8px;
  background: #f8fafc;
  color: #526070;
  padding: 9px 10px;
  font-size: 13px;
}

.ops-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 18px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0 16%, transparent 16% 100%) right top / 190px 100% no-repeat,
    linear-gradient(135deg, #075ba8, #064f97);
}

.ops-hero.manager {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 16%, transparent 16% 100%) right top / 190px 100% no-repeat,
    linear-gradient(135deg, #064f97, #0b6f86);
}

.ops-hero.admin {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 16%, transparent 16% 100%) right top / 190px 100% no-repeat,
    linear-gradient(135deg, #123c69, #075ba8);
}

.ops-hero h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.ops-hero p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.role-personal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px;
}

.role-personal span {
  color: var(--muted);
  font-size: 12px;
}

.role-personal strong {
  display: block;
  margin-top: 3px;
  font-size: 30px;
  line-height: 1;
}

.role-personal strong em {
  margin-left: 4px;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.role-personal p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.role-personal-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}

.role-personal-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  border-radius: 999px;
  background: #f6f8fb;
  color: var(--text);
  padding: 7px 10px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.role-personal-actions svg {
  width: 16px;
  height: 16px;
}

.role-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.role-kpi {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.role-kpi span,
.role-kpi em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.role-kpi strong {
  font-size: 23px;
  line-height: 1;
}

.role-kpi.green strong {
  color: var(--green-dark);
}

.role-kpi.amber strong {
  color: #a15c00;
}

.role-kpi.red strong {
  color: var(--red);
}

.role-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.role-action,
.admin-module {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 14px 12px;
  text-align: left;
  text-decoration: none;
}

.role-action:last-child,
.admin-module:nth-child(3n) {
  border-right: 0;
}

.role-action span,
.admin-module span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-blue);
  color: var(--blue);
}

.role-action strong,
.admin-module strong {
  font-size: 15px;
}

.role-action em,
.admin-module em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.ops-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

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

.board-card {
  padding: 14px;
}

.board-card .section-head {
  margin-bottom: 12px;
}

.board-winner {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.board-winner span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff0c2;
  color: #a15c00;
}

.board-winner strong,
.board-winner em {
  display: block;
}

.board-winner em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.board-winner b {
  color: var(--green-dark);
  font-size: 20px;
}

.manager-dimension-list {
  display: grid;
  gap: 12px;
}

.manager-dimension-list > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.manager-dimension-list span {
  font-size: 13px;
  font-weight: 700;
}

.manager-dimension-list i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.manager-dimension-list b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue-bright);
}

.admin-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.admin-module {
  min-height: 128px;
  border: 0;
}

.admin-module:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.admin-shell .topbar {
  background: rgba(255, 255, 255, 0.98);
}

.admin-shell .identity {
  display: flex;
}

.export-hero {
  padding: 18px;
  border-color: #d7e7fb;
  background: linear-gradient(135deg, #ffffff, #f4f8ff);
}

.export-hero h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.24;
}

.export-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.export-panel {
  padding: 14px;
}

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

.export-range-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.export-range-row .segment {
  border: 1px solid var(--line);
  background: #f8fafc;
}

.export-range-row .segment.active {
  border-color: rgba(7, 91, 168, 0.28);
  background: var(--surface-blue);
  color: var(--blue);
  box-shadow: none;
}

.export-summary {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: #f8fafc;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 12px;
}

.export-summary span,
.export-result {
  display: flex;
  align-items: center;
  gap: 7px;
}

.export-summary svg,
.export-result svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.export-result {
  border-radius: 8px;
  background: #eaf8f0;
  color: #067647;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 680;
}

.audit-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border-color: #d7e7fb;
  background: linear-gradient(135deg, #ffffff, #f4f8ff);
}

.audit-hero h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.24;
}

.audit-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.audit-latest {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  border-radius: 8px;
  background: var(--surface);
  padding: 13px;
  box-shadow: 0 8px 22px rgba(20, 86, 166, 0.08);
}

.audit-latest span,
.audit-latest em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.audit-latest strong {
  font-size: 17px;
}

.audit-filter-panel,
.audit-list-panel {
  padding: 14px;
}

.audit-filter-panel .section-head,
.audit-list-panel .section-head {
  margin-bottom: 12px;
}

.audit-segments {
  overflow-x: auto;
}

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

.audit-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.audit-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-blue);
  color: var(--blue);
}

.audit-icon.green {
  background: #eaf8f0;
  color: #067647;
}

.audit-icon.amber {
  background: #fff7e8;
  color: #a15c00;
}

.audit-icon.red {
  background: #fff1f2;
  color: #b42318;
}

.audit-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audit-title strong {
  font-size: 15px;
}

.audit-title span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f1f5f9;
  color: #53606d;
  padding: 4px 8px;
  font-size: 12px;
}

.audit-main p {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.admin-entry {
  padding: 16px 16px 14px;
}

.admin-entry-head {
  display: grid;
  grid-template-columns: 34px auto auto 1fr;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.brand-slash {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: url("/assets/enzhe-logo.png") center / cover no-repeat;
}

.admin-entry-head strong {
  font-size: 16px;
  font-weight: 820;
}

.admin-entry-head span:not(.brand-slash) {
  color: var(--muted);
  font-size: 13px;
}

.admin-entry-head a {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.admin-entry-head a svg {
  width: 15px;
  height: 15px;
}

.admin-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.admin-entry-grid div {
  display: grid;
  justify-items: center;
  gap: 3px;
  border-right: 1px solid var(--line);
}

.admin-entry-grid div:last-child {
  border-right: 0;
}

.admin-entry-grid span {
  color: var(--muted);
  font-size: 12px;
}

.admin-entry-grid strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 830;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-kpi {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
}

.review-card {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.review-card:last-child {
  border-bottom: 0;
}

.review-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.evidence-line {
  margin-top: 8px;
}

.evidence-line.blocked {
  color: #9f6b02;
}

.review-warning {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: 1px solid #f9d47a;
  background: #fff8e8;
  color: #805600;
  font-size: 13px;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.adjust-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

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

.rank-list-panel {
  overflow: hidden;
}

.rank-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  padding: 13px 14px;
}

.rank-list-head strong,
.rank-list-head span {
  display: block;
}

.rank-list-head strong {
  font-size: 15px;
}

.rank-list-head span,
.rank-list-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2f7;
  color: #53606d;
  font-weight: 720;
}

.rank-row-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.rank-progress {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #eef3f8;
}

.rank-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-bright), var(--blue));
}

.rank-row-score {
  font-size: 18px;
  font-weight: 860;
}

.rank-row-score.add {
  color: var(--green-dark);
}

.rank-row-score.deduct {
  color: var(--red);
}

.rank-open-seat {
  padding: 18px 16px;
  color: var(--muted);
  text-align: center;
}

.message-composer {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 560px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.nav-item.active {
  color: var(--blue);
}

@media (max-width: 480px) {
  .screen {
    padding: 12px 10px 22px;
  }

  .topbar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .section-head {
    gap: 8px;
  }

  .link-button {
    flex: 0 0 auto;
    max-width: 46%;
    justify-content: flex-end;
    white-space: normal;
  }

  .input,
  .select,
  .textarea {
    font-size: 16px;
  }

  .form {
    gap: 10px;
  }

  .type-choice-grid {
    gap: 8px;
  }

  .type-choice {
    min-height: 74px;
    align-content: center;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 8px;
    padding: 11px 10px;
  }

  .type-choice::after {
    right: -26px;
    top: -32px;
    width: 70px;
    height: 70px;
  }

  .type-choice svg {
    grid-row: 1 / span 2;
    width: 21px;
    height: 21px;
  }

  .type-choice span {
    min-width: 0;
    font-size: 15px;
    line-height: 1.18;
    white-space: nowrap;
  }

  .type-choice em {
    overflow: hidden;
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rule-picker-card,
  .message-composer {
    padding: 12px;
  }

  .rule-picker-card .section-head {
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .rule-picker-card .section-title {
    font-size: 17px;
  }

  .category-chip-row {
    margin-right: -12px;
    margin-left: -12px;
    padding: 0 12px 8px;
  }

  .category-chip {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 13px;
  }

  .selected-rule-card {
    gap: 8px;
    padding: 10px;
  }

  .rule-sheet-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .sheet-rule-list {
    max-height: calc(78vh - 142px);
  }

  .input,
  .select,
  .textarea {
    padding: 10px 11px;
  }

  .textarea {
    min-height: 82px;
  }

  .upload-card {
    min-height: 126px;
    gap: 7px;
    padding: 14px 12px;
  }

  .upload-plus {
    width: 36px;
    height: 36px;
  }

  .upload-plus svg {
    width: 19px;
    height: 19px;
  }

  .upload-action-row {
    gap: 7px;
    width: 100%;
  }

  .upload-action {
    min-height: 34px;
    font-size: 13px;
  }

  #pointsPreview.metric-value {
    margin-top: 4px;
    font-size: 22px !important;
  }
}

@media (min-width: 620px) {
  .app {
    background:
      linear-gradient(90deg, rgba(238, 245, 255, 0.58), transparent 24%, transparent 76%, rgba(238, 245, 255, 0.58)),
      var(--bg);
  }

  .topbar {
    padding-left: 24px;
    padding-right: 24px;
  }

  .screen {
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 390px) {
  .hero-ledger {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-row {
    grid-template-columns: 1fr 0.94fr;
  }

  .metric-value {
    font-size: 51px;
  }

  .mini-stat {
    padding-left: 16px;
  }

  .mini-stat strong {
    font-size: 18px;
  }

  .quick-action span,
  .category-name {
    font-size: 12px;
  }

  .quick-action em {
    font-size: 10px;
  }

  .rulebook-hero,
  .rank-campaign {
    grid-template-columns: 1fr;
  }

  .reward-mini-grid {
    min-width: 0;
  }

  .value-detail-score {
    grid-template-columns: 1fr;
  }

  .rule-admin-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-admin-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .rule-admin-toolbar > span {
    align-self: flex-end;
  }

  .rule-admin-row {
    grid-template-columns: 1fr;
  }

  .rule-admin-actions {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-items: start;
  }

  .rule-admin-actions > div {
    justify-self: end;
  }

  .rank-chaser-grid {
    grid-template-columns: 1fr;
  }

  .ops-hero,
  .role-personal {
    grid-template-columns: 1fr;
  }

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

  .role-kpi-grid,
  .role-actions,
  .board-grid,
  .admin-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-module:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .role-action:nth-child(2n),
  .admin-module:nth-child(2n) {
    border-right: 0;
  }

  .admin-module:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .admin-module:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .manager-dimension-list > div {
    grid-template-columns: 68px minmax(0, 1fr) auto;
  }

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

  .audit-hero {
    grid-template-columns: 1fr;
  }

  .audit-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

.admin-module-grid > .admin-module,
.admin-module-grid > .admin-module:nth-child(2n),
.admin-module-grid > .admin-module:nth-child(3n),
.admin-module-grid > .admin-module:nth-last-child(-n + 2),
.admin-module-grid > .admin-module:nth-last-child(-n + 3) {
  border: 0;
}
