:root {
  --bg: #050505;
  --panel: #171717;
  --panel-2: #1e1e1e;
  --panel-soft: #111;
  --border: #2a2a2a;
  --border-soft: #222;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --focus: #86efac;
  --shadow: 0 18px 44px rgba(0, 0, 0, .36);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html {
  background: var(--bg);
  font-size: 16px;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% -20%, rgba(255,255,255,.05), transparent 34%), var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: #d4d4d4; text-decoration-color: #525252; text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.app-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 14px 16px 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 12px 0;
  background: rgba(5, 5, 5, .92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #1d1d1d, #111);
  color: #dfffe8;
  font-weight: 800;
}

.brand-logo {
  flex: 0 0 auto;
  width: clamp(132px, 21vw, 184px);
  height: auto;
  max-height: 66px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .28));
}

.brand-copy { display: none; min-width: 0; }
.brand-title { margin: 0; font-size: 1.06rem; letter-spacing: 0; }
.brand-subtitle { margin: 1px 0 0; color: var(--muted); font-size: .78rem; white-space: nowrap; }

.profile-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.profile-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23,23,23,.88);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.profile-menu-button:hover { background: var(--panel-2); }
.profile-icon { display: grid; place-items: center; color: #d4d4d4; }
.profile-text { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 1000;
  width: min(260px, calc(100vw - 32px));
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #181818;
  box-shadow: var(--shadow);
}
.profile-dropdown[hidden] {
  display: none !important;
}
.profile-dropdown button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.profile-dropdown button:hover,
.profile-dropdown button:focus {
  background: #242424;
  outline: none;
}
.profile-menu-summary {
  display: grid;
  gap: 3px;
  padding: 10px 12px 12px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.profile-menu-summary strong {
  color: var(--text);
  font-size: 14px;
}

.hero { padding: 28px 0 14px; }
.hero-section {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 28px;
  padding: clamp(32px, 6vw, 72px);
  background: #050505;
  box-shadow: 0 24px 70px rgba(0,0,0,.36);
}
.hero-section[hidden] { display: none !important; }
.hero-bg {
  position: absolute;
  inset: 0;
  background-color: #050505;
  background-image: url("../images/hero-bg.svg"), url("../images/hero-bg.webp");
  background-size: cover;
  background-position: center;
  opacity: .32;
  transform: scale(1.02);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(34, 197, 94, 0.16), transparent 32%),
    linear-gradient(90deg, rgba(5,5,5,0.96) 0%, rgba(5,5,5,0.82) 48%, rgba(5,5,5,0.60) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 760px;
}
.hero-copy { max-width: 840px; }
.hero h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 11vw, 2.8rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.hero h2 span { display: block; }
.hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.98rem, 2.4vw, 1.12rem);
}
.benefit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.benefit-row span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(24,24,24,.82);
  color: #d4d4d4;
  font-size: .84rem;
}

.logged-greeting {
  display: grid;
  gap: 6px;
  max-width: 760px;
  padding: 26px 0 8px;
}
.logged-greeting[hidden] { display: none !important; }
.logged-greeting h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
}
.logged-greeting p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 24px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #121212;
  color: var(--muted);
  font-size: .84rem;
}
.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--muted); }
.is-online .dot, .is-synced .dot { background: var(--green); }
.is-offline .dot, .is-pending .dot, .is-syncing .dot { background: var(--yellow); }
.is-error .dot, .is-expired .dot { background: var(--red); }

.notice {
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid rgba(234,179,8,.32);
  border-radius: 12px;
  background: rgba(234,179,8,.08);
  color: #f8e7a6;
}

.home-section { margin-top: 24px; }
.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.section-heading h2 { margin: 0; font-size: 1rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: .9rem; }

.dashboard-summary, .summary-grid, .subscription-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.summary-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #1b1b1b, #141414);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.summary-card:hover {
  border-color: rgba(255,255,255,.12);
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(0,0,0,.24);
}
.summary-card span { color: var(--muted); font-size: .8rem; }
.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.08rem, 5vw, 1.45rem);
  line-height: 1.12;
}
.summary-card p { margin: 8px 0 0; color: var(--muted); font-size: .86rem; }
.summary-card.primary-metric { background: linear-gradient(180deg, #1c1c1c, #141414); }
.summary-card.secondary-metric strong { font-size: 1.08rem; }
.subscription-status-card {
  border-color: rgba(34,197,94,.28);
  background: linear-gradient(180deg, rgba(34,197,94,.08), #141414);
}
.payment-return-card {
  border-color: rgba(234,179,8,.32);
  background: linear-gradient(180deg, rgba(234,179,8,.08), #141414);
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.module-card, .record-card, .form-panel, .settings-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.module-card {
  width: 100%;
  min-height: 118px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 16px;
  color: inherit;
  text-align: left;
}
.module-card:hover {
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(180deg, #202020, #171717);
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(0,0,0,.22);
}
.module-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  background: linear-gradient(180deg, #222, #111);
  color: #d4d4d4;
  font-size: 1.15rem;
}
.module-card h3 { margin: 0 0 5px; font-size: 1rem; }
.module-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.module-arrow { color: var(--muted-2); font-size: 1.2rem; }

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.08);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.plans-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  width: 100%;
}

.plan-card { align-items: flex-start; }
.plan-card b {
  display: block;
  margin: 8px 0 4px;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1;
}
.plan-card ul {
  margin: 12px 0 16px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}
.featured-plan {
  border-color: rgba(34, 197, 94, 0.28);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(34, 197, 94, 0.08);
}

.view { display: none; }
.view.active { display: block; }
.screen-title {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin: 16px 0 18px;
}
.screen-title h2 { margin: 0 0 4px; font-size: 1.5rem; }
.screen-title p { margin: 0; color: var(--muted); font-size: .92rem; }

.view-header {
  display: grid;
  justify-items: start;
  gap: 12px;
  margin: 16px 0;
}
.view-header h2 { margin: 0 0 4px; font-size: 1.5rem; }
.view-header p { margin: 0; color: var(--muted); font-size: .92rem; }
.desktop-add { display: none; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #111;
  color: var(--text);
  font-size: 15px;
}
.input::placeholder, .textarea::placeholder { color: #737373; }
.textarea { min-height: 96px; padding: 14px; resize: vertical; }
label { display: grid; gap: 6px; color: #d4d4d4; font-size: 13px; font-weight: 600; }
.field-help { margin-top: -2px; color: #8a8a8a; font-size: 12px; font-weight: 400; }
.field-help[data-state="loading"] { color: #d4d4d4; }
.field-help[data-state="success"] { color: #86efac; }
.field-help[data-state="warning"] { color: #fde68a; }
.field-error { min-height: 16px; color: var(--red); font-size: 12px; font-weight: 500; }

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-export,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .12s ease, opacity .16s ease;
}
.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover,
.btn-export:hover,
.back-button:hover { background: var(--panel-2); }
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn-export:active,
.back-button:active { transform: scale(.98); }
.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.btn-export:disabled,
.back-button:disabled { cursor: not-allowed; opacity: .48; }
.btn.primary, .btn-primary {
  min-height: 48px;
  padding: 12px 20px;
  border-color: rgba(34,197,94,.42);
  border-radius: 14px;
  background: #12351f;
  color: #e7ffed;
  font-size: 15px;
  font-weight: 700;
}
.btn.secondary, .btn-secondary, .btn-export { background: #181818; }
.btn.danger, .btn-danger { border-color: rgba(239,68,68,.45); background: #351212; color: #ffe5e5; }
.btn.ghost, .btn-ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.back-btn, .back-button {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  justify-content: flex-start;
  background: transparent;
  color: #d4d4d4;
  font-size: 14px;
  font-weight: 600;
}
.link-btn {
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(34,197,94,.45);
  background: #12351f;
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  display: none;
  box-shadow: var(--shadow);
}
.fab.visible { display: grid; place-items: center; }

.form-panel {
  display: none;
  padding: 15px;
  margin-bottom: 16px;
}
.form-panel.open { display: block; }
.form-title {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-bottom: 14px;
}
.form-title h3 { margin: 0; font-size: 1.05rem; }
.form-section {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
}
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section h4 {
  margin: 0;
  color: #e5e5e5;
  font-size: .94rem;
}
.form-grid { display: grid; gap: 10px; }
.smart-field { position: relative; }
.smart-suggestions {
  position: relative;
  z-index: 12;
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(34,197,94,.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24,24,24,.98), rgba(13,13,13,.98));
  box-shadow: 0 18px 44px rgba(0,0,0,.32);
}
.smart-suggestions[hidden] { display: none !important; }
.smart-suggestion-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.smart-suggestion-card:hover,
.smart-suggestion-card:focus {
  border-color: rgba(34,197,94,.38);
  background: rgba(34,197,94,.055);
  outline: none;
  transform: translateY(-1px);
}
.smart-suggestion-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.smart-suggestion-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smart-suggestion-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smart-suggestion-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.smart-suggestion-stats span {
  display: grid;
  gap: 1px;
  min-width: 58px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #101010;
}
.smart-suggestion-stats small {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.smart-suggestion-stats strong {
  color: #dfffe8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.field-error {
  display: block;
  min-height: 16px;
  margin-top: 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}
.input.invalid,
.select.invalid {
  border-color: rgba(239,68,68,.72);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.password-strength {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 12px;
}
.password-strength strong {
  color: var(--text);
  font-size: 13px;
}
.password-strength-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #262626;
}
.password-strength-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width .2s ease, background .2s ease;
}
.password-strength.score-1 .password-strength-bar span { width: 20%; background: var(--red); }
.password-strength.score-2 .password-strength-bar span { width: 40%; background: #f97316; }
.password-strength.score-3 .password-strength-bar span { width: 60%; background: var(--yellow); }
.password-strength.score-4 .password-strength-bar span { width: 80%; background: #84cc16; }
.password-strength.score-5 .password-strength-bar span { width: 100%; background: var(--green); }
.password-strength ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}
.password-strength li.ok {
  color: #bbf7d0;
}

.list { display: grid; gap: 10px; margin-top: 12px; }
.record-card { padding: 14px; display: grid; gap: 10px; }
.record-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}
.record-main { min-width: 0; display: grid; gap: 10px; }
.record-title { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.record-title h3 { margin: 0; font-size: 1rem; }
.record-meta { color: var(--muted); font-size: .88rem; }
.record-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #252525; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.tag.warn { color: #fff3b0; background: #3b3108; }
.tag.good { color: #dfffe8; background: #12351f; }
.tag.bad { color: #ffe5e5; background: #351212; }

.thumb-button, .thumb-placeholder {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #202020, #111);
  color: #d4d4d4;
  font-weight: 800;
}
.thumb-button {
  padding: 0;
  cursor: zoom-in;
}
.thumb-button:hover { border-color: rgba(34,197,94,.45); }
.thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.client-thumb { border-radius: 999px; }
.product-thumb { border-radius: 14px; }

.image-field {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
}
.image-preview {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: #101010;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-controls { display: grid; gap: 10px; }
.image-controls input[type="file"] { display: none; }

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.82);
}
.image-lightbox[hidden] { display: none !important; }
.image-lightbox img {
  max-width: min(920px, 94vw);
  max-height: 86vh;
  border-radius: 18px;
  object-fit: contain;
  background: #111;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.image-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #181818;
  color: var(--text);
  font-size: 24px;
}
.no-scroll { overflow: hidden; }

.empty, .skeleton {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 24px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.015);
  color: var(--muted);
  text-align: left;
}
.empty img { opacity: .82; filter: drop-shadow(0 12px 24px rgba(0,0,0,.24)); }
.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.skeleton {
  background: linear-gradient(90deg, #121212, #202020, #121212);
  background-size: 200% 100%;
  animation: pulse 1.2s infinite;
  color: transparent;
}
@keyframes pulse { to { background-position: -200% 0; } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-end;
  background: rgba(0,0,0,.72);
  padding: 12px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(620px, 100%);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #101010;
  padding: 16px;
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-bottom: 8px;
}
.modal-header h2 { margin: 0; font-size: 1.2rem; }
.modal-helper, .trial-note { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.trial-note {
  padding: 10px 12px;
  border: 1px solid rgba(34,197,94,.22);
  border-radius: 10px;
  background: rgba(34,197,94,.07);
  color: #dfffe8;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tab.active { border-color: rgba(34,197,94,.45); color: #dfffe8; }
.auth-pane { display: none; }
.auth-pane.active { display: grid; gap: 10px; }
.checkbox { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.quick-actions { display: grid; gap: 8px; }

.checkout-modal {
  width: min(960px, 100%);
  padding: clamp(16px, 3vw, 24px);
}
.checkout-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.checkout-progress {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.checkout-progress span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.checkout-progress .active {
  border-color: rgba(34,197,94,.36);
  color: #dfffe8;
  background: rgba(34,197,94,.08);
}
.checkout-layout {
  display: grid;
  gap: 16px;
}
.checkout-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}
.checkout-main h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.25rem);
  line-height: 1.06;
}
.checkout-badge {
  width: max-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(34,197,94,.36);
  border-radius: 999px;
  background: rgba(34,197,94,.08);
  color: #dfffe8;
  font-size: 12px;
  font-weight: 800;
}
.checkout-trust-row,
.checkout-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checkout-trust-row span,
.checkout-methods span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-soft) 86%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.checkout-methods span {
  border-color: color-mix(in srgb, var(--border) 72%, var(--green));
}
.checkout-account {
  display: grid;
  gap: 3px;
  padding-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.checkout-account strong {
  color: var(--text);
  font-size: 15px;
}
.checkout-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, var(--green) 4%), var(--panel-soft));
}
.checkout-summary > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.checkout-summary > strong {
  font-size: 1.2rem;
  line-height: 1.1;
}
.checkout-summary > b {
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  line-height: 1;
}
.checkout-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.checkout-lines {
  display: grid;
  gap: 8px;
  margin: 4px 0;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.checkout-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.checkout-lines span {
  color: var(--muted);
}
.checkout-lines strong {
  text-align: right;
}
.checkout-confirm {
  width: 100%;
}
.checkout-coupon {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}
.checkout-coupon label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.checkout-coupon > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.checkout-coupon .btn {
  min-height: 40px;
}
.checkout-footnote {
  text-align: center;
}

.toast-stack {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 86px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #121212;
  color: var(--text);
  box-shadow: var(--shadow);
}

.settings-panel { display: grid; gap: 22px; }
.settings-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.user-settings-card {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, var(--green) 4%), var(--panel-soft));
}
.user-profile-form {
  display: grid;
  gap: 16px;
}
.user-logo-field {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.user-logo-preview {
  width: 118px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--green) 42%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  color: var(--green);
  font-weight: 900;
}
.user-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.user-logo-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}
.user-logo-actions strong,
.user-logo-actions p {
  flex-basis: 100%;
  margin: 0;
}
.user-logo-actions p {
  color: var(--muted);
  font-size: 13px;
}
.user-profile-actions {
  position: static;
  margin: 0;
  padding: 0;
  background: transparent;
}
.ops-grid { display: grid; gap: 18px; }
.ops-hero {
  border-color: rgba(34,197,94,.25);
  background: linear-gradient(180deg, rgba(34,197,94,.07), #141414);
}
.inline-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.pdv-terminal {
  display: grid;
  gap: 14px;
  padding: clamp(16px, 3vw, 22px);
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--accent-border) 72%, var(--border));
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(34,197,94,.16), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, #22c55e 8%), var(--panel-2));
  box-shadow: var(--premium-shadow);
}
.pdv-terminal-top {
  display: grid;
  gap: 14px;
}
.pdv-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pdv-terminal h3,
.pdv-panel h2 {
  margin: 0;
  letter-spacing: -0.02em;
}
.pdv-terminal p {
  margin: 6px 0 0;
  color: var(--muted);
}
.pdv-warning {
  display: inline-flex;
  margin-top: 8px;
  color: var(--yellow);
  font-weight: 700;
}
.pdv-cash-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
}
.pdv-cash-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pdv-cash-strip article {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
}
.pdv-cash-strip span,
.pdv-total-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.pdv-cash-strip strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1rem, 3vw, 1.25rem);
}
.pdv-layout {
  display: grid;
  gap: 16px;
}
.pdv-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, #22c55e 4%), var(--panel-2));
  box-shadow: 0 18px 46px rgba(0,0,0,.22);
}
.pdv-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.pdv-search-field {
  position: relative;
}
.pdv-search-field input {
  min-height: 54px;
  font-size: 16px;
  font-weight: 700;
}
.pdv-items,
.pdv-cart-items {
  display: grid;
  gap: 10px;
}
.pdv-item-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease-out), border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.pdv-item-card:hover {
  border-color: rgba(34,197,94,.35);
  background: color-mix(in srgb, var(--accent-soft) 52%, var(--panel));
  transform: translateY(-1px);
}
.pdv-item-card span { display: grid; gap: 3px; }
.pdv-item-type {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}
.pdv-item-price {
  text-align: right;
}
.pdv-item-card small,
.pdv-cart-row small { color: var(--muted); font-size: 12px; }
.pdv-item-card.manual { border-style: dashed; }
.pdv-cart-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-soft) 88%, transparent);
}
.pdv-row-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.pdv-row-controls label { display: grid; gap: 4px; }
.pdv-row-controls label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.pdv-line-total {
  justify-self: end;
  font-size: 1.05rem;
}
.pdv-client-box,
.quick-client {
  display: grid;
  gap: 10px;
}
.selected-client-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--accent-soft);
}
.selected-client-chip span {
  display: grid;
  gap: 2px;
}
.selected-client-chip small {
  color: var(--muted);
}
.quick-client {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-soft) 86%, transparent);
}
.quick-client summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}
.quick-client-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.pdv-payment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.pdv-total-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent-border) 72%, var(--border));
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(34,197,94,.18), transparent 42%),
    color-mix(in srgb, var(--panel) 90%, #22c55e 10%);
}
.pdv-total-card strong {
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}
.pdv-total-card p,
.pdv-total-card b {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.pdv-total-card b {
  color: var(--text);
}
.pdv-finalize {
  min-height: 56px;
  font-size: 16px;
}
.premium-client-suggestion {
  border-color: color-mix(in srgb, var(--accent-border) 70%, var(--border));
}
.empty.mini {
  padding: 14px;
  border-radius: 12px;
}
.reports-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 0%, var(--accent-soft), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 94%, var(--green) 6%), var(--panel-soft));
  box-shadow: var(--premium-shadow);
}
.reports-hero span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.reports-hero strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(2rem, 8vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.04em;
}
.reports-hero p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
}
.report-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
.report-metric.good { border-color: rgba(34, 197, 94, .28); }
.report-metric.warn { border-color: rgba(234, 179, 8, .28); }
.report-metric.bad { border-color: rgba(239, 68, 68, .28); }
.report-breakdown {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}
.report-lines {
  display: grid;
  gap: 8px;
}
.report-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}
.report-lines div:first-child { border-top: 0; }
.report-lines span { color: var(--muted); }
.report-lines strong { text-align: right; }
.danger-zone {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(239,68,68,.28);
  border-radius: 12px;
  background: rgba(239,68,68,.045);
}
.danger-zone h3 { margin: 0 0 4px; }
.danger-zone p { margin: 0; color: var(--muted); }

.bar { height: 7px; margin-top: 12px; border-radius: 999px; background: #282828; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); width: 0; }
.bar i.w1 { width: 10%; } .bar i.w2 { width: 20%; } .bar i.w3 { width: 30%; } .bar i.w4 { width: 40%; } .bar i.w5 { width: 50%; }
.bar i.w6 { width: 60%; } .bar i.w7 { width: 70%; } .bar i.w8 { width: 80%; } .bar i.w9 { width: 90%; } .bar i.w10 { width: 100%; }

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: .86rem;
}
.footer-links a { color: var(--muted); }

@media (max-width: 380px) {
  .dashboard-summary { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .profile-text { display: none; }
}

@media (min-width: 381px) and (max-width: 640px) {
  .dashboard-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .app-shell { padding-inline: 14px; }
  .topbar { min-height: 64px; padding: 8px 0; gap: 8px; }
  .brand { min-width: 0; flex: 1 1 auto; }
  .brand-subtitle { display: none; }
  .brand-title { font-size: 1rem; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-logo {
    width: clamp(108px, 34vw, 132px);
    max-height: 48px;
    border-radius: 10px;
  }
  .topbar-actions { flex: 0 0 auto; }
  .profile-menu-button { min-height: 40px; padding-inline: 10px; }
  .profile-dropdown { right: 0; width: calc(100vw - 32px); max-width: 280px; }
  .summary-card { padding: 13px; }
  .summary-card strong { font-size: 1.04rem; }
  .form-actions .btn.primary { width: 100%; }
  .checkout-top { align-items: flex-start; flex-direction: column; }
  .checkout-progress { width: 100%; }
  .checkout-progress span { flex: 1 1 auto; justify-content: center; }
  .record-layout { grid-template-columns: auto 1fr; gap: 10px; }
  .thumb-button, .thumb-placeholder { width: 46px; height: 46px; }
  .image-field { grid-template-columns: 1fr; }
  .image-preview { width: 100%; max-width: 180px; height: 150px; }
  .smart-suggestion-card { grid-template-columns: 1fr; }
  .smart-suggestion-stats { justify-content: flex-start; }
  .image-lightbox { padding: 16px; }
  .image-lightbox img { max-width: 94vw; max-height: 80vh; }
  .hero-section {
    min-height: auto;
    border-radius: 22px;
    padding: 28px 20px;
  }
  .hero-bg { opacity: .22; }
  .hero-overlay {
    background: linear-gradient(180deg, rgba(5,5,5,0.94), rgba(5,5,5,0.82));
  }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .module-card { min-height: 106px; padding: 14px; }
  .pdv-terminal {
    padding: 14px;
    border-radius: 16px;
  }
  .pdv-terminal h3 {
    font-size: 1.12rem;
    line-height: 1.18;
  }
  .pdv-cash-actions {
    grid-template-columns: 1fr;
  }
  .pdv-cash-actions .btn,
  .pdv-cash-actions .input {
    width: 100%;
  }
  .pdv-cash-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .pdv-cash-strip article {
    min-height: 64px;
    padding: 10px;
  }
  .pdv-cash-strip strong {
    font-size: .98rem;
    overflow-wrap: anywhere;
  }
  .pdv-panel {
    padding: 12px;
    border-radius: 16px;
  }
  .pdv-panel-head {
    align-items: flex-start;
    gap: 8px;
  }
  .pdv-panel-head h2 {
    font-size: 1.1rem;
  }
  .pdv-item-card {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 76px;
  }
  .pdv-item-type {
    width: 38px;
    height: 38px;
  }
  .pdv-item-price {
    grid-column: 2;
    text-align: left;
  }
  .pdv-row-controls {
    grid-template-columns: 1fr 1fr;
  }
  .pdv-row-controls .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
  .pdv-payment-grid {
    grid-template-columns: 1fr;
  }
  .pdv-total-card strong {
    font-size: clamp(1.8rem, 12vw, 2.4rem);
  }
  .pdv-finalize {
    width: 100%;
  }
}

@media (min-width: 641px) {
  .app-shell { padding-inline: 22px; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-summary, .summary-grid, .subscription-grid { grid-template-columns: repeat(2, 1fr); }
  .checkout-layout { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); align-items: start; }
  .inline-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .pdv-terminal-top { grid-template-columns: minmax(0, 1fr) minmax(260px, auto); align-items: end; }
  .pdv-cash-actions { grid-template-columns: repeat(3, auto); justify-content: end; }
  .pdv-terminal:not(:has(.pdv-cash-actions button + button)) .pdv-cash-actions { grid-template-columns: minmax(120px, 160px) minmax(140px, 1fr) auto; }
  .pdv-cash-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pdv-payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr auto auto; align-items: end; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .full { grid-column: 1 / -1; }
  .modal-backdrop { align-items: center; }
  .settings-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-client-grid { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .report-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
  .app-shell { padding-inline: 26px; }
  .hero { padding-top: 46px; }
  .hero h2 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.05;
  }
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-summary { grid-template-columns: repeat(4, 1fr); }
  .dashboard-summary .secondary-metric { grid-column: span 1; }
  .desktop-add { display: inline-flex; }
  .fab.visible { display: none; }
  .view-header {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .form-panel { padding: 18px; }
  .pdv-layout { grid-template-columns: minmax(0, 1.45fr) minmax(380px, .75fr); align-items: start; }
  .pdv-cart { position: sticky; top: 90px; }
  .report-card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Visual refresh: theme system, motion and richer interaction states. */
:root {
  --bg-elevated: rgba(23, 23, 23, .72);
  --glass: rgba(20, 20, 20, .72);
  --accent-soft: rgba(34, 197, 94, .12);
  --accent-border: rgba(34, 197, 94, .34);
  --ring: 0 0 0 4px rgba(34, 197, 94, .14);
  --premium-shadow: 0 22px 70px rgba(0, 0, 0, .34);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="light"] {
  --bg: #f7f7f2;
  --panel: #ffffff;
  --panel-2: #f1f4ef;
  --panel-soft: #f6f7f3;
  --border: #dde2d8;
  --border-soft: #e8ece3;
  --text: #171a16;
  --muted: #5f6a5d;
  --muted-2: #879083;
  --green: #15803d;
  --red: #dc2626;
  --yellow: #b7791f;
  --focus: #16a34a;
  --bg-elevated: rgba(255, 255, 255, .78);
  --glass: rgba(255, 255, 255, .76);
  --accent-soft: rgba(21, 128, 61, .10);
  --accent-border: rgba(21, 128, 61, .24);
  --ring: 0 0 0 4px rgba(21, 128, 61, .14);
  --shadow: 0 18px 44px rgba(40, 51, 34, .13);
  --premium-shadow: 0 24px 70px rgba(43, 56, 36, .16);
  color-scheme: light;
}

html {
  scroll-behavior: smooth;
}

body {
  transition: background-color .28s var(--ease-out), color .28s var(--ease-out);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(34, 197, 94, .13), transparent 28%),
    radial-gradient(circle at 90% 2%, rgba(250, 204, 21, .08), transparent 24%),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, .018));
  opacity: .9;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 10% -10%, rgba(21, 128, 61, .16), transparent 32%),
    radial-gradient(circle at 94% 0%, rgba(234, 179, 8, .12), transparent 28%),
    var(--bg);
}

:root[data-theme="light"] body::before {
  background:
    radial-gradient(circle at 12% 8%, rgba(21, 128, 61, .14), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(14, 116, 144, .08), transparent 24%);
}

.topbar {
  border-bottom: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
}

:root[data-theme="light"] .topbar {
  background: rgba(247, 247, 242, .86);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .18s var(--ease-out), border-color .18s var(--ease-out), background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}

.theme-toggle:hover,
.profile-menu-button:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: var(--ring);
}

.theme-toggle-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--green);
}

.profile-menu-button,
.profile-dropdown,
.modal,
.settings-panel,
.form-panel,
.record-card,
.module-card,
.summary-card,
.pdv-panel {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.profile-menu-button {
  background: var(--glass);
}

.profile-dropdown,
.modal {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--premium-shadow);
}

.profile-dropdown {
  transform-origin: top right;
  animation: dropdownIn .18s var(--ease-out);
}

.profile-dropdown button:hover,
.profile-dropdown button:focus {
  background: var(--panel-2);
  color: var(--text);
}

.brand-mark {
  position: relative;
  overflow: hidden;
  border-color: var(--accent-border);
  background: linear-gradient(145deg, var(--accent-soft), var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 12px 28px rgba(0,0,0,.16);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -60% auto auto -30%;
  width: 80%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  transform: rotate(24deg);
  animation: brandSweep 5.8s ease-in-out infinite;
}

.hero-section {
  isolation: isolate;
  box-shadow: var(--premium-shadow);
  animation: heroIn .55s var(--ease-out) both;
}

:root[data-theme="light"] .hero-section {
  background: #142116;
  color: #f8fff8;
}

:root[data-theme="light"] .hero-section .hero p,
:root[data-theme="light"] .hero-section p {
  color: rgba(248, 255, 248, .78);
}

.hero-bg {
  animation: slowPan 22s ease-in-out infinite alternate;
}

.hero-content {
  animation: contentRise .65s .08s var(--ease-out) both;
}

.benefit-row span,
.status-pill,
.tag,
.access-badge {
  transition: transform .18s var(--ease-out), border-color .18s var(--ease-out), background .18s var(--ease-out);
}

.benefit-row span:hover,
.status-pill:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border);
}

.summary-card,
.module-card,
.record-card,
.form-panel,
.settings-panel,
.pdv-panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, white 2%), color-mix(in srgb, var(--panel) 94%, black 6%));
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 14px 34px rgba(0,0,0,.14);
  transition:
    transform .22s var(--ease-out),
    border-color .22s var(--ease-out),
    box-shadow .22s var(--ease-out),
    background .22s var(--ease-out);
}

:root[data-theme="light"] .summary-card,
:root[data-theme="light"] .module-card,
:root[data-theme="light"] .record-card,
:root[data-theme="light"] .form-panel,
:root[data-theme="light"] .settings-panel,
:root[data-theme="light"] .pdv-panel {
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(250,252,247,.9));
}

.summary-card:hover,
.module-card:hover,
.record-card:hover,
.pdv-item-card:hover,
.smart-suggestion-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: var(--premium-shadow);
}

.module-card {
  position: relative;
  overflow: hidden;
}

.module-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0%, rgba(34,197,94,.08) 42%, transparent 68%);
  opacity: 0;
  transform: translateX(-22%);
  transition: opacity .22s var(--ease-out), transform .36s var(--ease-out);
}

.module-card:hover::after {
  opacity: 1;
  transform: translateX(18%);
}

.module-icon,
.empty-icon,
.thumb-button,
.thumb-placeholder {
  background: linear-gradient(145deg, var(--accent-soft), var(--panel-soft));
  border-color: color-mix(in srgb, var(--border) 72%, var(--green));
}

.module-arrow {
  transition: transform .18s var(--ease-out), color .18s var(--ease-out);
}

.module-card:hover .module-arrow {
  transform: translateX(3px);
  color: var(--green);
}

.input,
.select,
.textarea {
  background: color-mix(in srgb, var(--panel-soft) 88%, black 6%);
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out), transform .18s var(--ease-out);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .textarea {
  background: #fbfcf8;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-border);
  box-shadow: var(--ring);
  outline: none;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-export,
.back-button {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.btn::after,
.btn-primary::after,
.btn-secondary::after,
.btn-ghost::after,
.btn-danger::after,
.btn-export::after,
.back-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.12), transparent);
  opacity: 0;
  transform: translateX(-60%);
  transition: opacity .18s var(--ease-out), transform .34s var(--ease-out);
}

.btn:hover::after,
.btn-primary:hover::after,
.btn-secondary:hover::after,
.btn-ghost:hover::after,
.btn-danger:hover::after,
.btn-export:hover::after,
.back-button:hover::after {
  opacity: 1;
  transform: translateX(60%);
}

.btn.primary,
.btn-primary,
.fab {
  background: linear-gradient(135deg, #0f3a22, #176b36);
  border-color: rgba(34,197,94,.52);
  box-shadow: 0 16px 34px rgba(22, 101, 52, .20);
}

:root[data-theme="light"] .btn.primary,
:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] .fab {
  background: linear-gradient(135deg, #15803d, #22a052);
  color: #fff;
}

.fab {
  animation: fabIn .32s var(--ease-out) both;
}

.fab:hover {
  transform: translateY(-3px) scale(1.03);
}

.view.active.view-enter {
  animation: viewIn .28s var(--ease-out) both;
}

.list > *,
.dashboard-summary > *,
.summary-grid > *,
.module-grid > *,
.plans-grid > * {
  animation: contentRise .42s var(--ease-out) both;
}

.module-grid > *:nth-child(2),
.dashboard-summary > *:nth-child(2),
.summary-grid > *:nth-child(2),
.plans-grid > *:nth-child(2) { animation-delay: .03s; }
.module-grid > *:nth-child(3),
.dashboard-summary > *:nth-child(3),
.summary-grid > *:nth-child(3),
.plans-grid > *:nth-child(3) { animation-delay: .06s; }
.module-grid > *:nth-child(4),
.dashboard-summary > *:nth-child(4),
.summary-grid > *:nth-child(4),
.plans-grid > *:nth-child(4) { animation-delay: .09s; }

.modal-backdrop.open {
  animation: backdropIn .18s var(--ease-out) both;
}

.modal-backdrop.open .modal {
  animation: modalIn .24s var(--ease-out) both;
}

.toast {
  border-color: color-mix(in srgb, var(--border) 74%, var(--green));
  background: color-mix(in srgb, var(--panel) 94%, var(--green) 6%);
  animation: toastIn .24s var(--ease-out) both;
}

.toast.error {
  border-color: rgba(239, 68, 68, .34);
  background: color-mix(in srgb, var(--panel) 90%, var(--red) 10%);
}

.empty {
  background:
    radial-gradient(circle at 10% 0%, var(--accent-soft), transparent 34%),
    color-mix(in srgb, var(--panel) 82%, transparent);
  border-style: solid;
  justify-items: center;
  text-align: center;
}

.skeleton {
  background: linear-gradient(90deg, var(--panel-soft), var(--panel-2), var(--panel-soft));
  background-size: 200% 100%;
}

.bar {
  background: color-mix(in srgb, var(--border) 72%, transparent);
}

.bar i {
  background: linear-gradient(90deg, var(--green), #86efac);
  box-shadow: 0 0 18px rgba(34, 197, 94, .24);
}

.image-lightbox {
  animation: backdropIn .18s var(--ease-out) both;
}

.image-lightbox img {
  animation: modalIn .24s var(--ease-out) both;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(10px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes contentRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes viewIn {
  from { opacity: .72; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fabIn {
  from { opacity: 0; transform: translateY(12px) scale(.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slowPan {
  from { transform: scale(1.03) translate3d(-.8%, -.4%, 0); }
  to { transform: scale(1.08) translate3d(.8%, .4%, 0); }
}

@keyframes brandSweep {
  0%, 72%, 100% { transform: translateX(-140%) rotate(24deg); opacity: 0; }
  78% { opacity: .75; }
  88% { transform: translateX(220%) rotate(24deg); opacity: 0; }
}

@media (max-width: 640px) {
  .topbar-actions { gap: 6px; }
  .theme-toggle {
    width: 40px;
    padding: 8px;
    justify-content: center;
  }
  .theme-toggle-text { display: none; }
  .theme-toggle-icon {
    width: 22px;
    height: 22px;
  }
}

/* Native PWA polish: bottom tabs, touch feedback, pull refresh and skeleton states. */
body,
.hero h2,
.pdv-total-card strong {
  letter-spacing: 0;
}

.app-shell {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.bottom-tabs {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 45;
  width: min(620px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0 auto;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 22px 60px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-tab {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  transition: color .18s var(--ease-out), background .18s var(--ease-out), transform .18s var(--ease-out);
  touch-action: manipulation;
}

.bottom-tab small {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-tab.active {
  background: var(--accent-soft);
  color: var(--text);
}

.bottom-tab.active span {
  color: var(--green);
}

.bottom-tab:active {
  transform: scale(.96);
}

.tap-ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  opacity: .18;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.35);
  animation: tapRipple .48s var(--ease-out) forwards;
}

.pull-refresh {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  z-index: 120;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px) scale(.96);
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pull-refresh.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.pull-refresh.ready {
  border-color: rgba(34,197,94,.5);
  background: color-mix(in srgb, var(--panel) 86%, var(--green) 10%);
}

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

.skeleton-card {
  display: grid;
  gap: 12px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}

.skeleton-line {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--panel-soft), var(--panel-2), var(--panel-soft));
  background-size: 200% 100%;
  animation: pulse 1.15s infinite;
}

.skeleton-line.short { width: 42%; }
.skeleton-line.medium { width: 66%; }
.skeleton-line.long { width: 88%; }

.record-card,
.module-card,
.pdv-item-card,
.smart-suggestion-card,
.bottom-tab,
.profile-menu-button,
.theme-toggle,
.profile-dropdown button {
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.fab {
  bottom: calc(88px + env(safe-area-inset-bottom));
}

.toast-stack {
  bottom: calc(92px + env(safe-area-inset-bottom));
}

@keyframes tapRipple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(8);
  }
}

@media (max-width: 420px) {
  .bottom-tabs {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    width: calc(100% - 16px);
    padding: 6px;
    border-radius: 20px;
  }

  .bottom-tab {
    min-height: 50px;
    font-size: 17px;
  }

  .bottom-tab small {
    font-size: 10px;
  }
}

/* Professional layout pass: denser cards, polished settings and cleaner light mode. */
.topbar {
  min-height: 68px;
  padding-block: 8px;
}

.brand {
  min-height: 52px;
}

.brand-logo {
  width: clamp(168px, 24vw, 224px);
  max-height: 56px;
  border-radius: 10px;
  transform: translateX(-6px) scale(1.08);
  transform-origin: left center;
}

.section-heading {
  align-items: end;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 14px;
}

.section-heading h2,
.screen-title h2,
.view-header h2 {
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: 1.08rem;
  line-height: 1.16;
}

.dashboard-summary,
.summary-grid,
.subscription-grid,
.module-grid,
.plans-grid,
.report-card-grid {
  gap: 12px;
}

.summary-card,
.module-card,
.record-card,
.form-panel,
.settings-panel,
.pdv-panel,
.report-breakdown,
.checkout-summary {
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, white 2%), color-mix(in srgb, var(--panel) 96%, black 4%));
  box-shadow: 0 1px 0 rgba(255,255,255,.045) inset, 0 12px 30px rgba(0,0,0,.12);
}

.summary-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
}

.summary-card span,
.checkout-summary > span,
.reports-hero span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.summary-card strong {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.36rem);
  letter-spacing: 0;
}

.summary-card p {
  margin: 0;
  line-height: 1.42;
}

.compact-card {
  min-height: 0;
  padding: 14px;
}

.module-card {
  min-height: 104px;
  padding: 15px;
  border-radius: 10px;
}

.module-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.record-card {
  padding: 13px;
  border-radius: 10px;
}

.record-title h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.record-meta {
  line-height: 1.38;
}

.toolbar {
  gap: 10px;
  align-items: end;
}

.toolbar label,
.form-grid label,
.inline-form label,
.danger-zone label {
  min-width: 0;
}

.input,
.select,
.textarea {
  border-radius: 10px;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-export,
.back-button {
  border-radius: 10px;
}

.btn.primary,
.btn-primary {
  border-radius: 12px;
}

.view[data-view="configuracoes"] > .screen-title {
  position: relative;
  overflow: hidden;
  min-height: 136px;
  align-items: end;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 10% 0%, var(--accent-soft), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 92%, var(--green) 6%), var(--panel-soft));
  box-shadow: var(--premium-shadow);
}

.view[data-view="configuracoes"] > .screen-title::after {
  content: "";
  position: absolute;
  inset: auto -10% -45% 38%;
  height: 150px;
  background: radial-gradient(circle, color-mix(in srgb, var(--green) 20%, transparent), transparent 62%);
  pointer-events: none;
}

.view[data-view="configuracoes"] > .screen-title .back-btn {
  position: relative;
  z-index: 1;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
}

.view[data-view="configuracoes"] > .screen-title div {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.view[data-view="configuracoes"] > .screen-title h2 {
  font-size: clamp(1.75rem, 6vw, 2.65rem);
  line-height: 1.04;
}

.view[data-view="configuracoes"] > .screen-title p {
  max-width: 560px;
  font-size: .98rem;
}

.settings-panel {
  gap: 18px;
  padding: clamp(14px, 3vw, 20px);
  border-radius: 14px;
}

.settings-panel > .section-heading {
  margin: 4px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.user-settings-card .section-heading {
  margin: 0;
}

.user-settings-card .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}

.subscription-grid {
  grid-template-columns: 1fr;
}

.subscription-hero {
  min-height: 154px;
  padding: clamp(18px, 4vw, 24px);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--green) 18%, transparent), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 90%, var(--green) 7%), var(--panel-soft));
}

.subscription-hero strong {
  max-width: 780px;
  font-size: clamp(1.5rem, 5vw, 2.35rem);
  line-height: 1.05;
}

.subscription-hero p {
  max-width: 680px;
  font-size: .96rem;
}

.subscription-alert {
  min-height: 0;
  border-color: rgba(234,179,8,.34);
}

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

.subscription-metrics .compact-card strong {
  font-size: clamp(1rem, 2.3vw, 1.24rem);
}

.subscription-heading {
  margin-top: 4px;
}

.plans-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.plan-card {
  position: relative;
  min-height: 302px;
  padding: 16px;
  gap: 10px;
}

.plan-card-head {
  display: grid;
  gap: 6px;
}

.plan-card b {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0;
}

.plan-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.plan-card .btn {
  align-self: end;
  width: 100%;
  margin-top: auto;
}

.featured-plan {
  border-color: color-mix(in srgb, var(--green) 38%, var(--border));
  background:
    radial-gradient(circle at 16% 0%, color-mix(in srgb, var(--green) 16%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, var(--green) 5%), var(--panel));
}

.legal-note {
  border-style: dashed;
}

.settings-actions {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.settings-actions .btn {
  justify-content: flex-start;
  min-height: 46px;
}

.danger-zone {
  grid-template-columns: minmax(0, 1fr);
  padding: 16px;
  border-radius: 12px;
}

.danger-zone h3 {
  font-size: 1.02rem;
}

@media (min-width: 641px) {
  .section-heading {
    grid-template-columns: minmax(0, 1fr);
  }

  .subscription-grid {
    grid-template-columns: 1fr;
  }

  .subscription-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .view[data-view="configuracoes"] > .screen-title {
    grid-template-columns: auto 1fr;
    align-items: end;
  }

  .danger-zone {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
    align-items: end;
  }
}

@media (min-width: 1025px) {
  .plans-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 64px;
  }

  .brand-logo {
    width: clamp(132px, 42vw, 164px);
    max-height: 45px;
    transform: translateX(-5px) scale(1.06);
  }

  .settings-panel {
    padding: 12px;
  }

  .subscription-metrics {
    grid-template-columns: 1fr;
  }

  .plan-card {
    min-height: 0;
  }
}

:root[data-theme="light"] a {
  color: #255c35;
  text-decoration-color: rgba(21, 128, 61, .36);
}

:root[data-theme="light"] .topbar {
  background: rgba(247, 247, 242, .9);
  box-shadow: 0 1px 0 rgba(31, 41, 28, .06);
}

:root[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 8px 18px rgba(31, 41, 28, .12));
}

:root[data-theme="light"] .profile-dropdown,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .bottom-tabs,
:root[data-theme="light"] .pull-refresh {
  background: rgba(255,255,255,.9);
}

:root[data-theme="light"] .summary-card,
:root[data-theme="light"] .module-card,
:root[data-theme="light"] .record-card,
:root[data-theme="light"] .form-panel,
:root[data-theme="light"] .settings-panel,
:root[data-theme="light"] .pdv-panel,
:root[data-theme="light"] .report-breakdown,
:root[data-theme="light"] .checkout-summary {
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(250,252,247,.92));
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 14px 32px rgba(40, 51, 34, .08);
}

:root[data-theme="light"] .view[data-view="configuracoes"] > .screen-title,
:root[data-theme="light"] .subscription-hero {
  background:
    radial-gradient(circle at 14% 0%, rgba(21, 128, 61, .14), transparent 36%),
    linear-gradient(135deg, #ffffff, #eef5ea);
}

:root[data-theme="light"] .subscription-status-card,
:root[data-theme="light"] .featured-plan {
  background:
    radial-gradient(circle at 12% 0%, rgba(21, 128, 61, .12), transparent 36%),
    linear-gradient(180deg, #ffffff, #eff7ef);
}

:root[data-theme="light"] .payment-return-card,
:root[data-theme="light"] .notice {
  color: #6f4e00;
  background: rgba(180, 83, 9, .08);
}

:root[data-theme="light"] .status-pill,
:root[data-theme="light"] .tag {
  background: #ffffff;
}

:root[data-theme="light"] .tag.warn {
  color: #7a5400;
  background: #fff4cc;
}

:root[data-theme="light"] .tag.good {
  color: #166534;
  background: #dcfce7;
}

:root[data-theme="light"] .tag.bad {
  color: #991b1b;
  background: #fee2e2;
}

:root[data-theme="light"] .btn.secondary,
:root[data-theme="light"] .btn-secondary,
:root[data-theme="light"] .btn-export,
:root[data-theme="light"] .btn.ghost,
:root[data-theme="light"] .btn-ghost,
:root[data-theme="light"] .back-btn,
:root[data-theme="light"] .back-button {
  background: rgba(255,255,255,.7);
  color: var(--text);
}

:root[data-theme="light"] .btn.danger,
:root[data-theme="light"] .btn-danger,
:root[data-theme="light"] .danger-zone {
  background: rgba(220,38,38,.06);
  color: var(--text);
}

:root[data-theme="light"] label,
:root[data-theme="light"] .form-section h4,
:root[data-theme="light"] .profile-icon,
:root[data-theme="light"] .back-btn,
:root[data-theme="light"] .back-button {
  color: var(--text);
}

:root[data-theme="light"] .module-icon,
:root[data-theme="light"] .empty-icon,
:root[data-theme="light"] .thumb-button,
:root[data-theme="light"] .thumb-placeholder {
  color: var(--green);
  background: #eef8ef;
}

:root[data-theme="light"] .trial-note,
:root[data-theme="light"] .access-badge,
:root[data-theme="light"] .checkout-badge,
:root[data-theme="light"] .checkout-progress .active {
  color: #166534;
}

:root[data-theme="light"] .brand-mark,
:root[data-theme="light"] .module-icon,
:root[data-theme="light"] .benefit-row span,
:root[data-theme="light"] .status-pill,
:root[data-theme="light"] .profile-menu-summary,
:root[data-theme="light"] .checkout-trust-row span,
:root[data-theme="light"] .checkout-methods span {
  background: rgba(255,255,255,.72);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .textarea {
  color: var(--text);
  background: #ffffff;
}

:root[data-theme="light"] .input::placeholder,
:root[data-theme="light"] .textarea::placeholder,
:root[data-theme="light"] .field-help {
  color: #7b8577;
}

:root[data-theme="light"] .field-help[data-state="loading"] {
  color: var(--text);
}

:root[data-theme="light"] .smart-suggestions,
:root[data-theme="light"] .smart-suggestion-card,
:root[data-theme="light"] .quick-client,
:root[data-theme="light"] .selected-client-chip,
:root[data-theme="light"] .pdv-item-card,
:root[data-theme="light"] .pdv-cart-row {
  background: #ffffff;
}

:root[data-theme="light"] .tab.active {
  color: #166534;
}

:root[data-theme="light"] .password-strength-bar,
:root[data-theme="light"] .bar {
  background: #e3e9df;
}

:root[data-theme="light"] .toast {
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .image-lightbox-close {
  background: #ffffff;
}

/* Figma-inspired full frontend redesign: editorial landing + polished app surfaces. */
:root {
  --ink: #f8fafc;
  --paper: #f8faf5;
  --brand-a: #22c55e;
  --brand-b: #0ea5e9;
  --brand-c: #f59e0b;
  --brand-d: #f43f5e;
  --surface-line: color-mix(in srgb, var(--border) 72%, transparent);
  --soft-card-shadow: 0 22px 70px rgba(0, 0, 0, .22);
}

:root[data-theme="light"] {
  --bg: #f4f7ee;
  --panel: #ffffff;
  --panel-2: #eef5ea;
  --panel-soft: #f8fbf5;
  --border: #dfe8d9;
  --border-soft: #edf2e8;
  --text: #162016;
  --muted: #66725f;
  --muted-2: #8b9587;
  --glass: rgba(255,255,255,.76);
  --premium-shadow: 0 28px 80px rgba(38, 56, 34, .14);
}

body {
  background:
    radial-gradient(circle at 4% 0%, rgba(34,197,94,.18), transparent 28%),
    radial-gradient(circle at 96% 4%, rgba(14,165,233,.14), transparent 26%),
    radial-gradient(circle at 74% 92%, rgba(245,158,11,.10), transparent 24%),
    var(--bg);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 4% 0%, rgba(34,197,94,.20), transparent 30%),
    radial-gradient(circle at 96% 4%, rgba(14,165,233,.16), transparent 28%),
    linear-gradient(180deg, #fbfcf7 0%, #f4f7ee 46%, #edf5ee 100%);
}

.app-shell {
  width: min(1220px, 100%);
}

.topbar {
  min-height: 72px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
}

.brand-logo {
  width: clamp(188px, 22vw, 250px);
  max-height: 58px;
  transform: translateX(-10px) scale(1.08);
  filter: drop-shadow(0 14px 26px rgba(0,0,0,.18));
}

.theme-toggle,
.profile-menu-button,
.bottom-tabs {
  border-color: color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--panel) 76%, transparent);
}

.profile-menu-button {
  min-height: 46px;
  padding-inline: 15px;
}

.hero-section {
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .72fr);
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
  margin-top: 8px;
  padding: clamp(24px, 4vw, 46px);
  border: 0;
  border-radius: 34px;
  background:
    radial-gradient(circle at 14% 12%, rgba(34,197,94,.22), transparent 28%),
    linear-gradient(135deg, #08130d 0%, #101b17 48%, #0c2530 100%);
  color: #f8fafc;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .34);
}

:root[data-theme="light"] .hero-section {
  background:
    radial-gradient(circle at 12% 8%, rgba(34,197,94,.18), transparent 30%),
    radial-gradient(circle at 84% 16%, rgba(14,165,233,.18), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #eef8f0 54%, #e8f5fb 100%);
  color: var(--text);
  box-shadow: 0 34px 100px rgba(45, 68, 38, .16);
}

.hero-bg,
.hero-overlay {
  display: none;
}

.hero-content {
  max-width: 760px;
}

.hero-kicker,
.section-eyebrow {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid rgba(34,197,94,.34);
  border-radius: 999px;
  background: rgba(34,197,94,.12);
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

:root[data-theme="light"] .hero-kicker,
:root[data-theme="light"] .section-eyebrow {
  color: #166534;
  background: rgba(34,197,94,.11);
}

.hero h2 {
  max-width: 720px;
  margin: 12px 0 12px;
  font-size: clamp(2.45rem, 5.5vw, 4.65rem);
  line-height: .98;
  font-weight: 950;
  letter-spacing: 0;
}

.hero p {
  max-width: 600px;
  color: rgba(248,250,252,.76);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

:root[data-theme="light"] .hero p {
  color: #53604f;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-actions .btn {
  min-height: 50px;
  padding-inline: 20px;
}

.benefit-row {
  margin-top: 16px;
}

.benefit-row span {
  min-height: 34px;
  padding: 7px 12px;
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(248,250,252,.84);
  font-weight: 800;
}

:root[data-theme="light"] .benefit-row span {
  border-color: rgba(22,32,22,.08);
  color: #334233;
  background: rgba(255,255,255,.68);
}

.hero-product {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.hero-product::before,
.hero-product::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.hero-product::before {
  width: 92px;
  height: 92px;
  right: -16px;
  top: -24px;
  background: linear-gradient(135deg, var(--brand-b), var(--brand-a));
  opacity: .78;
}

.hero-product::after {
  width: 54px;
  height: 54px;
  left: -18px;
  bottom: 20px;
  background: linear-gradient(135deg, var(--brand-c), var(--brand-d));
  opacity: .78;
}

.hero-window {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px;
  background: rgba(8, 19, 13, .72);
  box-shadow: 0 30px 90px rgba(0,0,0,.36);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

:root[data-theme="light"] .hero-window {
  border-color: rgba(40, 61, 38, .12);
  background: rgba(255,255,255,.78);
  box-shadow: 0 28px 84px rgba(53, 76, 48, .16);
}

.hero-window-top {
  display: flex;
  gap: 7px;
}

.hero-window-top span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.36);
}

.hero-window-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hero-window-grid article,
.landing-preview-card,
.landing-feature-grid article {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}

.hero-window-grid article {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 11px;
}

.hero-window-grid span,
.preview-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hero-window-grid strong {
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.hero-window-grid i {
  display: block;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-b), transparent);
}

.hero-window-grid i.up { background: linear-gradient(90deg, var(--brand-a), transparent); }
.hero-window-grid i.ok { background: linear-gradient(90deg, var(--brand-c), transparent); }

.hero-chart {
  height: 132px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  align-items: end;
  padding: 13px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
}

.hero-chart span {
  display: block;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--brand-a), var(--brand-b));
}

.hero-chart span:nth-child(1) { height: 46%; }
.hero-chart span:nth-child(2) { height: 72%; }
.hero-chart span:nth-child(3) { height: 58%; }
.hero-chart span:nth-child(4) { height: 86%; }
.hero-chart span:nth-child(5) { height: 64%; }

.hero-list {
  display: grid;
  gap: 7px;
}

.hero-list div {
  display: grid;
  grid-template-columns: 30px 1fr 60px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
}

.hero-list b,
.hero-list span,
.hero-list strong {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
}

.hero-list b {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
}

.landing-flow {
  display: grid;
  gap: clamp(22px, 4vw, 36px);
  margin-top: 26px;
}

.landing-flow[hidden],
.app-home-content[hidden] {
  display: none !important;
}

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

.landing-strip span {
  min-height: 66px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--surface-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--text);
  font-weight: 900;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.landing-section {
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--surface-line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  box-shadow: var(--premium-shadow);
}

.landing-split {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(320px, 1fr);
  align-items: center;
  gap: clamp(18px, 4vw, 36px);
}

.section-heading.centered {
  justify-items: center;
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}

.landing-section .section-heading h2 {
  max-width: 760px;
  font-size: clamp(1.65rem, 4.5vw, 3rem);
  line-height: 1.03;
  font-weight: 950;
}

.landing-section .section-heading p {
  max-width: 620px;
  font-size: 1rem;
}

.landing-preview-card {
  display: grid;
  gap: 16px;
  min-height: 320px;
  padding: 18px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand-b) 14%, transparent), transparent 36%),
    color-mix(in srgb, var(--panel) 92%, transparent);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-header span {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
}

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

.preview-metrics article {
  display: grid;
  gap: 6px;
  min-height: 102px;
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel-soft) 82%, transparent);
}

.preview-metrics strong {
  font-size: clamp(1rem, 2.6vw, 1.45rem);
}

.preview-timeline {
  display: grid;
  gap: 12px;
  align-self: end;
}

.preview-timeline span {
  display: block;
  width: var(--w);
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b));
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.landing-feature-grid article {
  min-height: 210px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
}

.landing-feature-grid article > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-b) 14%, var(--panel));
  color: var(--brand-b);
  font-size: 12px;
  font-weight: 950;
}

.landing-feature-grid strong {
  font-size: 1.1rem;
  line-height: 1.15;
}

.landing-feature-grid p,
.landing-cta p {
  margin: 0;
  color: var(--muted);
}

.landing-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  background:
    radial-gradient(circle at 88% 10%, color-mix(in srgb, var(--brand-c) 18%, transparent), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 92%, var(--brand-a) 4%), color-mix(in srgb, var(--panel) 92%, var(--brand-b) 5%));
}

.landing-cta h2 {
  margin: 8px 0;
  font-size: clamp(1.55rem, 4vw, 2.65rem);
  line-height: 1.03;
}

.landing-cta .btn {
  min-width: 210px;
  min-height: 56px;
}

.logged-greeting {
  position: relative;
  overflow: hidden;
  max-width: none;
  margin-top: 14px;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid var(--surface-line);
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--brand-a) 18%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 90%, var(--brand-b) 5%), var(--panel));
  box-shadow: var(--premium-shadow);
}

.logged-greeting h2 {
  max-width: 780px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0;
}

.status-row {
  margin: 18px 0;
}

.status-pill {
  min-height: 38px;
  padding-inline: 13px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.screen-title,
.view-header {
  position: relative;
  overflow: hidden;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--surface-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand-a) 12%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel) 84%, transparent);
  box-shadow: var(--premium-shadow);
}

.view-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.screen-title h2,
.view-header h2 {
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  font-weight: 950;
  line-height: 1;
}

.toolbar,
.settings-panel,
.form-panel,
.report-breakdown,
.pdv-panel {
  border-radius: 22px;
}

.toolbar {
  padding: 12px;
  border: 1px solid var(--surface-line);
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  box-shadow: 0 12px 34px rgba(0,0,0,.08);
}

.summary-card,
.module-card,
.record-card,
.form-panel,
.settings-panel,
.pdv-panel,
.plan-card,
.checkout-summary,
.modal {
  border-radius: 20px;
  border-color: var(--surface-line);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 48px rgba(0,0,0,.12);
}

.summary-card,
.record-card,
.module-card {
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand-a) 7%, transparent), transparent 36%),
    color-mix(in srgb, var(--panel) 86%, transparent);
}

.summary-card.primary-metric,
.subscription-hero,
.featured-plan {
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--brand-a) 16%, transparent), transparent 34%),
    radial-gradient(circle at 86% 8%, color-mix(in srgb, var(--brand-b) 10%, transparent), transparent 28%),
    color-mix(in srgb, var(--panel) 88%, transparent);
}

.module-card {
  min-height: 116px;
}

.module-icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-a) 18%, var(--panel)), color-mix(in srgb, var(--brand-b) 12%, var(--panel)));
  color: var(--brand-a);
}

.record-actions {
  gap: 8px;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-export,
.back-button,
.input,
.select,
.textarea {
  border-radius: 14px;
}

.btn.primary,
.btn-primary {
  min-height: 50px;
  background: linear-gradient(135deg, #16a34a, #0ea5e9);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 18px 40px rgba(14, 165, 233, .18);
}

.btn.ghost,
.btn-ghost,
.back-btn,
.back-button {
  background: color-mix(in srgb, var(--panel) 62%, transparent);
}

.input,
.select,
.textarea {
  min-height: 48px;
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
}

.modal {
  border-radius: 28px;
  padding: clamp(18px, 3vw, 26px);
}

.modal-backdrop {
  background:
    radial-gradient(circle at 50% 0%, rgba(34,197,94,.12), transparent 36%),
    rgba(0,0,0,.68);
}

.checkout-modal {
  width: min(1040px, 100%);
}

.checkout-summary,
.checkout-main {
  border-radius: 24px;
}

.plans-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-card {
  min-height: 320px;
}

.bottom-tabs {
  border-radius: 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.20);
}

.bottom-tab {
  border-radius: 20px;
}

.fab {
  background: linear-gradient(135deg, #16a34a, #0ea5e9);
}

.legal-brand {
  width: max-content;
  margin: 10px 0 8px;
}

.legal-brand .brand-logo {
  width: clamp(170px, 26vw, 240px);
  max-height: 82px;
  transform: none;
}

@media (min-width: 1025px) {
  .app-shell {
    padding-inline: 30px;
  }

  .hero-section {
    grid-template-columns: minmax(0, 1.18fr) minmax(360px, .72fr);
    min-height: clamp(460px, 58vh, 560px);
  }

  .hero-copy {
    max-width: 760px;
  }

  .hero-product {
    justify-self: end;
    width: min(420px, 100%);
  }

  .landing-flow {
    margin-top: 22px;
  }

  .dashboard-summary {
    grid-template-columns: 1.15fr repeat(3, .95fr);
  }

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

@media (max-width: 900px) {
  .hero-section,
  .landing-split,
  .landing-cta {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
    padding: clamp(24px, 5vw, 38px);
  }

  .hero-product {
    order: -1;
  }

  .hero-window {
    max-width: 460px;
    margin-inline: auto;
  }

  .landing-strip,
  .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    min-height: 62px;
  }

  .brand-logo {
    width: clamp(146px, 46vw, 176px);
    max-height: 44px;
    transform: translateX(-8px) scale(1.08);
  }

  .hero-section {
    min-height: auto;
    gap: 18px;
    border-radius: 26px;
    padding: 22px;
  }

  .hero-product {
    display: none;
  }

  .hero h2 {
    font-size: clamp(2rem, 11vw, 3rem);
    line-height: 1.02;
  }

  .hero-kicker,
  .section-eyebrow {
    min-height: 28px;
    font-size: 11px;
  }

  .hero p {
    font-size: .96rem;
  }

  .benefit-row {
    gap: 7px;
  }

  .benefit-row span {
    min-height: 32px;
    font-size: .78rem;
  }

  .hero-actions .btn,
  .landing-cta .btn {
    width: 100%;
  }

  .landing-strip,
  .landing-feature-grid,
  .preview-metrics {
    grid-template-columns: 1fr;
  }

  .landing-section,
  .screen-title,
  .view-header,
  .logged-greeting {
    border-radius: 22px;
  }

  .view-header {
    grid-template-columns: 1fr;
  }

  .toolbar {
    padding: 10px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}

.app-shell {
  padding-top: 0;
}

#views {
  padding-top: 12px;
}

.topbar {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: 72px;
  padding: 8px clamp(14px, 2.6vw, 34px);
  background: #050807;
  border-top: 0;
  border-bottom: 1px solid rgba(34,197,94,.22);
  box-shadow: 0 10px 28px rgba(0,0,0,.32);
  transition:
    transform .24s var(--ease-out),
    min-height .24s var(--ease-out),
    padding .24s var(--ease-out),
    box-shadow .24s var(--ease-out),
    background .24s var(--ease-out);
  will-change: transform;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar.is-scrolled {
  box-shadow: 0 16px 38px rgba(0,0,0,.40);
}

.topbar.is-minimized {
  transform: translateY(calc(-100% - 10px));
}

.brand {
  position: relative;
  min-width: 0;
  width: 58px;
  min-height: 56px;
  gap: 0;
  overflow: visible;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-logo {
  width: clamp(50px, 4.8vw, 58px);
  height: clamp(50px, 4.8vw, 58px);
  max-height: none;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  background: transparent;
  border: 0;
  filter: drop-shadow(0 0 14px rgba(34,197,94,.26)) drop-shadow(0 8px 16px rgba(0,0,0,.30));
  box-shadow: none;
  transform: none;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1;
  color: #f7faf8;
}

.brand-subtitle {
  font-size: .74rem;
  font-weight: 800;
  color: rgba(247,250,248,.68);
}

:root[data-theme="light"] .topbar {
  background: #050807;
  border-bottom-color: rgba(34,197,94,.18);
  box-shadow: 0 10px 28px rgba(0,0,0,.32);
}

:root[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 0 18px rgba(34,197,94,.22)) drop-shadow(0 10px 18px rgba(0,0,0,.28));
}

.footer-links {
  width: 100vw;
  margin: 44px calc(50% - 50vw) 0;
  padding: 22px max(16px, calc((100vw - 1220px) / 2 + 30px)) calc(24px + env(safe-area-inset-bottom));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 92%, transparent), color-mix(in srgb, var(--panel-soft) 82%, transparent));
  border-top: 1px solid color-mix(in srgb, var(--border) 66%, transparent);
  box-shadow: 0 -18px 42px rgba(0,0,0,.08);
}

img,
svg,
video {
  max-width: 100%;
}

.landing-flow,
.home-section,
.settings-panel,
.footer-links {
  content-visibility: auto;
  contain-intrinsic-size: 1px 620px;
}

.module-card,
.record-card,
.summary-card {
  contain: layout paint;
}

.form-panel {
  width: 100%;
  padding: clamp(16px, 2.4vw, 24px);
  border-radius: 18px;
}

.form-title {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.form-title h3 {
  margin: 0;
  font-size: clamp(1.12rem, 2vw, 1.35rem);
  line-height: 1.15;
}

.form-section {
  gap: 14px;
  padding: 18px 0;
}

.form-section h4 {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: .86rem;
  font-weight: 950;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.form-section h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-a, #22c55e);
  box-shadow: 0 0 16px rgba(34,197,94,.28);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 238px), 1fr));
  gap: 14px;
  align-items: start;
}

.form-grid .full,
.form-grid label:has(.textarea),
.form-grid label:has(.password-strength) {
  grid-column: 1 / -1;
}

label {
  min-width: 0;
  gap: 7px;
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: 0;
}

label > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
}

label em {
  color: var(--green);
  font-style: normal;
  font-weight: 950;
}

.input,
.select,
.textarea {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 13px;
  line-height: 1.25;
}

.textarea {
  min-height: 118px;
  line-height: 1.45;
}

.readonly-field .input,
.input[readonly] {
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
  background: color-mix(in srgb, var(--panel-soft) 84%, transparent);
}

.field-help {
  margin: 0;
  max-width: 68ch;
  line-height: 1.35;
}

.field-error {
  margin: 0;
  min-height: 14px;
  line-height: 1.25;
}

.form-actions {
  position: sticky;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 12;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px -4px -4px;
  padding: 12px 4px 4px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--panel) 94%, transparent) 24%);
}

.form-actions .btn {
  min-width: 128px;
}

.form-actions .btn.primary {
  min-width: 156px;
}

.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.toolbar .btn {
  min-height: 48px;
}

.auth-pane.active {
  gap: 14px;
}

.auth-pane .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.password-field {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.password-field .btn {
  min-width: 86px;
  padding-inline: 12px;
}

.password-strength {
  grid-column: 1 / -1;
  padding: 12px;
}

.checkbox {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.danger-zone {
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, .8fr) auto;
  gap: 14px;
  align-items: end;
}

.settings-actions {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.pdv-row-controls {
  align-items: end;
}

.pdv-row-controls label {
  min-width: 84px;
}

.pdv-panel label {
  min-width: 0;
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  .app-shell {
    width: 100%;
    padding: 0 14px calc(96px + env(safe-area-inset-bottom));
  }

  #views {
    padding-top: 12px;
  }

  .topbar {
    position: sticky;
    top: 0;
    width: 100vw;
    min-height: 56px;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 6px 16px;
    gap: 8px;
    border-bottom-color: rgba(34,197,94,.20);
    background: #050807;
  }

  .brand {
    gap: 8px;
    min-width: 0;
    width: 58px;
    min-height: 56px;
    justify-content: center;
  }

  .brand-logo {
    width: 54px;
    height: 54px;
  }

  .brand-copy {
    display: none;
  }

  .topbar-actions {
    min-width: 0;
    gap: 7px;
  }

  .theme-toggle,
  .profile-menu-button {
    min-height: 40px;
    border-radius: 999px;
  }

  .theme-toggle {
    width: 42px;
    padding: 0;
  }

  .theme-toggle-text {
    display: none;
  }

  .theme-toggle-icon {
    width: 26px;
    height: 26px;
  }

  .profile-menu-button {
    max-width: 132px;
    padding: 8px 12px;
  }

  .profile-text {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-section {
    display: block;
    min-height: 0;
    margin-top: 8px;
    padding: 18px 16px;
    border-radius: 20px;
    overflow: hidden;
  }

  .hero-copy,
  .hero-content {
    max-width: none;
  }

  .hero-kicker,
  .section-eyebrow {
    width: fit-content;
    max-width: 100%;
    min-height: 26px;
    padding: 5px 9px;
    font-size: 10px;
    line-height: 1.1;
    white-space: normal;
  }

  .hero h2 {
    max-width: 100%;
    margin: 12px 0 10px;
    font-size: clamp(2rem, 9.8vw, 2.65rem);
    line-height: 1.04;
    overflow-wrap: normal;
    word-break: normal;
  }

  .hero h2 span {
    display: inline;
  }

  .hero p {
    max-width: 100%;
    font-size: .95rem;
    line-height: 1.45;
  }

  .benefit-row {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .benefit-row::-webkit-scrollbar {
    display: none;
  }

  .benefit-row span {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 10px;
    font-size: .74rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .hero-actions .btn,
  .landing-cta .btn {
    width: 100%;
    min-height: 46px;
  }

  .hero-product {
    display: none;
  }

  .landing-flow {
    margin-top: 14px;
    gap: 16px;
  }

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

  .landing-strip span {
    min-height: 48px;
    padding: 9px 10px;
    border-radius: 14px;
    font-size: .78rem;
    line-height: 1.18;
  }

  .landing-section,
  .logged-greeting,
  .screen-title,
  .view-header {
    border-radius: 18px;
  }

  .landing-section {
    display: grid;
    gap: 16px;
    padding: 18px 16px;
    border: 1px solid var(--surface-line);
    background: color-mix(in srgb, var(--panel) 84%, transparent);
  }

  .landing-split,
  .landing-cta {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .section-heading.centered {
    justify-items: start;
    text-align: left;
  }

  .landing-section .section-heading h2,
  .landing-cta h2 {
    max-width: 100%;
    margin: 8px 0;
    font-size: clamp(1.55rem, 7.2vw, 2rem);
    line-height: 1.12;
  }

  .landing-section .section-heading p,
  .landing-feature-grid p,
  .landing-cta p {
    max-width: 100%;
    font-size: .94rem;
    line-height: 1.45;
  }

  .landing-preview-card {
    min-height: 0;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
  }

  .preview-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preview-metrics article {
    min-height: 0;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 12px;
  }

  .preview-timeline {
    gap: 8px;
  }

  .preview-timeline span {
    height: 10px;
  }

  .landing-feature-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 4px;
  }

  .landing-feature-grid article {
    min-height: 0;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 6px 12px;
    align-items: start;
    padding: 14px;
    border-radius: 16px;
  }

  .landing-feature-grid article > span {
    grid-row: span 2;
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .landing-feature-grid strong {
    font-size: 1rem;
  }

  .landing-feature-grid p {
    margin: 0;
  }

  .landing-cta .btn {
    max-width: 100%;
  }

  .bottom-tabs {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    padding: 7px;
    border-radius: 22px;
  }

  .bottom-tab {
    min-width: 0;
    min-height: 54px;
    padding: 7px 4px;
    border-radius: 17px;
  }

  .bottom-tab span {
    font-size: 1.05rem;
  }

  .bottom-tab small {
    max-width: 100%;
    font-size: .72rem;
    white-space: nowrap;
  }

  .footer-links {
    justify-content: center;
    padding-inline: 16px;
    text-align: center;
  }

  .form-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .form-title {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .auth-pane .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-actions {
    bottom: calc(72px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-actions .btn,
  .form-actions .btn.primary {
    width: 100%;
    min-width: 0;
  }

  .user-logo-field {
    grid-template-columns: 1fr;
  }

  .user-logo-preview {
    width: 100%;
    max-width: 180px;
  }

  .password-field {
    grid-template-columns: 1fr;
  }

  .password-field .btn {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .danger-zone {
    grid-template-columns: 1fr;
  }
}

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