:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #6d7a80;
  --line: #dfe9e7;
  --paper: #fffdf8;
  --mint: #dff7ed;
  --aqua: #b9edf1;
  --coral: #ff8f73;
  --rose: #ffe1d8;
  --lemon: #fff3b8;
  --green: #1f8f65;
  --blue: #24748d;
  --shadow: 0 18px 45px rgba(38, 50, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 243, 184, 0.85), transparent 29%),
    linear-gradient(135deg, #f7fffb 0%, #fff7ed 48%, #edf9ff 100%);
}

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

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

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 28px;
}

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

.brand-mark,
.logo-fallback {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand-mark {
  overflow: hidden;
  background: #f2f4f3;
  border: 1px solid rgba(38, 50, 56, 0.08);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

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

.nav-actions a,
.button,
.ghost-button,
.copy-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 16px;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(38, 50, 56, 0.08);
}

.nav-actions a.disabled {
  color: var(--muted);
  background: rgba(239, 244, 242, 0.72);
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

.button {
  border: 0;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
}

.ghost-button,
.copy-button {
  background: #fff;
}

.hero-panel,
.admin-panel,
.notice,
.invoice-row,
.form-panel,
.client-card {
  border: 1px solid rgba(38, 50, 56, 0.08);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.hero-panel {
  overflow: hidden;
  border-radius: 28px;
}

.client-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 36px 22px 30px;
  background:
    linear-gradient(120deg, rgba(185, 237, 241, 0.72), rgba(255, 225, 216, 0.82)),
    var(--paper);
}

.client-logo {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  object-fit: contain;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(38, 50, 56, 0.08);
}

.client-hero h1,
.admin-title h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.client-hero p,
.admin-title p {
  margin: 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.05rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.summary-card {
  background: rgba(255, 255, 255, 0.78);
  padding: 18px;
}

.summary-card strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1;
}

.summary-card span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.section {
  margin-top: 34px;
}

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

.section h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-count {
  color: var(--muted);
  font-size: 0.95rem;
}

.invoice-list {
  display: grid;
  gap: 12px;
}

.invoice-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.4fr) auto minmax(150px, auto);
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 16px;
  border-radius: 20px;
}

.invoice-row.overdue {
  background: linear-gradient(90deg, rgba(255, 225, 216, 0.9), rgba(255, 255, 255, 0.9));
}

.invoice-number {
  font-weight: 800;
}

.invoice-meta,
.muted {
  color: var(--muted);
}

.amount {
  font-size: 1.2rem;
  font-weight: 850;
  text-align: right;
}

.pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.invoice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button,
.mini-link,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  padding: 7px 11px;
  font-weight: 800;
  box-shadow: 0 6px 15px rgba(38, 50, 56, 0.08);
}

.mini-button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.75;
}

.muted-button {
  color: var(--muted);
  background: rgba(239, 244, 242, 0.72);
}

.pill.overdue {
  background: var(--rose);
  color: #9a351f;
}

.pill.paid {
  background: var(--mint);
  color: var(--green);
}

.pill.sent,
.pill.viewed,
.pill.partial,
.pill.unpaid {
  background: var(--aqua);
  color: var(--blue);
}

.notice {
  border-radius: 22px;
  padding: 20px;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-layout.single {
  grid-template-columns: 1fr;
}

.client-list-panel {
  grid-column: 1 / -1;
}

.admin-title {
  margin-bottom: 22px;
}

.form-panel,
.admin-panel,
.client-card {
  border-radius: 24px;
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

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

.client-card {
  display: grid;
  gap: 14px;
}

.client-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.client-card img,
.tiny-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}

.client-card h3 {
  margin: 0;
}

.link-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.link-box input {
  min-width: 0;
}

.admin-panel h2,
.form-panel h2 {
  margin: 0 0 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
}

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

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.danger {
  color: #9a351f;
}

.notice.compact {
  margin-top: 14px;
  padding: 14px;
  box-shadow: none;
}

.wave-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.wave-customer {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.wave-customer span {
  display: block;
  color: var(--muted);
}

.search-field {
  margin-top: 16px;
}

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

.paid-request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 750;
}

.narrow {
  max-width: 520px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38, 50, 56, 0.32);
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid rgba(38, 50, 56, 0.08);
  border-radius: 24px;
  padding: 20px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-strip,
  .admin-layout,
  .two-col,
  .wave-customer {
    grid-template-columns: 1fr;
  }

  .invoice-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .amount {
    text-align: left;
  }

  .pill {
    justify-self: start;
  }

  .invoice-actions {
    justify-content: flex-start;
  }

  .paid-request-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
