:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1d2939;
  --muted: #5b6979;
  --border: #d8e1ec;
  --brand: #005f73;
  --brand-soft: #e0f3f6;
  --success: #0f766e;
  --danger: #b42318;
  --warning: #9a3412;
  --shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  background: radial-gradient(circle at 15% 20%, #e7f7ff 0, transparent 35%),
    radial-gradient(circle at 85% 15%, #eefbe7 0, transparent 30%),
    var(--bg);
  position: relative;
}

body.protected-pending .app-shell {
  visibility: hidden;
}

body.app-offline .app-shell {
  filter: grayscale(0.05);
}

.network-notice {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  text-align: center;
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #7a2e0b;
  background: #ffedd5;
  border-bottom: 1px solid #fdba74;
}

.network-notice.is-offline {
  color: #7f1d1d;
  background: #fee2e2;
  border-bottom-color: #fca5a5;
}

.bg-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
}

.bg-shape-1 {
  height: 280px;
  width: 280px;
  background: rgba(19, 120, 186, 0.15);
  left: -80px;
  top: -60px;
}

.bg-shape-2 {
  height: 260px;
  width: 260px;
  background: rgba(16, 185, 129, 0.14);
  right: -90px;
  top: 40px;
}

.app-shell {
  max-width: 1200px;
  margin: 28px auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.brand-name {
  margin: 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 700;
  color: #0f766e;
  border: 1px solid #9dd8c4;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 6px 12px;
}

.sync-indicator {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.tab:hover {
  transform: translateY(-1px);
  border-color: #98b7d4;
}

.tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.panel {
  display: none;
  animation: rise 0.35s ease;
}

.panel.is-active {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2 {
  margin-top: 0;
  font-family: "Outfit", sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  isolation: isolate;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 0.35s ease;
}

.auth-card-lg {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(240, 251, 255, 0.92)),
    var(--panel);
  backdrop-filter: blur(8px);
}

.auth-grid-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    linear-gradient(rgba(13, 100, 130, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 100, 130, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

.auth-brand {
  border: 1px solid #cce9f0;
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(160deg, #f3fbff, #f8fffb);
}

.auth-shop-name {
  margin: 0 0 6px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #9dd8c4;
  background: #ecfdf5;
  color: #0f766e;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
}

.auth-kicker {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: #0e7490;
  font-weight: 700;
}

.auth-pill-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfe4ef;
  border-radius: 999px;
  padding: 6px 10px;
  background: #ffffff;
  font-size: 0.8rem;
  color: #155e75;
  font-weight: 600;
}

.auth-card h1 {
  margin: 0;
  font-family: "Outfit", sans-serif;
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: 0.2px;
}

.auth-card p {
  margin-top: 8px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.auth-form-pro {
  border: 1px solid #d4deea;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  height: 30px;
  width: 30px;
  border: 1px solid #c8d4e2;
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
  color: #0f766e;
  display: grid;
  place-items: center;
  padding: 0;
}

.password-toggle.is-active {
  background: #e7f8f3;
  border-color: #8cd7bf;
}

.auth-submit {
  margin-top: 4px;
}

.auth-error {
  color: var(--danger);
  font-weight: 600;
  min-height: 20px;
  margin: 2px 0 0;
}

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

.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  border: 1px solid #c9d5e3;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

button {
  font: inherit;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.btn-primary,
.btn-danger,
.btn-muted,
.btn-secondary,
.btn-link {
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(130deg, #0f766e, #005f73);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(130deg, #d92d20, #b42318);
  color: #fff;
}

.btn-muted {
  background: #eef2f7;
  color: var(--text);
}

.btn-secondary {
  background: #eff6ff;
  color: #075985;
  border: 1px solid #bfdbfe;
}

.btn-link {
  background: transparent;
  color: #0f766e;
  border: 1px solid #94d2bd;
  padding: 6px 10px;
}

.btn-delete {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f1b4ae;
  padding: 6px 10px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 180px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  font-size: 0.94rem;
}

th {
  background: #f8fafc;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.wa-link {
  color: #0e7490;
  text-decoration: none;
  font-weight: 600;
}

.wa-link:hover {
  text-decoration: underline;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  background: linear-gradient(165deg, #fff, #f6fbff);
}

.stat-box h3 {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.stat-box p {
  margin: 8px 0 0;
  font-family: "Outfit", sans-serif;
  font-size: 2rem;
  color: var(--brand);
}

.cloud-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

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

@media (max-width: 920px) {
  .grid-form,
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar input,
  .toolbar select {
    min-width: 100%;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-card-lg {
    grid-template-columns: 1fr;
  }
}
