:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: rgba(37, 99, 235, 0.12);
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-danger: #dc2626;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 12px 24px -4px rgba(15, 23, 42, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  margin: 0;
  min-height: 100%;
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body:has(#loginScreen:not(.hidden)) {
  background: #0f172a;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* —— 登录全屏（固定铺满视口，内容水平垂直居中）—— */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  box-sizing: border-box;
}

.login-screen__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(99, 102, 241, 0.14), transparent 50%),
    linear-gradient(165deg, #0f172a 0%, #1e293b 42%, #334155 100%);
  z-index: 0;
}

.login-screen__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

.login-screen__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  flex-shrink: 0;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
  color: #f8fafc;
}

.login-brand__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
}

.login-brand__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-brand__desc {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: rgba(248, 250, 252, 0.65);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-card__heading {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.login-card__hint {
  margin: 0 0 22px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.field {
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 6px;
}

.field__input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field__input::placeholder {
  color: #94a3b8;
}

.field__input:hover {
  border-color: #cbd5e1;
}

.field__input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 20px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.btn-login {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #3b82f6 0%, var(--color-primary) 100%);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}

.btn-login:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-login:active {
  transform: translateY(1px);
}

.login-msg {
  color: var(--color-danger);
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 0.8125rem;
  text-align: center;
}

.login-footer {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(248, 250, 252, 0.4);
}

.input-error {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

/* —— 登录后主界面：左侧导航 + 主内容 —— */
#appShell:not(.hidden) {
  display: flex;
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  background: #eef1f6;
  width: 100%;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 200;
  pointer-events: auto;
}

.sidebar__item {
  pointer-events: auto;
  cursor: pointer;
}

.app-shell > .main {
  margin-left: 220px;
  width: calc(100% - 220px);
  flex: 1;
  min-width: 0;
}

.main-header__menu {
  display: none;
  background: #f8fafc;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-weight: 400;
}

.main-header__menu:hover {
  background: #f1f5f9;
}

.main-header__titles {
  min-width: 0;
  flex: 1;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.sidebar__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 16px;
}

.sidebar__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 8px 16px 6px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 2px 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar__item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.sidebar__item.is-active {
  background: rgba(37, 99, 235, 0.35);
  color: #fff;
}

.sidebar__icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar__item.is-active .sidebar__icon {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar__item--parent {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar__item-label {
  flex: 1;
  text-align: left;
}

.sidebar__caret {
  flex-shrink: 0;
  padding: 4px 8px;
  margin: -4px -4px -4px 0;
  border-radius: 6px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

.sidebar__caret:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.sidebar__footer {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 8px;
  word-break: break-all;
}

.sidebar__hint {
  font-size: 11px;
  line-height: 1.4;
  color: #94a3b8;
  margin: 0 0 10px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar__logout {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}

.sidebar__logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.main-header__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.main-header__breadcrumb {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.main-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-header__user {
  font-size: 13px;
  color: #475569;
}

.main-body {
  flex: 1;
  padding: 20px 24px 32px;
  overflow: auto;
}

.page-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.page-panel h2 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.topbar {
  display: none;
}

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

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, var(--color-primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.btn-logout {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-logout:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.income-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.income-mode__label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.income-mode__opt {
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}

.income-mode__opt:hover {
  background: #fff;
  border-color: #cbd5e1;
}

.income-mode__opt.is-active {
  background: #fff;
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--color-primary-soft);
}

.income-mode-hint {
  margin: -6px 0 12px;
  font-size: 12px;
  color: #64748b;
  padding-left: 2px;
}

.income-fields--show {
  animation: incomeFieldsIn 0.2s ease;
}

@keyframes incomeFieldsIn {
  from {
    opacity: 0.4;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar__section {
  margin-bottom: 4px;
}

.sidebar__item--parent {
  width: calc(100% - 16px);
}

.sidebar__caret {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.7;
}

.sidebar__subnav {
  padding: 4px 0 8px 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin: 0 8px 8px 20px;
  max-height: 220px;
  overflow-y: auto;
}

.sidebar__subnav.hidden {
  display: none;
}

.sidebar__subitem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 2px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__subitem:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.sidebar__subitem.is-active {
  background: rgba(37, 99, 235, 0.35);
  color: #fff;
}

.sidebar__subhint {
  margin: 4px 8px 8px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;
}

.company-badge {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 14px;
  color: #1e40af;
}

.company-records {
  margin: 0;
  padding: 0;
}

.company-records__actions {
  margin-top: 16px;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

.field-inline input[type="datetime-local"] {
  max-width: 280px;
}

.grid--datetime {
  margin-bottom: 12px;
}

.filter-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.export-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: 4px;
}

.company-records__filters {
  margin-bottom: 12px;
  align-items: end;
}

.company-records__count {
  margin: 0 0 10px;
  font-size: 13px;
  color: #64748b;
}

.company-records__title {
  margin: 0 0 10px;
  font-size: 15px;
  color: #334155;
}

.company-records__table {
  width: 100%;
  font-size: 13px;
}

.save-success {
  margin: 16px 0;
  padding: 14px 16px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  color: #065f46;
  font-size: 14px;
  line-height: 1.6;
}

.save-success strong {
  font-size: 16px;
  display: block;
  margin-bottom: 8px;
}

.save-success code {
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.save-success__warn {
  color: #b45309;
  margin: 8px 0 0;
}

.save-success__tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: #047857;
  opacity: 0.9;
}

.expense-payout-block {
  margin: 12px 0 14px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
}

.expense-payout-block .field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

.expense-payout-block input {
  width: 100%;
  height: 42px;
}

.field-required {
  color: var(--color-danger);
}

.attach-block {
  margin: 12px 0 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.attach-block__label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 8px;
}

.attach-block input[type="file"] {
  font-size: 13px;
  height: auto;
  padding: 6px 0;
  border: none;
  background: transparent;
}

.att-link {
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
  color: var(--color-primary);
  text-decoration: none;
}

.att-link:hover {
  text-decoration: underline;
}

.income-summary {
  margin: 12px 0;
  font-size: 14px;
  color: #475569;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

input,
select,
button {
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.875rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-soft);
}

button {
  cursor: pointer;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  padding: 0 14px;
  margin-right: 6px;
  margin-bottom: 4px;
  font-weight: 500;
  transition: background 0.15s;
}

.sidebar__item {
  margin-right: 0;
  margin-bottom: 0;
  height: auto;
}

button:hover {
  background: var(--color-primary-hover);
}

button.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

button.btn-secondary:hover {
  background: #cbd5e1;
}

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

button.btn-sm {
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
  margin: 2px 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 12px;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-panel h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  border: 1px solid #e5eaf3;
  padding: 8px;
  font-size: 13px;
  text-align: left;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

.toolbar {
  margin: 8px 0;
}

.perm-group {
  border: 1px solid #e5eaf3;
  border-radius: 8px;
  padding: 8px;
  background: #fafcff;
}

.perm-group h3 {
  margin: 0 0 6px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.perm-item {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

.remember-line {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
  color: #5d6678;
  font-size: 13px;
}

.remember-line input {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .login-card {
    padding: 22px 20px;
  }

  .wrap {
    padding: 12px 10px 24px;
  }

  h1 {
    font-size: 1rem;
  }

  .card {
    padding: 14px;
  }

  input,
  select,
  button {
    height: 44px;
    font-size: 16px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* 主内容全宽，侧栏抽屉 */
  .app-shell > .main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .sidebar {
    width: min(280px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: none;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  body.mobile-nav-open .sidebar-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
  }

  .main-header {
    padding: 12px 14px;
    gap: 10px;
    align-items: flex-start;
  }

  .main-header__menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--color-text);
    font-size: 22px;
    line-height: 1;
  }

  .main-header__title {
    font-size: 17px;
    line-height: 1.3;
  }

  .main-header__breadcrumb {
    display: none;
  }

  .main-header__user {
    display: none;
  }

  .main-body {
    padding: 12px 12px 24px;
    -webkit-overflow-scrolling: touch;
  }

  .page-panel {
    padding: 16px 14px;
    border-radius: 12px;
  }

  .page-panel h2 {
    font-size: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .grid--datetime {
    margin-bottom: 10px;
  }

  .field-inline input[type="datetime-local"] {
    max-width: none;
    width: 100%;
  }

  .income-mode {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }

  .income-mode__label {
    margin-bottom: 2px;
  }

  .income-mode__opt {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .income-mode-hint {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 10px;
  }

  .income-summary {
    font-size: 15px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
  }

  .page-panel > button,
  .page-panel .btn-secondary {
    width: 100%;
    margin-right: 0;
    margin-bottom: 8px;
    height: 44px;
  }

  .export-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
  }

  .export-actions button {
    width: 100%;
    margin: 0;
  }

  #queryCard > button {
    width: 100%;
    margin-right: 0;
    margin-bottom: 8px;
  }

  .company-records__filters {
    grid-template-columns: 1fr;
  }

  .company-records__filters button {
    width: 100%;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
  }

  #table {
    min-width: 640px;
  }

  .modal-panel {
    max-height: 85vh;
    padding: 14px;
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .sidebar__subnav {
    max-height: 40vh;
  }
}

/* 分页器样式 */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 10px 0;
}

.pager-btn {
  min-width: 36px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.pager-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.pager-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.records-count {
  font-size: 13px;
  color: #6b7280;
  margin: 4px 0 12px;
}

/* 统计表格样式 */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 8px;
}

.stats-table th,
.stats-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  text-align: right;
}

.stats-table th:first-child,
.stats-table td:first-child {
  text-align: left;
}

/* ── 入账/出账 tabs on company records ── */
.biz-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.biz-tab {
  padding: 6px 20px;
  border: 1px solid #d0d7e2;
  border-radius: 20px;
  background: #f6f8fa;
  color: #57606a;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.biz-tab:hover {
  background: #e8ecf1;
}

.biz-tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── unified entry form type toggle ── */
.entry-type-bar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  margin: 14px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e6ebf1;
}

.entry-type-bar__label {
  font-size: 14px;
  color: #57606a;
  font-weight: 500;
  margin-right: 4px;
}

.entry-type-btn {
  display: inline-block;
  padding: 8px 24px;
  border: 1.5px solid #d0d7e2;
  border-radius: 18px;
  background: #f6f8fa;
  color: #57606a;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.entry-type-btn:hover {
  background: #e8ecf1;
  border-color: #b0bcc8;
}

.entry-type-btn.is-active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
  font-weight: 500;
}

/* ── 出账表单：费用类型 + 付出 并排 ── */
.expense-reason-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
}

.expense-reason-row select {
  width: 140px;
  flex-shrink: 0;
}

.expense-reason-row .payout-input {
  flex: 1;
}

.expense-reason-row .remark-input {
  flex: 1;
  min-width: 0;
}

/* ── 出账表单：付款状态（已付款/未付款）单选行 ── */
.expense-payment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 12px 0 14px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.expense-payment-row__label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.expense-payment-row__opt {
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.expense-payment-row__opt input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── unified entry form ── */
.company-entry-form {
  padding: 0 4px;
}

.stats-table thead th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.stats-table tfoot td {
  background: #f3f4f6;
  font-weight: 600;
}

.profit-pos {
  color: #059669;
}

.profit-neg {
  color: #dc2626;
}
/* 付款金额 + / - 符号选择 */
.advance-row { display: flex; gap: 6px; align-items: center; }
.advance-row select { width: 86px; flex-shrink: 0; }
.advance-row input { flex: 1; }
