/* Knock — base styles */

:root {
  --ink: #0b1220;
  --ink-soft: #3a4358;
  --muted: #6b7388;
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --bg-card: #ffffff;
  --line: #e6e9f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eef3ff;
  --good: #16a34a;
  --bad: #dc2626;
  --shadow-sm: 0 1px 2px rgba(11,18,32,0.04), 0 1px 3px rgba(11,18,32,0.06);
  --shadow-md: 0 4px 10px rgba(11,18,32,0.06), 0 10px 30px rgba(11,18,32,0.07);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: white;
}
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); text-decoration: none; }

.btn-block { width: 100%; padding: 13px 18px; }

/* Hero */
.hero {
  padding: 88px 0 64px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.08;
  margin: 0 0 22px;
  letter-spacing: -0.02em;
}

.hero h1 .accent {
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lede {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

/* Feature grid */
.features {
  padding: 56px 0 80px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  text-align: center;
  margin-bottom: 40px;
}
.section-head h2 {
  font-size: 32px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.section-head p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 17px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: -0.005em;
}
.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.card .icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 18px;
}

/* How it works */
.how {
  padding: 72px 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.step .num {
  display: inline-flex;
  width: 32px;
  height: 32px;
  background: var(--ink);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}
.step h4 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 15px; }

/* CTA band */
.cta-band {
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  color: white;
  text-align: center;
  padding: 64px 24px;
}
.cta-band h2 { font-size: 30px; margin: 0 0 12px; letter-spacing: -0.01em; }
.cta-band p { margin: 0 0 24px; opacity: 0.92; font-size: 17px; }
.cta-band .btn-primary {
  background: white;
  color: var(--brand);
}
.cta-band .btn-primary:hover { background: #f1f5ff; }

/* Footer */
.footer {
  padding: 36px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.footer a { color: var(--muted); }

/* Auth pages */
.auth-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.auth-card h1 {
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.auth-card .sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 24px;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-info {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #c7d8ff;
}

.auth-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

/* App dashboard layout */
body.app { background: var(--bg-soft); }

.app-header {
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 24px;
}
.app-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}
.app-nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.app-nav-link:hover { background: var(--bg-soft); text-decoration: none; }
.app-nav-link.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.app-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-main { padding: 32px 24px 16px; }
.app-footer {
  padding: 28px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.page-head .lede {
  color: var(--ink-soft);
  margin: 0;
  font-size: 15px;
}
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 17px;
  letter-spacing: -0.005em;
}
.panel h4 { margin: 18px 0 6px; font-size: 14px; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h3 { margin: 0; }

/* Onboarding (empty state) */
.onboard {
  background: linear-gradient(135deg, var(--brand-soft) 0%, #f3f0ff 100%);
  border: 1px solid #d8e1ff;
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 24px;
}
.onboard h2 { margin: 0 0 14px; font-size: 19px; }
.onboard-steps {
  margin: 0;
  padding-left: 20px;
}
.onboard-steps li { margin-bottom: 12px; }
.onboard-steps li strong { display: inline-block; margin-right: 6px; }
.onboard-steps .btn { margin-left: 8px; }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-num .stat-sub { font-size: 16px; color: var(--muted); font-weight: 500; }
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* Data tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .row-actions {
  text-align: right;
  white-space: nowrap;
}
.msg-preview { color: var(--ink-soft); max-width: 360px; }

/* Forms — dashboard */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
}
.form-grid .field-full { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 0; }
.form-grid textarea, .form-grid select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: white;
  color: var(--ink);
  outline: none;
}
.form-grid textarea:focus, .form-grid select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-grid textarea { resize: vertical; min-height: 90px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.form-spacer { flex: 1; }

.form-inline {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.form-inline input, .form-inline select {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  font-family: inherit;
}

.consent-box {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 6px;
}
.consent-box .field { margin-top: 8px; }
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.checkbox input { margin-top: 4px; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--bad); color: white; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.badge-good { background: #ecfdf5; color: #047857; }
.badge-bad  { background: #fef2f2; color: #b91c1c; }
.badge-scheduled { background: #eff6ff; color: var(--brand-dark); }
.badge-sent      { background: #ecfdf5; color: #047857; }
.badge-skipped   { background: #fef3c7; color: #92400e; }
.badge-failed    { background: #fef2f2; color: #b91c1c; }
.badge-expired   { background: var(--bg-soft); color: var(--muted); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.tab {
  padding: 9px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* Setup / install steps */
.install-steps {
  counter-reset: step;
  padding: 0;
  list-style: none;
  margin: 0;
}
.install-steps > li {
  position: relative;
  padding: 18px 20px 18px 56px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  counter-increment: step;
}
.install-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.install-steps strong { display: block; font-size: 15px; margin-bottom: 6px; }
.install-steps p { margin: 6px 0 0; }

.kv-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.kv-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  padding: 4px 0;
}
.kv-list li > span {
  flex: 0 0 90px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.kv-list code, .copyable {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}
.copyable { display: inline-block; max-width: 100%; }

.key-display {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  margin: 10px 0;
}

.callout {
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* Devices + templates lists */
.device-list { list-style: none; padding: 0; margin: 0; }
.device-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.device-list li:last-child { border-bottom: none; }

.template-list { list-style: none; padding: 0; margin: 0; }
.template-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.template-item:last-child { border-bottom: none; }
.template-item > div:first-child { flex: 1; }
.template-item p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }

/* Alerts (success) */
.alert-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Utility */
.muted { color: var(--muted); }
.small { font-size: 12px; }
code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Marketing extras: big steps for how-it-works */
.big-steps {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  gap: 22px;
}
.big-steps > li {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 18px;
  align-items: start;
  box-shadow: var(--shadow-sm);
}
.big-num {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
}
.big-steps h3 { margin: 0 0 6px; font-size: 18px; }
.big-steps p { margin: 0; color: var(--ink-soft); }

/* Pricing */
.pricing-wrap { padding: 40px 0 80px; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.price-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: left;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.price-card.highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-md);
}
.price-card .ribbon {
  position: absolute;
  top: -12px;
  right: 16px;
  background: var(--brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.price-card h3 { margin: 0 0 8px; font-size: 17px; }
.price-card .price {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.price-card .price span { font-size: 15px; color: var(--muted); font-weight: 500; }
.price-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--ink-soft);
}
.price-card ul li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.price-card ul li:last-child { border-bottom: none; }
.pricing-note { text-align: center; margin-top: 18px; font-size: 14px; }

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.faq-grid h4 { margin: 0 0 6px; font-size: 16px; }
.faq-grid p { margin: 0; color: var(--ink-soft); font-size: 15px; }

/* Legal page */
.legal { padding: 40px 0 80px; max-width: 760px; }
.legal h1 { font-size: 32px; margin: 0 0 10px; letter-spacing: -0.01em; }
.legal .lede { color: var(--ink-soft); font-size: 17px; margin: 0 0 24px; }
.legal h2 { font-size: 20px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--ink-soft); font-size: 15px; }
.legal ul { padding-left: 22px; }
.legal ul li { margin-bottom: 6px; }

/* Footer (multi-row) */
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 0 14px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 14px; }
.footer-bottom { text-align: center; padding-bottom: 24px; font-size: 13px; }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .app-header-inner { flex-wrap: wrap; gap: 14px; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .big-steps > li { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-links { gap: 14px; }
  .nav-links .hide-sm { display: none; }
  .hide-sm { display: none; }
  .hero { padding: 56px 0 40px; }
  .auth-card { padding: 24px; }
  .panel { padding: 18px 18px; }
  .page-head h1 { font-size: 22px; }
}
