@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #f3f6f4;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --border: rgba(30, 50, 42, 0.09);
  --text: #15201c;
  --muted: #5a6b64;
  --accent: #3d7a6a;
  --accent-deep: #2e5e52;
  --accent-soft: #7aa89c;
  --accent-tint: rgba(61, 122, 106, 0.1);
  --danger: #dc2626;
  --danger-tint: rgba(220, 38, 38, 0.1);
  --success: #16a34a;
  --radius: 14px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --display: "Outfit", "Plus Jakarta Sans", sans-serif;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 40px rgba(16, 24, 40, 0.08);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
img { max-width: 100%; }

.container { width: min(1120px, 92%); margin: 0 auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(61, 122, 106, 0.22);
}
.btn-primary:hover { background: var(--accent-deep); color: #fff !important; }
.btn-ghost {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }

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

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.22rem;
  color: var(--text);
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand .fa-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand .fa-word { color: var(--text); }
.brand .fa-word span { color: var(--accent); }

/* Auth */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(61, 122, 106, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 90%, rgba(96, 165, 250, 0.1), transparent 50%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  max-width: 100%;
  padding: 28px 24px;
  text-align: center;
}

.auth-card h1 {
  margin: 16px 0 8px;
  font-family: var(--display);
  font-size: clamp(1.35rem, 4.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.auth-card > .muted {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.auth-card label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}

.auth-card form {
  text-align: left;
}

.auth-card input,
.app select,
.app input[type="text"],
.app input[type="password"],
.app input[type="email"],
.app input[type="number"],
.app textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
}

.auth-card input:focus,
.app select:focus,
.app input:focus,
.app textarea:focus {
  outline: none;
  border-color: rgba(61, 122, 106, 0.45);
  box-shadow: 0 0 0 3px rgba(61, 122, 106, 0.12);
}

.auth-submit {
  width: 100%;
  margin-top: 18px;
  min-height: 46px;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
  margin: 10px 0 0;
  cursor: pointer;
}
.auth-check input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: #3d7a6a;
}
.auth-check a {
  color: #3d7a6a;
}

.auth-footer {
  margin-top: 16px;
}

.auth-req {
  color: #b45309;
  font-weight: 700;
}

.auth-plan-pick {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.auth-plan-pick legend {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.auth-plan-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 8px;
  padding: 12px 12px;
  border: 1px solid var(--border, #d7e0db);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-plan-option:hover,
.auth-plan-option:has(input:checked),
.auth-plan-option.is-selected:has(input:checked) {
  border-color: rgba(61, 122, 106, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 122, 106, 0.12);
}

.auth-plan-option input {
  margin-top: 3px;
  width: auto;
  flex-shrink: 0;
}

.auth-plan-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auth-plan-option-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.auth-plan-option-title em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent, #3d7a6a);
  font-size: 0.86rem;
}

.auth-plan-option-meta {
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

@media (max-width: 480px) {
  .auth-wrap {
    padding: 12px;
    align-items: stretch;
    place-items: stretch;
  }

  .auth-card {
    width: 100%;
    margin: auto 0;
    padding: 22px 16px;
    border-radius: 14px;
  }

  .auth-card h1 {
    margin: 14px 0 6px;
  }

  .auth-card input {
    font-size: 16px; /* evita zoom automático no iOS */
    padding: 12px 14px;
  }

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

.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li {
  padding: 11px 13px;
  border-radius: 11px;
  margin-bottom: 8px;
  background: var(--accent-tint);
  border: 1px solid rgba(61, 122, 106, 0.25);
  font-size: 0.9rem;
}
.messages li.error,
.messages li.errorlist {
  background: var(--danger-tint);
  border-color: rgba(220, 38, 38, 0.3);
  color: #991b1b;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  flex-shrink: 0;
}

.sidebar-head {
  padding: 6px 10px 18px;
}

.sidebar-shop {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.sidebar-shop .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.sidebar-shop .name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.3;
}

.nav-section {
  margin-top: 16px;
  padding: 0 12px 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent-tint);
  color: var(--accent);
}
.nav-link .nav-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: inherit;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.nav-link.active .nav-ico {
  background: rgba(61, 122, 106, 0.16);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  max-width: 260px;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.topbar-user-email {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.35);
  z-index: 25;
}

.content {
  padding: 22px;
  flex: 1;
}

.page-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 52ch;
}

/* Stats */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 122, 106, 0.1), transparent 70%);
  pointer-events: none;
}
.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.stat .value {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat .value.accent { color: var(--accent); }

/* Tables */
.panel-table {
  padding: 0;
  overflow: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 0;
}

.panel-head h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th,
table.data td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
  position: sticky;
  top: 0;
}
table.data tbody tr:hover {
  background: rgba(61, 122, 106, 0.03);
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.badge-success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.badge-danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.toolbar-day {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.toolbar-day strong {
  min-width: 100px;
  text-align: center;
  font-family: var(--display);
  font-size: 0.92rem;
}

.inline-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form select {
  width: auto;
  min-width: 130px;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.settings-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.settings-list li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.settings-list li:last-child { border-bottom: 0; }
.settings-list .k {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Mobile */
@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .topbar-user-email {
    display: none;
  }
  .topbar-user {
    padding: 4px;
    border-radius: 50%;
  }
  .content {
    padding: 16px;
  }
  .settings-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 560px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .toolbar-day {
    width: 100%;
    justify-content: space-between;
  }
  .inline-form {
    width: 100%;
  }
  .inline-form select {
    flex: 1;
  }
}
