:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --panel-strong: #efebe1;
  --ink: #1c2b2e;
  --muted: #5b6b6c;
  --line: #e3ded2;
  --line-strong: #cfc8b8;
  --brand: #1c2b2e;
  --brand-strong: #121d1f;
  --accent: #e07a2f;
  --accent-soft: #fbe6d3;
  --good: #3b7a57;
  --good-soft: #e1efe6;
  --warn: #8a6d1e;
  --warn-soft: #f1e8d3;
  --bad: #b5473f;
  --bad-soft: #f7e3e1;
  --info: #3a6b8a;
  --info-soft: #e1ebf1;
  --radius: 10px;
  --shadow: 0 4px 14px rgba(28, 43, 46, 0.08);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

::selection {
  background: var(--accent-soft);
}

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

button {
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

.button-link {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-size: 13.5px;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
}

.button-link:hover {
  background: var(--panel-strong);
}

.button-link.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button-link.primary:hover {
  background: var(--brand-strong);
}

button:hover {
  background: var(--brand-strong);
  box-shadow: 0 4px 14px rgba(28, 43, 46, 0.22);
}

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

button.secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}

button.secondary:hover {
  background: var(--panel-strong);
}

button.warning {
  background: var(--accent);
}

button.warning:hover {
  box-shadow: 0 4px 14px rgba(224, 122, 47, 0.35);
}

button.icon {
  width: 38px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 7px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: var(--panel);
  color: var(--ink);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.brand strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button,
.nav a {
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  border-radius: 8px;
  display: block;
  font-weight: 700;
  min-height: 38px;
  padding: 9px 14px;
}

.nav button:hover,
.nav button.active,
.nav a:hover,
.nav a.active {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: none;
}

.nav button.active,
.nav a.active {
  border-color: transparent;
  color: var(--accent);
}

.tenant-card {
  margin-top: auto;
  display: grid;
  gap: 5px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tenant-card span,
.tenant-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tenant-card span {
  text-transform: uppercase;
}

.tenant-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.topbar h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  margin: 0;
  letter-spacing: 0;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
}

.content {
  padding: 22px 24px 40px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
}

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

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

.panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  letter-spacing: 0;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
}

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

.stat {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.form-section {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
}

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

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

.inline-user-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.8fr) minmax(120px, 0.7fr) minmax(100px, 0.6fr) auto;
  gap: 8px;
  min-width: 680px;
}

.inline-user-form input,
.inline-user-form select {
  min-height: 34px;
}

.inline-template-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.8fr) 120px 74px 108px 112px 96px minmax(160px, 1fr) auto;
  gap: 8px;
  min-width: 1040px;
}

.inline-template-form input,
.inline-template-form select {
  min-height: 34px;
}

.delete-template-field-form {
  margin-top: 8px;
}

.delete-template-field-form button,
td form button {
  min-height: 34px;
}

.inline-customer-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.8fr) minmax(150px, 1fr) minmax(180px, 1.1fr) auto;
  gap: 8px;
  min-width: 780px;
}

.inline-customer-form input {
  min-height: 34px;
}

.inline-payment-form {
  display: grid;
  grid-template-columns: 110px 130px minmax(140px, 1fr) auto;
  gap: 8px;
  min-width: 520px;
}

.inline-payment-form input,
.inline-payment-form select {
  min-height: 34px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f1f5f7;
}

thead th {
  background: var(--bg);
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: #fcfbf8;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

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

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

.compact-list {
  gap: 4px;
  margin-top: 8px;
}

.compact-list a {
  display: block;
}

.mini-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: grid;
  gap: 6px;
}

.mini-card strong {
  font-size: 14px;
}

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

.detail {
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.detail span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.tracking {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
}

td:first-child strong,
.detail strong,
.payment-row-amt {
  font-family: "IBM Plex Mono", monospace;
}

.print-only {
  display: none;
}

.landing-page {
  min-height: 100vh;
}

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

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

.landing-brand span {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  color: var(--accent);
  display: inline-flex;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.landing-brand strong,
.landing-hero h1,
.auth-card h1 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0;
}

.landing-hero {
  align-items: center;
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  margin: 0 auto;
  max-width: 1180px;
  min-height: calc(100vh - 220px);
  padding: 56px 24px;
}

.landing-hero h1 {
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.02;
  margin: 10px 0 16px;
  max-width: 850px;
}

.landing-hero p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 720px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.landing-strip {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-strip div {
  background: var(--panel);
  display: grid;
  gap: 6px;
  padding: 26px 28px;
}

.landing-strip span {
  color: var(--muted);
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  max-width: 620px;
  width: 100%;
}

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

  .sidebar {
    position: static;
  }

  .grid.two,
  .grid.three,
  .stat-grid,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .content > *:not(.print-area),
  button,
  .no-print {
    display: none !important;
  }

  .app,
  .main {
    display: block;
  }

  .content {
    padding: 0;
  }

  .panel,
  .card {
    border: 0;
    box-shadow: none;
  }

  .print-only {
    display: block;
  }
}
