:root {
  --bg: #eef2f7;
  --bg-deep: #dbe4f0;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: rgba(248, 250, 252, 0.92);
  --text: #0f172a;
  --text-soft: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: rgba(148, 163, 184, 0.26);
  --border-strong: rgba(15, 23, 42, 0.12);
  --primary: #0f172a;
  --primary-2: #1e293b;
  --primary-soft: #e0e7ff;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --shadow-soft: 0 24px 70px rgba(15, 23, 42, 0.10);
  --shadow-card: 0 16px 42px rgba(15, 23, 42, 0.08);
  --shadow-button: 0 12px 26px rgba(15, 23, 42, 0.18);
  --bottom-nav-height: 82px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.18), transparent 26rem),
    radial-gradient(circle at 90% 10%, rgba(15, 23, 42, 0.12), transparent 22rem),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 42%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(var(--bottom-nav-height) + 22px);
  overflow-x: hidden;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.72), transparent 22rem),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  opacity: 0.9;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 18px 18px;
  background: rgba(248, 250, 252, 0.76);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.brand-block {
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #2563eb);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.10);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.header-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.header-badge {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: var(--shadow-button);
}

.app-main {
  position: relative;
  z-index: 1;
  padding: 18px;
}

.view-root {
  display: grid;
  gap: 16px;
}

.screen {
  display: grid;
  gap: 16px;
  animation: screenIn 420ms var(--ease-out);
}

.screen-header {
  display: grid;
  gap: 7px;
}

.screen-header h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.screen-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.card,
.metric-card,
.empty-state {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.card {
  border-radius: var(--radius-lg);
  padding: 18px;
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    border-color 220ms var(--ease-out);
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(37, 99, 235, 0.22);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-card {
  border-radius: var(--radius-md);
  padding: 17px;
  min-height: 112px;
  display: grid;
  align-content: space-between;
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -42px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.13), transparent 65%);
}

.metric-card:hover {
  transform: translateY(-2px) scale(1.008);
  box-shadow: var(--shadow-soft);
}

.metric-label {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.metric-value {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  font-weight: 950;
  letter-spacing: -0.06em;
  color: var(--text);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.success-btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  font-weight: 900;
  transition:
    transform 170ms var(--ease-out),
    box-shadow 170ms var(--ease-out),
    opacity 170ms var(--ease-out),
    background 170ms var(--ease-out);
}

.primary-btn {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  box-shadow: var(--shadow-button);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid var(--border);
}

.danger-btn {
  background: var(--danger-bg);
  color: var(--danger);
}

.success-btn {
  background: var(--success-bg);
  color: var(--success);
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.success-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:active,
.secondary-btn:active,
.danger-btn:active,
.success-btn:active {
  transform: translateY(1px) scale(0.99);
}

.form-grid {
  display: grid;
  gap: 13px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 13px 13px;
  outline: none;
  transition:
    border-color 170ms var(--ease-out),
    box-shadow 170ms var(--ease-out),
    background 170ms var(--ease-out);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.10);
  background: white;
}

textarea {
  resize: vertical;
}

.list {
  display: grid;
  gap: 10px;
}

.card .list {
  margin-top: 12px;
}

.list-item {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid var(--border);
  animation: itemIn 340ms var(--ease-out);
}

.list-item strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.list-item span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.list-item .action-row {
  margin-top: 10px;
}

.empty-state {
  display: grid;
  gap: 10px;
  text-align: center;
  padding: 42px 18px;
  border-radius: var(--radius-xl);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.loader-orb {
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: conic-gradient(from 90deg, #2563eb, #22c55e, #0f172a, #2563eb);
  animation: spin 900ms linear infinite;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.loader-orb::after {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 7px;
  border-radius: 999px;
  background: white;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  width: min(100%, 760px);
  min-height: var(--bottom-nav-height);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 9px 9px calc(9px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.82);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(22px);
  box-shadow: 0 -18px 44px rgba(15, 23, 42, 0.08);
}

.nav-btn {
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 18px;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 8px 4px;
  transition:
    transform 180ms var(--ease-out),
    background 180ms var(--ease-out),
    color 180ms var(--ease-out);
}

.nav-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.nav-btn.is-active {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.nav-btn:active {
  transform: scale(0.96);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
}

button:disabled,
input:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.success-card {
  border-color: rgba(21, 128, 61, 0.22);
  background:
    radial-gradient(circle at 10% 0%, rgba(34, 197, 94, 0.17), transparent 18rem),
    rgba(255, 255, 255, 0.90);
  animation: successPop 520ms var(--ease-out);
}

.success-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 2px auto 16px;
}

.success-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  animation: successRing 900ms var(--ease-out);
}

.success-check {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  font-size: 1.7rem;
  font-weight: 950;
  box-shadow: 0 18px 34px rgba(34, 197, 94, 0.26);
  animation: checkIn 420ms var(--ease-out);
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  width: 7px;
  height: 11px;
  border-radius: 999px;
  background: #2563eb;
  opacity: 0;
  animation: confetti 850ms var(--ease-out) forwards;
}

.confetti span:nth-child(1) { left: 12%; top: 36%; background: #2563eb; transform: rotate(12deg); animation-delay: 40ms; }
.confetti span:nth-child(2) { left: 27%; top: 10%; background: #22c55e; transform: rotate(42deg); animation-delay: 70ms; }
.confetti span:nth-child(3) { left: 53%; top: 0%; background: #f59e0b; transform: rotate(72deg); animation-delay: 20ms; }
.confetti span:nth-child(4) { left: 74%; top: 18%; background: #ef4444; transform: rotate(22deg); animation-delay: 80ms; }
.confetti span:nth-child(5) { left: 82%; top: 52%; background: #8b5cf6; transform: rotate(82deg); animation-delay: 30ms; }
.confetti span:nth-child(6) { left: 45%; top: 82%; background: #06b6d4; transform: rotate(32deg); animation-delay: 90ms; }

.toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 18px);
  z-index: 90;
  width: min(92%, 420px);
  transform: translateX(-50%);
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.94);
  color: white;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(18px);
  animation: toastIn 260ms var(--ease-out);
}

.toast.is-success {
  background: rgba(21, 128, 61, 0.96);
}

.toast.is-error {
  background: rgba(185, 28, 28, 0.96);
}

.toast-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 950;
}

.toast-message {
  font-size: 0.92rem;
  font-weight: 800;
}

body.has-success-burst .app-shell {
  animation: pageSuccess 480ms var(--ease-out);
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes successPop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }

  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.012);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes successRing {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }

  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

@keyframes checkIn {
  0% {
    transform: scale(0.6) rotate(-12deg);
    opacity: 0;
  }

  70% {
    transform: scale(1.08) rotate(2deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@keyframes confetti {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.8);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-42px) scale(1.05);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pageSuccess {
  0% {
    filter: saturate(1);
  }

  45% {
    filter: saturate(1.15) brightness(1.02);
  }

  100% {
    filter: saturate(1);
  }
}

.auth-mode .bottom-nav {
  display: none;
}

.auth-mode .app-shell {
  padding-bottom: 22px;
}

.auth-screen {
  min-height: calc(100vh - 160px);
  align-content: center;
}

.auth-hero h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.65rem, 7vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: -0.07em;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid var(--border);
}

.auth-tab {
  border: 0;
  border-radius: 14px;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-tab.is-active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.warning-box {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(180, 83, 9, 0.24);
  background: var(--warning-bg);
  color: var(--warning);
  animation: itemIn 320ms var(--ease-out);
}

.warning-box strong {
  font-size: 0.95rem;
}

.warning-box span {
  font-size: 0.88rem;
  line-height: 1.35;
}

.file-import-note {
  color: var(--muted);
  font-size: 0.86rem;
}

.pwa-update-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
  animation: toastIn 260ms var(--ease-out);
}

.pwa-update-banner strong {
  display: block;
  font-size: 0.94rem;
}

.pwa-update-banner span {
  display: block;
  margin-top: 3px;
  font-size: 0.82rem;
  color: rgba(248, 250, 252, 0.72);
}

.pwa-update-banner .primary-btn {
  min-height: 40px;
  padding: 0 14px;
  background: #f8fafc;
  color: #0f172a;
}

.pwa-install-button {
  position: fixed;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 75;
  border: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-weight: 900;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.32);
  animation: itemIn 260ms var(--ease-out);
}

@media (max-width: 520px) {
  .pwa-update-banner {
    grid-template-columns: 1fr;
  }

  .pwa-update-banner .primary-btn {
    width: 100%;
  }
}
.admin-card {
  border-color: rgba(56, 189, 248, 0.34);
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.13), rgba(15, 23, 42, 0.03)),
    var(--surface);
}
.onboarding-hero h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.075em;
}

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

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

.template-card h3 {
  margin-top: 10px;
}

.template-card .primary-btn {
  margin-top: 16px;
  width: 100%;
}

.template-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 900;
}

.template-subtitle {
  color: var(--text);
  font-weight: 800;
  margin-bottom: 6px;
}

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