:root {
  color-scheme: light;
  --ink: #14201c;
  --muted: #66736e;
  --line: #dfe7e3;
  --paper: #f5f7f4;
  --card: #ffffff;
  --forest: #12372f;
  --forest-2: #1b5043;
  --mint: #bce8d1;
  --mint-soft: #e8f5ee;
  --amber: #d4912f;
  --danger: #b4433d;
  --shadow: 0 18px 50px rgba(18, 55, 47, 0.08);
  font-family:
    "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 8px;
  color: #6c7b75;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px 8px 18px 8px;
  color: var(--forest);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 800;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  background: #fff;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 13px 6px 13px 6px;
  font-size: 22px;
}

.logo-upload {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed #b9cbc2;
  border-radius: 10px;
  background: #f8fbf9;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
}

.logo-preview img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.print-view {
  display: none;
}

@media print {
  body.printing > :not(#print-view) {
    display: none !important;
  }

  body.printing #print-view {
    display: block;
  }

  .print-document {
    padding: 18mm;
    color: #111;
    background: #fff;
    font: 12px/1.55 Arial, "Microsoft YaHei", sans-serif;
  }

  .print-document header,
  .print-meta,
  .print-signatures {
    display: flex;
    justify-content: space-between;
    gap: 20px;
  }

  .print-document header h1 {
    margin: 0;
    font-size: 26px;
  }

  .print-document table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
  }

  .print-document th,
  .print-document td {
    padding: 8px;
    border: 1px solid #888;
    text-align: left;
  }

  .print-signatures {
    margin-top: 60px;
  }
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  background:
    radial-gradient(circle at 13% 17%, rgba(188, 232, 209, 0.22), transparent 32%),
    linear-gradient(135deg, #0e2c26, #1f5144 66%, #183f36);
}

.auth-story {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 108px);
  color: #f7fbf9;
}

.auth-story .eyebrow {
  margin-top: 30px;
  color: #a8cabb;
}

.auth-story h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(50px, 6.7vw, 96px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.auth-copy {
  max-width: 620px;
  margin: 30px 0;
  color: #c8d9d2;
  font-size: 17px;
  line-height: 1.8;
}

.feature-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-strip span {
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #dcece5;
  font-size: 12px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(248, 250, 248, 0.97);
}

.auth-form {
  display: grid;
  width: min(100%, 420px);
  gap: 22px;
}

.auth-form h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 36px;
  font-weight: 500;
}

label {
  display: grid;
  gap: 8px;
  color: #394a44;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #ccd8d2;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--forest-2);
  box-shadow: 0 0 0 3px rgba(27, 80, 67, 0.12);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.button {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
}

.button.primary {
  color: #fff;
  background: var(--forest-2);
}

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

.button.secondary {
  border-color: #cbd9d2;
  color: var(--forest);
  background: #f8fbf9;
}

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

.button.small {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.muted {
  color: var(--muted);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 28px 20px 22px;
  color: #edf5f1;
  background:
    radial-gradient(circle at 20% 0%, rgba(188, 232, 209, 0.12), transparent 30%),
    var(--forest);
}

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

.sidebar-brand span {
  display: block;
  margin-top: 3px;
  color: #87a79a;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tenant-label {
  margin: 25px 0 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #c7dbd2;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 5px;
  overflow: auto;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  color: #b9cec5;
  background: transparent;
  text-align: left;
}

.nav button::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #486f62;
  content: "";
}

.nav button:hover,
.nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.nav button.active::before {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(188, 232, 209, 0.12);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-label {
  overflow: hidden;
  margin-bottom: 10px;
  color: #d7e6df;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  padding: 0;
  border: 0;
  color: #91afa2;
  background: transparent;
  font-size: 12px;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  min-height: 106px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 4vw;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 500;
}

.today-chip {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.main-content {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 30px 4vw 70px;
}

.page-stack {
  display: grid;
  gap: 22px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.5fr);
  gap: 24px;
  padding: 30px;
  overflow: hidden;
  border-radius: 22px;
  color: #edf8f2;
  background:
    radial-gradient(circle at 86% 20%, rgba(188, 232, 209, 0.18), transparent 30%),
    var(--forest);
  box-shadow: var(--shadow);
}

.hero-card h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 500;
}

.hero-card p {
  max-width: 720px;
  margin: 0;
  color: #bcd3c8;
  line-height: 1.7;
}

.hero-aside {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

.hero-big-number {
  text-align: right;
}

.hero-big-number strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 48px;
  font-weight: 500;
}

.hero-big-number span {
  color: #a9c4b8;
  font-size: 12px;
}

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

.metric-card,
.card {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 8px 26px rgba(24, 62, 51, 0.035);
}

.metric-card {
  padding: 20px;
  border-radius: 15px;
}

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

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 31px;
  font-weight: 500;
}

.card {
  overflow: hidden;
  border-radius: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 17px;
}

.card-body {
  padding: 22px;
}

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

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

.form-grid .wide-field,
.form-actions {
  grid-column: 1 / -1;
}

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

.inline-note {
  padding: 12px 14px;
  border: 1px solid #cfe5da;
  border-radius: 10px;
  color: #31584b;
  background: var(--mint-soft);
  font-size: 12px;
  line-height: 1.6;
}

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

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf1ef;
  text-align: left;
  vertical-align: top;
}

th {
  color: #63736d;
  background: #fafcfb;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.table-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: #376151;
  background: var(--mint-soft);
  font-size: 11px;
  font-weight: 700;
}

.line-editor {
  display: grid;
  gap: 12px;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 38px;
  gap: 10px;
  align-items: end;
}

.remove-line {
  height: 44px;
  border: 1px solid #ead2cf;
  border-radius: 10px;
  color: var(--danger);
  background: #fff8f7;
}

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

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 17px;
  border-radius: 10px;
  color: #fff;
  background: var(--forest);
  box-shadow: 0 14px 36px rgba(10, 34, 28, 0.23);
  font-size: 13px;
}

.toast.error {
  background: var(--danger);
}

.detail-panel {
  margin-top: 18px;
  border: 1px dashed #bfd0c8;
  border-radius: 12px;
  background: #fbfdfc;
}

.detail-panel .card-body {
  padding: 18px;
}

.detail-panel table {
  min-width: 520px;
}

.spaced-top {
  margin-top: 10px;
}

.compact-header {
  padding: 0 0 14px;
}

@media (max-width: 1050px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-story {
    min-height: 44vh;
  }
  .auth-panel {
    min-height: 56vh;
  }
}

@media (max-width: 1100px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.2);
  }
  .menu-button {
    display: inline-grid;
    place-items: center;
  }
  .topbar {
    min-height: 88px;
    justify-content: flex-start;
  }
  .today-chip {
    margin-left: auto;
  }
  .split-grid,
  .hero-card {
    grid-template-columns: 1fr;
  }
  .hero-aside {
    justify-content: flex-start;
  }
  .hero-big-number {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .auth-story {
    padding: 34px 24px;
  }
  .auth-story h1 {
    font-size: 45px;
  }
  .auth-panel {
    padding: 28px 20px;
  }
  .main-content {
    padding: 20px 16px 56px;
  }
  .topbar {
    padding: 18px 16px;
  }
  .today-chip {
    display: none;
  }
  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .line-row {
    grid-template-columns: 1fr 88px 38px;
  }
  .card-header,
  .card-body {
    padding: 17px;
  }
  .bills-table th:nth-child(3),
  .bills-table th:nth-child(4),
  .bills-table th:nth-child(5),
  .bills-table th:nth-child(6),
  .bills-table td:nth-child(3),
  .bills-table td:nth-child(4),
  .bills-table td:nth-child(5),
  .bills-table td:nth-child(6) {
    display: none;
  }
  .bills-table th,
  .bills-table td {
    padding: 11px 8px;
  }
}
