:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-strong: #edf3e8;
  --text: #1d2118;
  --muted: #66705d;
  --line: #dce1d2;
  --accent: #2f7d52;
  --accent-strong: #256741;
  --danger: #b94343;
  --focus: rgba(47, 125, 82, 0.18);
  --shadow: 0 16px 40px rgba(35, 45, 25, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.submit-page {
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 64px);
  background:
    radial-gradient(circle at 12% 12%, rgba(47, 125, 82, 0.14), transparent 34rem),
    linear-gradient(135deg, #f7f9f3 0%, #edf3e8 100%);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 440px);
  gap: clamp(36px, 8vw, 108px);
  align-items: center;
  width: min(1120px, 100%);
}

.auth-intro {
  max-width: 650px;
}

.auth-eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.auth-intro h1 {
  max-width: 620px;
  font-size: clamp(36px, 5.2vw, 68px);
  letter-spacing: -0.04em;
}

.auth-intro > p {
  max-width: 590px;
  margin-top: 22px;
  font-size: 17px;
}

.auth-benefits {
  display: grid;
  gap: 14px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: baseline;
}

.auth-benefits strong {
  color: var(--accent-strong);
}

.billing-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px);
}

.billing-header,
.billing-status,
.billing-pay-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.billing-header {
  margin-bottom: 24px;
}

.billing-header p {
  color: var(--accent-strong);
  font-weight: 900;
}

.billing-status,
.billing-pay-panel,
.billing-plan,
.order-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.billing-status {
  margin-bottom: 18px;
  padding: 16px;
}

.billing-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.billing-plan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.billing-plan > span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.billing-plan strong {
  font-size: 34px;
}

.billing-plan-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.billing-pay-panel {
  align-items: center;
  margin-top: 18px;
  padding: 18px;
}

.billing-pay-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.billing-pay-panel img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.billing-history {
  margin-top: 28px;
}

.billing-history h2 {
  margin-bottom: 12px;
}

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

.order-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.auth-benefits span {
  color: var(--muted);
}

.auth-card {
  width: 100%;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  border-radius: 10px;
  background: var(--panel-strong);
}

.auth-tabs a {
  padding: 11px 16px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.auth-tabs a.is-active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 3px 10px rgba(35, 45, 25, 0.08);
}

.auth-form-head {
  margin-bottom: 22px;
}

.auth-form-head h2 {
  margin-bottom: 7px;
  font-size: 24px;
}

.auth-error {
  min-height: 22px;
  color: var(--danger);
  font-size: 14px;
}

.auth-assurance {
  margin-top: 2px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.auth-schedule-link {
  display: block;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.phone-shell {
  width: min(520px, 100%);
  min-width: 0;
}

.form-card,
.qr-panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-card {
  padding: 22px;
}

.form-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-dot {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.stack {
  display: grid;
  gap: 15px;
}

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

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

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

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

.form-section {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.form-section h2 {
  font-size: 15px;
}

.section-help {
  font-size: 12px;
  line-height: 1.5;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr 0.85fr);
  gap: 8px;
}

.script-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.script-type-option {
  position: relative;
  padding: 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}

.script-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.script-type-option span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.script-type-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px rgba(47, 125, 82, 0.18);
}

label,
.date-field,
.time-field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-label {
  display: block;
}

.date-trigger,
.time-trigger {
  position: relative;
  justify-content: flex-start;
  width: 100%;
  height: 48px;
  padding: 0 44px 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-align: left;
}

.date-trigger > span:first-child,
.time-trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-trigger-icon {
  position: absolute;
  right: 14px;
  width: 17px;
  height: 17px;
  border: 1.8px solid var(--accent);
  border-radius: 4px;
}

.date-trigger-icon::before {
  position: absolute;
  top: 3px;
  left: -1.8px;
  width: 17px;
  border-top: 1.8px solid var(--accent);
  content: "";
}

.time-trigger-icon {
  position: absolute;
  right: 14px;
  width: 18px;
  height: 18px;
  border: 1.8px solid var(--accent);
  border-radius: 50%;
}

.time-trigger-icon::before,
.time-trigger-icon::after {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 1.8px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
  transform-origin: bottom center;
}

.time-trigger-icon::before {
  height: 6px;
}

.time-trigger-icon::after {
  height: 5px;
  transform: rotate(90deg);
}

.date-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(20, 28, 19, 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.time-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(20, 28, 19, 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.date-picker,
.time-picker {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 28, 19, 0.22);
  transform: translate(-50%, -50%);
}

.date-picker-handle {
  display: none;
}

.date-picker-top,
.date-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.date-picker-top strong {
  color: var(--text);
  font-size: 15px;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.date-weekdays {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.date-grid {
  margin-top: 6px;
}

.date-day {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.date-day.is-muted {
  color: #aeb5a8;
  opacity: 1;
}

.date-day.is-today {
  border-color: #8cb99f;
  color: var(--accent-strong);
}

.date-day.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 5px 12px rgba(47, 125, 82, 0.28);
}

.date-picker-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 260px;
  margin-top: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.time-option,
.minute-option {
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf4;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.minute-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.time-option.is-selected,
.minute-option.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 12px rgba(47, 125, 82, 0.24);
}

input,
textarea,
select {
  display: block;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 48px;
  padding: 0 13px;
  font-size: 16px;
}

select {
  padding-right: 38px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus,
.date-trigger:focus-visible,
.time-trigger:focus-visible {
  border-color: #86aa72;
  box-shadow: 0 0 0 4px var(--focus);
}

input::placeholder,
textarea::placeholder {
  color: #9ba494;
}

input:active,
textarea:active,
select:active,
.date-trigger:active,
.time-trigger:active {
  border-color: #6e9c7e;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

button:active,
.button:active {
  transform: scale(0.98);
}

button:focus-visible,
.button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.ghost {
  background: #e7ebdf;
  color: var(--text);
}

.danger {
  background: var(--danger);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.full {
  width: 100%;
}

.admin-page {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 26px 0 38px;
}

.owner-page {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 26px 0 38px;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.account-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  object-fit: cover;
}

.dashboard {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.owner-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.owner-summary article {
  display: grid;
  gap: 7px;
  padding: 16px;
  background: #fff;
}

.owner-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.owner-summary strong {
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1.1;
}

.owner-summary strong.is-negative {
  color: var(--danger);
}

.owner-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.owner-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.owner-form {
  padding: 16px;
}

.owner-table-wrap {
  overflow: auto;
}

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

.owner-table td:first-child {
  min-width: 180px;
}

.owner-table td:first-child strong,
.owner-table td:first-child span {
  display: block;
}

.owner-table td:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.owner-table td {
  white-space: nowrap;
}

.owner-table td.is-negative {
  color: var(--danger);
  font-weight: 900;
}

.qr-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.qr-panel img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-panel img[hidden] {
  display: none;
}

.qr-share-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 18 / 23;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-panel p {
  word-break: break-all;
  font-size: 13px;
}

.logo-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  background: #e7ebdf;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.logo-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.qr-actions {
  display: grid;
  gap: 8px;
}

.save-panel {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.save-panel p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.save-slots {
  display: grid;
  gap: 8px;
}

.save-slot {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.save-slot strong,
.save-slot span {
  display: block;
}

.save-slot strong {
  font-size: 14px;
}

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

.save-slot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.save-slot-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.table-panel {
  overflow: hidden;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.panel-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 680px);
}

.panel-top-actions .button {
  min-height: 36px;
  white-space: nowrap;
}

#returnCurrentMonth {
  min-height: 36px;
  white-space: nowrap;
}

.table-search-bar {
  display: flex;
  align-items: center;
  flex: 1 1 300px;
  gap: 8px;
  min-width: 260px;
  max-width: 430px;
}

.table-search-field {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.table-search-field input {
  width: 100%;
  height: 40px;
  background: #fff;
}

.table-search-bar button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.month-summary article {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: #fff;
}

.month-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.month-summary strong {
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1.15;
}

.month-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.month-summary small b {
  color: var(--accent-strong);
  font-weight: 900;
}

.month-summary strong.is-negative {
  color: var(--danger);
}

.source-summary-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcf8;
}

.source-summary-panel h2 {
  margin: 0;
  font-size: 16px;
}

.source-summary-panel p {
  margin-top: 4px;
  font-size: 12px;
}

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

.source-summary-grid article {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.source-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-summary-grid strong {
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1.1;
}

.source-summary-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.expense-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.expense-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.expense-panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.expense-panel-head p {
  margin-top: 4px;
  font-size: 12px;
}

.expense-panel-head strong {
  color: var(--accent-strong);
  font-size: 24px;
  white-space: nowrap;
}

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

.expense-grid input[readonly] {
  background: #f3f5ef;
  color: var(--muted);
}

.expense-group-title {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 700;
}

.expense-income-heading {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.expense-rent-field {
  align-content: start;
}

.expense-rent-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.expense-rent-control button {
  min-height: 48px;
  padding: 0 12px;
  white-space: nowrap;
}

.expense-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.history-panel {
  width: min(1180px, calc(100vw - 48px));
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.history-card {
  display: grid;
  justify-content: stretch;
  min-height: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--text);
  text-align: left;
}

.history-card strong,
.history-card span {
  display: block;
}

.history-card strong {
  color: var(--accent-strong);
  font-size: 18px;
}

.history-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.history-detail {
  display: grid;
  gap: 12px;
}

.history-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.history-detail-head h3 {
  margin: 0 0 4px;
}

.history-detail-head p {
  font-size: 13px;
}

.history-table-wrap {
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-table {
  min-width: 1180px;
}

.history-table button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.history-table tr.is-history-focus td,
tbody tr.is-history-focus td {
  background: #fff6d8;
  transition: background 0.2s ease;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dcebd8;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.live-pill.off {
  background: #f2dede;
  color: #9f3434;
}

.table-scroll {
  max-height: calc(100vh - 280px);
  overflow: auto;
}

.table-x-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.table-x-scroll-inner {
  height: 1px;
  min-width: 2180px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 2180px;
}

.col-index { width: 58px; }
.col-date { width: 142px; }
.col-time { width: 118px; }
.col-script { width: 220px; }
.col-type { width: 78px; }
.col-unified-people,
.col-unified-price { width: 88px; }
.col-tier { width: 340px; }
.col-dm { width: 120px; }
.col-borrow,
.col-fee,
.col-platform,
.col-source,
.col-note { width: 220px; }
.col-created { width: 150px; }
.col-total { width: 118px; }
.col-actions { width: 190px; }

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf4;
  color: var(--muted);
  font-size: 12px;
}

th:nth-child(5),
th:nth-child(6),
th:nth-child(7) {
  text-align: center;
  line-height: 1.35;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0;
}

th.row-index-sticky,
td.row-index-sticky {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  text-align: center;
  white-space: nowrap;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

th.row-index-sticky {
  z-index: 4;
  background: #f7faf4;
}

td.row-index-sticky {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

th.script-sticky,
td.script-sticky {
  position: sticky;
  left: 58px;
  z-index: 2;
  min-width: 180px;
  max-width: 240px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line), 8px 0 16px rgba(35, 45, 25, 0.06);
}

th.script-sticky {
  z-index: 3;
  background: #f7faf4;
}

td.script-sticky input {
  font-weight: 800;
}

td.row-total {
  min-width: 112px;
  white-space: nowrap;
  color: var(--accent-strong);
  font-weight: 900;
}

td.row-total.is-negative {
  color: var(--danger);
}

.empty-row td {
  height: 132px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

td input,
td select {
  height: 36px;
  padding-inline: 8px;
  min-width: 0;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 7px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 6px;
}

.compact-grid.two {
  grid-template-columns: repeat(2, minmax(92px, 1fr));
}

.platform-amount-field {
  display: grid;
  gap: 4px;
  margin: 0;
}

.platform-amount-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.platform-amount-hint {
  min-height: 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.platform-amount-hint[hidden] {
  display: block !important;
  visibility: hidden;
}

input.is-calculated {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 127, 98, 0.16);
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.status.empty {
  background: #e9f4e4;
  color: #256741;
}

.status.full {
  background: #f4e6e2;
  color: #9f3434;
}

.status.none {
  background: #e8e8e8;
  color: #555;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  box-sizing: border-box;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 8px;
  background: rgba(29, 33, 24, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: center;
  transition: 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 33, 24, 0.46);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(880px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(24, 34, 20, 0.24);
}

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

.icon-close {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: -22px;
  margin: 4px -22px -22px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

@media (max-width: 860px) {
  .auth-page {
    place-items: start center;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 560px;
  }

  .auth-intro h1 {
    font-size: clamp(34px, 9vw, 52px);
  }

  .admin-header,
  .dashboard,
  .owner-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .qr-panel {
    max-width: 360px;
  }

  .month-summary {
    grid-template-columns: 1fr;
  }

  .table-search-bar {
    align-items: stretch;
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }

  .table-search-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

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

  .expense-grid,
  .history-list {
    grid-template-columns: 1fr;
  }

  .expense-panel-head,
  .history-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .owner-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .col-index { width: 44px; }
  .col-script { width: 128px; }

  th.row-index-sticky,
  td.row-index-sticky {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding-inline: 6px;
  }

  th.script-sticky,
  td.script-sticky {
    left: 44px;
    min-width: 128px;
    max-width: 128px;
  }

  td.script-sticky input {
    padding-inline: 7px;
  }

  body.date-picker-open {
    overflow: hidden;
  }

  .submit-page {
    place-items: start center;
    padding: 0;
  }

  .phone-shell {
    width: 100%;
  }

  .auth-intro > p {
    font-size: 15px;
  }

  .auth-benefits li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .auth-card {
    padding: 22px 18px;
  }

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

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

  .form-card {
    min-height: 100vh;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .form-section {
    padding: 16px 14px;
    border-radius: 12px;
  }

  .date-picker,
  .time-picker {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
    transform: none;
  }

  .date-picker-handle {
    display: block;
    width: 38px;
    height: 4px;
    margin: 2px auto 8px;
    border-radius: 999px;
    background: #d5dbd0;
  }

  .date-day {
    min-width: 0;
    min-height: 44px;
  }

  .time-grid {
    max-height: 42vh;
  }

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

  .owner-summary {
    grid-template-columns: 1fr;
  }

  .billing-header,
  .billing-status,
  .billing-pay-panel,
  .order-item {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-plans {
    grid-template-columns: 1fr;
  }

  .billing-pay-panel img {
    width: 100%;
    max-width: 240px;
    height: auto;
    aspect-ratio: 1;
  }
}

/* Store-managed employee accounts */
.assistant-login-link { display: block; justify-self: end; text-align: right; margin-top: -6px; font-size: 13px; }
.assistant-page { max-width: 1120px; margin: 0 auto; padding: 32px 20px; }
.assistant-card { background: #fff; border: 1px solid #dce4df; border-radius: 16px; padding: 24px; margin: 20px 0; }
.assistant-list { display: grid; gap: 16px; margin-top: 20px; }
.assistant-list .assistant-card { margin: 0; }
.assistant-permissions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 12px 0; }
.assistant-permissions label { display: flex; align-items: center; gap: 10px; }
.assistant-permissions input { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--accent); }
.assistant-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 20px; }
.assistant-fields label { min-width: 0; display: grid; gap: 6px; }
.assistant-row { border: 1px solid #dce4df; border-radius: 12px; padding: 16px; }
.assistant-row summary { cursor: pointer; font-weight: 600; }
.assistant-page #message { color: #295a42; overflow-wrap: anywhere; }
.assistant-page h3 { overflow-wrap: anywhere; }
@media (max-width: 640px) { .assistant-fields, .assistant-permissions { grid-template-columns: 1fr; } .assistant-card { padding: 16px; } .assistant-page { padding: 20px 12px; } }

/* Keep the main-account layout while replacing unavailable information. */
.permission-masked { letter-spacing: 0.12em; color: var(--muted); }
.permission-unavailable { opacity: 0.6; cursor: not-allowed; }
.permission-unavailable::after { content: " ****"; }
