:root {
  --bg: #f4efe7;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-soft: rgba(255, 250, 242, 0.82);
  --surface-strong: #fffdfa;
  --surface-dark: #1d2935;
  --text: #1d2935;
  --muted: #667284;
  --muted-strong: #4f5d6c;
  --line: rgba(29, 41, 53, 0.1);
  --line-strong: rgba(29, 41, 53, 0.16);
  --primary: #de7c00;
  --primary-strong: #b85d00;
  --secondary: #0f766e;
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.1);
  --success: #166534;
  --success-soft: rgba(22, 101, 52, 0.1);
  --shadow-lg: 0 28px 80px rgba(88, 66, 38, 0.14);
  --shadow-md: 0 14px 34px rgba(88, 66, 38, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-sans: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(222, 124, 0, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 22%),
    linear-gradient(180deg, #f7f2ea 0%, #efe7da 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  appearance: none;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 460px);
}

.login-card,
.card,
.message-box,
.selected-user-box,
.sidebar,
.page-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}

.login-card {
  padding: 36px;
  border-radius: var(--radius-xl);
}

.brand-badge,
.sidebar-kicker,
.page-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(222, 124, 0, 0.12);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  margin-top: 16px;
  font-size: clamp(34px, 6vw, 46px);
}

h2 {
  font-size: clamp(28px, 4vw, 40px);
}

h3 {
  font-size: 24px;
}

.muted-text,
.login-hint,
.footnote,
.card-header p,
.page-copy,
.selected-user-box p,
.sidebar-copy,
.sidebar-note small {
  color: var(--muted);
}

.stack-form,
.search-bar,
.assign-panel,
.form-grid {
  display: grid;
  gap: 16px;
}

.stack-form {
  margin-top: 24px;
}

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

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 14px;
  color: var(--muted-strong);
}

input,
select {
  width: 100%;
  border: 1px solid rgba(29, 41, 53, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease;
}

input::placeholder {
  color: #8b96a4;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(222, 124, 0, 0.44);
  box-shadow: 0 0 0 4px rgba(222, 124, 0, 0.12);
  background: white;
}

.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(135deg, #d66d00, #ffad14);
  color: white;
  box-shadow: 0 16px 30px rgba(222, 124, 0, 0.25);
}

.secondary-button {
  background: rgba(15, 118, 110, 0.1);
  color: var(--secondary);
}

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

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.message-box {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
}

.message-box[data-variant='error'] {
  border-color: rgba(185, 28, 28, 0.24);
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
}

.message-box[data-variant='success'] {
  border-color: rgba(22, 101, 52, 0.24);
  background: var(--success-soft);
  color: var(--success);
}

.app-shell {
  width: min(1520px, calc(100% - 30px));
  margin: 18px auto 30px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 22px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

.sidebar-brand h1 {
  margin-top: 12px;
  font-size: 30px;
}

.sidebar-copy {
  margin: 14px 0 0;
  line-height: 1.6;
}

.sidebar-user,
.sidebar-note {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(29, 41, 53, 0.08);
}

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

.sidebar-user strong,
.sidebar-note strong {
  font-size: 20px;
}

.sidebar-user small {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--surface-dark);
  border: 1px solid rgba(29, 41, 53, 0.08);
  background: rgba(255, 255, 255, 0.5);
  transition: transform 0.18s ease, border-color 0.18s ease,
    background-color 0.18s ease;
}

.sidebar-link:hover {
  transform: translateX(2px);
  border-color: rgba(29, 41, 53, 0.16);
}

.sidebar-link span {
  font-weight: 700;
}

.sidebar-link small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-link.is-active {
  background:
    linear-gradient(135deg, rgba(255, 244, 228, 0.96), rgba(255, 250, 244, 0.96));
  border-color: rgba(222, 124, 0, 0.3);
}

.sidebar-footer {
  display: grid;
  gap: 14px;
}

.content-shell {
  display: grid;
  gap: 20px;
}

.page-hero {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: start;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.page-copy {
  margin: 14px 0 0;
  max-width: 58ch;
  line-height: 1.7;
  font-size: 16px;
}

.page-grid {
  display: grid;
  gap: 20px;
}

.bind-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  align-items: start;
}

.card {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.card-header {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.card-header p {
  margin: 0;
  line-height: 1.6;
}

.footnote {
  margin: 18px 0 0;
  line-height: 1.6;
}

.search-bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.search-bar-muted {
  margin-bottom: 16px;
}

.records-filter-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.records-filter-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  flex: 1;
}

.settlement-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(29, 41, 53, 0.1);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-md);
}

.settlement-switch-button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease;
}

.settlement-switch-button:hover {
  transform: translateY(-1px);
}

.settlement-switch-button.is-active {
  background: linear-gradient(135deg, rgba(222, 124, 0, 0.16), rgba(255, 173, 20, 0.22));
  color: var(--primary-strong);
}

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

.selected-user-box {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 246, 238, 0.8));
}

.selected-user-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
}

.selected-user-box p {
  margin: 0;
  line-height: 1.55;
  font-size: 14px;
}

.assign-panel {
  margin-top: 8px;
  gap: 12px;
}

.operator-picker {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(29, 41, 53, 0.08);
  background: rgba(255, 255, 255, 0.58);
}

.operator-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.operator-picker-head h4 {
  margin: 0;
  font-size: 15px;
}

.operator-picker-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(29, 41, 53, 0.06);
  color: var(--muted-strong);
  font-weight: 700;
  cursor: pointer;
}

.operator-picker-panel {
  gap: 10px;
  display: grid;
}

.operator-search-results {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(29, 41, 53, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.operator-search-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid rgba(29, 41, 53, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.operator-search-item strong {
  font-size: 14px;
}

.operator-search-item span,
.operator-search-empty {
  color: var(--muted);
  font-size: 12px;
}

.operator-search-empty {
  padding: 8px 4px;
}

.operator-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.operator-picker-panel select {
  padding: 12px 14px;
  border-radius: 14px;
}

.inline-feedback {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid rgba(29, 41, 53, 0.1);
  background: rgba(255, 255, 255, 0.7);
}

.inline-feedback[data-variant='success'] {
  border-color: rgba(22, 101, 52, 0.22);
  background: rgba(22, 101, 52, 0.08);
  color: var(--success);
}

.inline-feedback[data-variant='error'] {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
}

.plan-picker {
  position: relative;
}

.plan-picker-trigger {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(29, 41, 53, 0.12);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
}

.plan-picker-trigger::after {
  content: "⌄";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 18px;
}

.plan-picker.is-open .plan-picker-trigger::after {
  content: "⌃";
}

.plan-picker-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plan-picker-value {
  padding-right: 28px;
  color: var(--surface-dark);
  font-weight: 700;
  line-height: 1.45;
}

.plan-picker-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  display: none;
  max-height: 300px;
  overflow: auto;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(29, 41, 53, 0.1);
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 18px 40px rgba(29, 41, 53, 0.16);
}

.plan-picker.is-open .plan-picker-menu {
  display: grid;
  gap: 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 20px;
  border: 1px dashed rgba(29, 41, 53, 0.16);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.compact-empty-state {
  min-height: 96px;
}

.plan-option {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(29, 41, 53, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

.plan-option:hover {
  transform: translateY(-1px);
  border-color: rgba(29, 41, 53, 0.16);
}

.plan-option.is-selected {
  border-color: rgba(222, 124, 0, 0.34);
  background: linear-gradient(180deg, rgba(255, 247, 233, 0.96), rgba(255, 251, 245, 0.92));
}

.plan-option-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.plan-option-top strong {
  font-size: 14px;
  line-height: 1.4;
}

.plan-id {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 41, 53, 0.06);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.plan-option-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.plan-option-meta span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 41, 53, 0.05);
}

.records-table-wrap {
  margin-top: 8px;
}

.pricing-table {
  min-width: 980px;
}

.pricing-table th:nth-child(1),
.pricing-table td:nth-child(1) {
  width: 90px;
}

.pricing-table th:nth-child(2),
.pricing-table td:nth-child(2) {
  width: 280px;
}

.pricing-table th:nth-child(3),
.pricing-table td:nth-child(3) {
  width: 150px;
}

.pricing-table th:nth-child(4),
.pricing-table td:nth-child(4) {
  width: 180px;
}

.pricing-table th:nth-child(5),
.pricing-table td:nth-child(5) {
  width: 120px;
}

.pricing-table th:nth-child(6),
.pricing-table td:nth-child(6) {
  width: 190px;
}

.pricing-table th:nth-child(7),
.pricing-table td:nth-child(7) {
  width: 110px;
}

.price-input {
  min-width: 120px;
  padding: 10px 12px;
  font-size: 13px;
}

.records-table-compact {
  min-width: 1040px;
}

.records-table-compact th:nth-child(1),
.records-table-compact td:nth-child(1) {
  width: 90px;
}

.records-table-compact th:nth-child(2),
.records-table-compact td:nth-child(2) {
  width: 250px;
}

.records-table-compact th:nth-child(3),
.records-table-compact td:nth-child(3) {
  width: 260px;
}

.records-table-compact th:nth-child(4),
.records-table-compact td:nth-child(4) {
  width: 120px;
}

.records-table-compact th:nth-child(5),
.records-table-compact td:nth-child(5) {
  width: 110px;
}

.records-table-compact th:nth-child(6),
.records-table-compact td:nth-child(6) {
  width: 110px;
}

.records-table-compact th:nth-child(7),
.records-table-compact td:nth-child(7) {
  width: 120px;
}

.records-table-compact th:nth-child(8),
.records-table-compact td:nth-child(8) {
  width: 110px;
}

.records-table-compact th:nth-child(9),
.records-table-compact td:nth-child(9) {
  width: 190px;
}

.records-table-compact th:nth-child(10),
.records-table-compact td:nth-child(10) {
  width: 160px;
}

.records-table-compact th,
.records-table-compact td {
  padding: 14px 12px;
  font-size: 13px;
}

.records-table-compact th {
  font-size: 11px;
}

.compact-identity {
  white-space: normal;
}

.compact-identity strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.compact-identity small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.compact-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.is-settled {
  background: rgba(102, 114, 132, 0.12);
  color: var(--muted-strong);
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(29, 41, 53, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 18px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(29, 41, 53, 0.08);
  vertical-align: top;
  font-size: 14px;
}

.data-table th {
  font-size: 12px;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(29, 41, 53, 0.04);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.68);
}

.empty-row {
  text-align: center;
  color: var(--muted);
}

.table-identity {
  min-width: 0;
}

.table-identity strong {
  font-weight: 700;
}

.table-identity small,
.inline-metadata,
details summary,
details pre {
  color: var(--muted);
}

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

.inline-metadata {
  display: block;
  margin-top: 4px;
  line-height: 1.5;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(222, 124, 0, 0.1);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.tag[data-variant='inactive'] {
  background: rgba(102, 114, 132, 0.12);
  color: #4f5d6c;
}

.mono {
  font-family: var(--font-mono);
  word-break: break-word;
}

details {
  max-width: 340px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
}

details pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(29, 41, 53, 0.05);
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}

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

  .sidebar {
    position: static;
  }

  .bind-layout,
  .form-grid,
  .search-bar,
  .page-hero {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .records-filter-bar,
  .records-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .records-filter-fields {
    grid-template-columns: 1fr;
    width: 100%;
  }

}

@media (max-width: 760px) {
  .app-shell {
    width: min(100%, calc(100% - 18px));
    margin: 10px auto 20px;
    gap: 16px;
  }

  .login-card,
  .card,
  .sidebar,
  .page-hero {
    padding: 18px;
    border-radius: 22px;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
  }

  .sidebar-link {
    padding: 12px 14px;
  }

}
