@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
  --bg: #0f172a;
  --card: #111827;
  --muted: #9ca3af;
  --primary: #14b8a6;
  --primary-strong: #0d9488;
  --accent: #fbbf24;
  --danger: #f43f5e;
  --border: #1f2937;
  --text: #e5e7eb;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 16% 14%, rgba(20, 184, 166, 0.12), transparent 22%),
              radial-gradient(circle at 82% 10%, rgba(251, 191, 36, 0.16), transparent 26%),
              var(--bg);
  color: var(--text);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(160deg, rgba(17, 24, 39, 0.96), rgba(12, 18, 32, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 22px;
  padding: 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(20, 184, 166, 0.06);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 26px;
  color: #0b1220;
  box-shadow: 0 12px 32px rgba(20, 184, 166, 0.32);
}

.login-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.login-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.login-form input {
  border-radius: 12px;
  background: #0c1222;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  padding: 13px;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.login-btn {
  width: 100%;
  margin-top: 6px;
}

.login-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

a {
  color: inherit;
  text-decoration: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  gap: 18px;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.logo img {
  border-radius: 8px;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  object-fit: cover;
}

.logo .name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}

.nav-links {
  margin-left: auto;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: all 0.2s ease;
  font-size: 14px;
}

.nav-links a#logoutBtn {
  border: 1px solid var(--border);
  color: var(--text);
}

.nav-links a.active,
.nav-links a:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(20, 184, 166, 0.08);
}

main {
  max-width: 1200px;
  margin: 32px auto 60px;
  padding: 0 18px;
}

/* Layout com sidebar (tenants) */
.layout {
  display: flex;
  gap: 16px;
}
.sidebar {
  min-width: 210px;
  max-width: 230px;
  background: rgba(12, 18, 32, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 16px;
  height: fit-content;
}
.sidebar h3 {
  margin: 0 0 10px 0;
  color: var(--text);
  font-size: 15px;
}
.sidebar-link {
  display: block;
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  margin-bottom: 6px;
  transition: background 0.2s;
}
.sidebar-link:hover {
  background: rgba(59, 130, 246, 0.12);
}
.content {
  flex: 1;
  min-width: 0;
}

h1, h2, h3 {
  color: var(--text);
  margin: 0 0 12px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
}

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

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

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

input, select, button, textarea {
  font-family: inherit;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  outline: none;
  transition: border 0.2s ease, transform 0.08s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.two-col {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #0b1220;
  background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 30px rgba(20, 184, 166, 0.25);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(20, 184, 166, 0.35);
}

.btn.secondary {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--text);
  border: 1px solid rgba(20, 184, 166, 0.25);
  font-size: 12px;
}

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

.success {
  color: #22c55e;
}

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

.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.pill {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}

.status {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  margin-top: 12px;
}

.alert {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.5);
  color: var(--danger);
}

.flex {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wrap {
  flex-wrap: wrap;
}

.spaced {
  justify-content: space-between;
}

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

.preview {
  width: 100%;
  border-radius: 12px;
  background: #0b1220;
  border: 1px dashed var(--border);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

.preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
  object-fit: cover;
}

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

.metric {
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.metric strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.18);
  color: #0d9488;
  font-weight: 600;
}

.low-stock {
  background: rgba(244, 63, 94, 0.08) !important;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.image-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.chart-card .chart-area {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-card .chart-area.large {
  height: 300px;
}

.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}

.toast {
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(20, 184, 166, 0.4);
  background: linear-gradient(120deg, rgba(20, 184, 166, 0.16), rgba(251, 191, 36, 0.12));
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.25s ease, toast-out 0.4s ease 3.6s forwards;
  font-weight: 600;
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.12);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (max-width: 720px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    width: 100%;
  }
  .list-item {
    flex-direction: column;
    gap: 8px;
  }
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    max-width: 100%;
  }
}
