:root {
  color-scheme: light;
  --ink: #19312d;
  --muted: #60736e;
  --paper: #f2f7f5;
  --surface: #ffffff;
  --line: #dbe7e2;
  --green: #157b63;
  --green-dark: #0e604d;
  --mint: #e2f3ed;
  --amber: #fff3d5;
  --red: #8c3e38;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

a { color: var(--green-dark); }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(24px, calc((100vw - 1160px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--green); color: white; font-weight: 800; letter-spacing: -.06em; }
.text-button, .back-link { border: 0; background: transparent; font: inherit; color: var(--green-dark); font-weight: 650; cursor: pointer; text-decoration: none; }

.container { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 72px; }
.page-heading { margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 4vw, 42px); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin-bottom: 10px; font-size: 21px; letter-spacing: -.025em; }
.lead { max-width: 700px; color: var(--muted); font-size: 17px; line-height: 1.5; }

.base-card, .module-card, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgb(28 70 57 / 5%);
}

.base-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 28px; padding: 26px 30px; border-left: 5px solid var(--green); }
.base-card p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.base-price { align-self: center; display: grid; text-align: right; }
.base-price strong { font-size: 28px; letter-spacing: -.04em; }
.base-price span, .muted { color: var(--muted); font-size: 13px; }
.base-summary { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 38px 0 18px; }
.section-heading h2 { margin-bottom: 0; font-size: 26px; }
.device-count { padding: 9px 13px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: 700; white-space: nowrap; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.module-card { display: flex; flex-direction: column; padding: 24px; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-top h2 { max-width: 280px; }
.status { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.status-off { background: #eef2f0; color: #52635e; }
.status-pending { background: var(--amber); color: #795715; }
.status-active { background: var(--mint); color: var(--green-dark); }
.status-suspended { background: #fde8e7; color: #8e2b24; }
.module-copy { min-height: 48px; color: var(--muted); line-height: 1.5; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.price-row span { color: var(--muted); }
.price-row strong { text-align: right; white-space: nowrap; }
.module-card .muted { margin: 8px 0 18px; line-height: 1.5; }
.owner-only-hint { margin: 0; padding: 12px 14px; border-radius: 11px; background: #f3f6f4; color: var(--muted); font-size: 13px; }
.button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; font: inherit; font-weight: 750; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #f2c94c; outline-offset: 3px; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: #eaf0ed; color: var(--ink); }
.guide { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.guide summary { color: var(--green-dark); font-weight: 750; cursor: pointer; }
.guide ol { margin: 12px 0 0; padding-left: 22px; }
.guide li { padding: 0 0 12px 3px; color: var(--muted); line-height: 1.45; }
.guide li strong, .guide li span { display: block; }
.guide li strong { margin-bottom: 3px; color: var(--ink); font-size: 14px; }
.guide li span { font-size: 13px; }
.payment-note { margin: 20px 0 0; padding: 16px 18px; border: 1px solid #ead9a8; border-radius: 14px; background: #fff9e8; color: #665322; font-size: 14px; line-height: 1.5; }
.invoice-section { margin-top: 34px; }
.invoice-section .section-heading { margin: 0 0 14px; }
.invoice-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.invoice-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: center; gap: 10px 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.invoice-row:last-child { border-bottom: 0; }
.invoice-row > div { display: grid; gap: 4px; }
.invoice-row > div span, .invoice-due { color: var(--muted); font-size: 12px; }
.invoice-state { justify-self: start; padding: 6px 9px; border-radius: 999px; background: var(--amber); color: #795715; font-size: 12px; font-weight: 750; }
.invoice-paid { background: var(--mint); color: var(--green-dark); }
.invoice-cancelled { background: #eef2f0; color: #52635e; }
.invoice-due { grid-column: 1 / -1; }
.empty-state { margin: 0; padding: 18px 20px; color: var(--muted); }
.notice { margin: 16px 0; padding: 13px 16px; border-radius: 12px; line-height: 1.45; }
.notice-info { background: var(--mint); color: var(--green-dark); }
.notice-error { background: #fff0ed; color: var(--red); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #d8eee6, transparent 35%), var(--paper); }
.login-card { width: min(460px, 100%); padding: 34px; }
.login-card .brand-mark { margin-bottom: 26px; }
.stack { display: grid; gap: 16px; }
.stack label { display: grid; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 650; }
.stack input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbd9d3; border-radius: 10px; background: white; font: inherit; }
.stack input:focus { border-color: var(--green); outline: 3px solid rgb(21 123 99 / 15%); }
.login-card .muted { margin: 18px 0 0; line-height: 1.5; }
.back-link { display: inline-block; margin-top: 20px; }

.feature-nav { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 28px; }
.feature-nav a { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: 13px; font-weight: 650; }
.feature-nav a:hover { border-color: var(--green); background: var(--mint); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 750; }
tr:last-child td { border-bottom: 0; }
.device-register { margin: 22px 0; }
.device-register > div { margin-bottom: 18px; }
.device-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.device-form label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.device-form input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #cbd9d3; border-radius: 10px; background: white; font: inherit; }
.device-form button { grid-column: 1 / -1; justify-self: start; }
.delete-device-form { display: grid; gap: 8px; white-space: normal; }
.delete-device-form label { display: flex; align-items: center; gap: 6px; color: var(--red); font-size: 12px; }
.delete-device-form button { min-height: 34px; justify-self: start; padding: 0 12px; font-size: 12px; }

@media (max-width: 760px) {
  .container { width: min(100% - 28px, 560px); padding: 30px 0 52px; }
  .topbar { padding: 12px 16px; }
  .base-card { grid-template-columns: 1fr; padding: 22px; }
  .base-price { justify-self: start; text-align: left; }
  .base-summary { grid-column: 1; }
  .section-heading { align-items: flex-start; flex-direction: column; margin-top: 30px; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { padding: 21px; }
  .card-top { flex-direction: column; }
  .device-form { grid-template-columns: 1fr; }
  .device-form button { grid-column: auto; width: 100%; }
  .invoice-row { grid-template-columns: 1fr auto; padding: 15px; }
  .invoice-row > strong:last-of-type { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
