* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0A0F0A;
  --surface-container-low: #181d17;
  --surface-container: #1c211b;
  --surface-container-high: #262b25;
  --surface-variant: #313630;
  --surface-bright: #353b34;
  --primary: #7eda95;
  --primary-container: #47a263;
  --growth-mint: #4ADE80;
  --on-primary: #003919;
  --on-surface: #dfe4db;
  --on-surface-variant: #becabd;
  --text-muted: #899488;
  --parchment-white: #E0E0D0;
  --secondary: #e6c364;
  --tech-gold: #C9A84C;
  --error: #ffb4ab;
  --error-container: #93000a;
  --glass-border: rgba(224, 224, 208, 0.1);

  --header-bg: #121812;
  --green-bright: #4ADE80;
  --green-neon: #7eda95;
  --green-deep: #0A0F0A;
  --green-dark: #0A0F0A;
  --glass-bg: #121812;
  --glass-bg2: #121812;
  --glass-border-active: rgba(74, 222, 128, 0.4);
  --text-primary: #dfe4db;
  --text-secondary: #becabd;
  --danger: #ffb4ab;
  --radius: 0.25rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Hanken Grotesk', serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html { background: #0A0F0A; }

body {
  font-family: var(--font);
  background: #0A0F0A;
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ── */
.sidebar { background: var(--surface-container-low); }
.nav-link { transition: all 0.2s ease-in-out; }
.nav-link:hover { background: rgba(49, 54, 48, 0.3); color: var(--on-surface); }

/* ── Dashboard ── */
.dash-watering-item {
  background: #121812;
  border: 1px solid rgba(224, 224, 208, 0.1);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
}
.dash-watering-item:hover { background: #1C241C; border-color: rgba(74, 222, 128, 0.2); }

.dash-urgent { border-left: 3px solid #ffb4ab; }

.dash-watering-event {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  padding: 4px 0;
}
.dash-ev-date { color: var(--text-muted); min-width: 80px; }
.dash-ev-done { color: var(--green-bright); }
.dash-ev-pending { color: var(--tech-gold); }

.dash-calendar { margin-top: 12px; }
.dash-cal-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--parchment-white);
  margin-bottom: 8px;
}
.dash-cal-strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.dash-cal-day {
  flex-shrink: 0;
  width: 72px;
  background: rgba(18,24,18,0.6);
  border: 1px solid rgba(224,224,208,0.08);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  font-size: 0.7rem;
}
.dash-cal-day.today { border-color: rgba(74,222,128,0.4); }
.dash-cal-day.has-watering { border-color: rgba(122,218,149,0.2); }
.dash-cal-date { font-size: 1rem; font-weight: 700; color: var(--parchment-white); }
.dash-cal-day-name { font-size: 0.6rem; color: var(--text-muted); margin-bottom: 4px; }
.dash-cal-plants { display: flex; flex-direction: column; gap: 2px; }
.dash-cal-plant { font-size: 0.6rem; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-cal-plant.done { color: var(--green-bright); }

.dash-room-card {
  background: #121812;
  border: 1px solid rgba(224, 224, 208, 0.1);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
}
.dash-room-card:hover { background: #1C241C; border-color: rgba(74, 222, 128, 0.2); }

.dash-vpd-room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(18,24,18,0.6);
  border: 1px solid rgba(224,224,208,0.08);
  border-radius: 10px;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.dash-empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 20px;
}

/* ── Weather ── */
.weather-bar { font-size: 0.78rem; }
.weather-city { font-weight: 600; color: var(--parchment-white); margin-bottom: 8px; }
.weather-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.weather-day {
  background: rgba(18,24,18,0.6);
  border: 1px solid rgba(224,224,208,0.08);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.weather-date { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 4px; }
.weather-temp { font-size: 0.85rem; font-weight: 700; color: var(--parchment-white); }
.weather-detail { font-size: 0.65rem; color: var(--on-surface-variant); margin-top: 2px; }
.weather-alert {
  font-size: 0.7rem;
  color: var(--tech-gold);
  padding: 6px 10px;
  margin-top: 6px;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 8px;
}

/* ── Stock alerts ── */
.inv-card {
  background: #121812;
  border: 1px solid rgba(224, 224, 208, 0.1);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.inv-card:hover { background: #1C241C; border-color: rgba(74, 222, 128, 0.2); }
.inv-card-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.inv-card-img {
  width: 40px; height: 40px; border-radius: 10px;
  background-size: cover; background-position: center;
  flex-shrink: 0;
  background: rgba(49,54,48,0.3);
  display: flex; align-items: center; justify-content: center;
}
.inv-card-img-placeholder { font-size: 1.2rem; }
.inv-card-info { flex: 1; min-width: 0; }
.inv-card-name { font-size: 0.85rem; font-weight: 600; color: var(--parchment-white); }
.inv-card-comp { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.inv-card-mid { font-size: 0.78rem; }
.inv-card-qty { font-size: 0.8rem; color: var(--on-surface-variant); margin-bottom: 4px; }
.inv-card-qty strong { color: var(--parchment-white); }
.inv-card-stock { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; }
.stock-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.stock-in { background: var(--green-bright); }
.stock-low { background: var(--tech-gold); }
.stock-out { background: var(--error); }
.stock-icon { font-size: 0.65rem; }
.stock-label { color: var(--text-muted); }
.inv-card-store { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.inv-card-actions { margin-top: 8px; display: flex; gap: 6px; }
.inv-card-durability { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.inv-card-expiry { font-size: 0.7rem; margin-top: 4px; }

.inv-grid-new {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* ── Promotions ── */
.promo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.promo-card {
  background: #121812;
  border: 1px solid rgba(224, 224, 208, 0.1);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}
.promo-card:hover { background: #1C241C; border-color: rgba(74, 222, 128, 0.2); }
.promo-card-img {
  height: 80px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background: rgba(49,54,48,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.promo-card-body { padding: 10px; flex: 1; }
.promo-card-store { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.promo-card-title { font-size: 0.75rem; font-weight: 600; color: var(--parchment-white); margin: 2px 0; }
.promo-card-price { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.promo-old { font-size: 0.65rem; color: var(--text-muted); text-decoration: line-through; }
.promo-current { font-size: 0.8rem; font-weight: 700; color: var(--green-bright); }
.promo-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--error);
  background: rgba(255,180,171,0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Strain Cards ── */
.strain-card {
  background: #121812;
  border: 1px solid rgba(224, 224, 208, 0.1);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}
.strain-card:hover { background: #1C241C; border-color: rgba(74, 222, 128, 0.2); }
.strain-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--parchment-white); margin-bottom: 4px; }
.strain-card .type {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green-bright);
  background: rgba(74,222,128,0.1);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.strain-card .desc { font-size: 0.78rem; color: var(--on-surface-variant); line-height: 1.5; margin-bottom: 8px; }
.strain-card .stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.75rem; }
.strain-card .stats span { background: rgba(49,54,48,0.3); padding: 3px 8px; border-radius: 6px; color: var(--on-surface-variant); }

/* ── Strain Filter Buttons ── */
.strain-filters { display: flex; gap: 6px; padding: 8px 0; flex-wrap: wrap; align-items: center; }
.btn-filter {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(224,224,208,0.1);
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.btn-filter:hover { border-color: rgba(74,222,128,0.4); color: var(--growth-mint); }
.btn-filter.active {
  background: var(--surface-container-high);
  border-color: rgba(74,222,128,0.2);
  color: var(--growth-mint);
  font-weight: 600;
}

/* ── Chat ── */
.glass-panel {
  background: rgba(18,24,18,0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(224,224,208,0.1);
}
.chat-scroll::-webkit-scrollbar { width: 4px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-scroll::-webkit-scrollbar-thumb { background: #313630; border-radius: 10px; }
.typing-dot {
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}
.message { display: flex; gap: 10px; margin-bottom: 16px; }
.message.assistant { align-items: flex-start; }
.bot-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.bot-bubble {
  background: rgba(18,24,18,0.8);
  border: 1px solid rgba(224,224,208,0.1);
  border-radius: 0 12px 12px 12px;
  padding: 12px 16px;
  max-width: 75%;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--on-surface);
}
.msg-text { color: var(--on-surface); }
.msg-text p { margin-bottom: 8px; }

.command-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cmd-card {
  background: rgba(18,24,18,0.6);
  border: 1px solid rgba(224,224,208,0.08);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex: 1;
  min-width: 140px;
  transition: all 0.2s;
}
.cmd-card:hover { background: rgba(28,36,28,0.8); border-color: rgba(74,222,128,0.2); }
.cmd-card-icon { font-size: 1.2rem; }
.cmd-card-body { flex: 1; }
.cmd-card-title { font-size: 0.78rem; font-weight: 600; color: var(--parchment-white); }
.cmd-card-desc { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.cmd-card-simple { font-size: 0.75rem; color: var(--on-surface-variant); padding: 8px 12px; }

/* ── Sessions Panel ── */
.sessions-panel { transition: all 0.3s ease; }
.sessions-header { padding: 16px; border-bottom: 1px solid rgba(224,224,208,0.08); }
.sessions-list { padding: 8px; overflow-y: auto; }
.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  transition: all 0.15s;
  margin-bottom: 4px;
}
.session-item:hover { background: rgba(49,54,48,0.3); }
.session-item.active { background: rgba(74,222,128,0.1); color: var(--green-bright); }

/* ── Schedule List ── */
.schedule-list { display: grid; gap: 12px; }
.sched-card {
  background: #121812;
  border: 1px solid rgba(224,224,208,0.1);
  border-radius: 12px;
  padding: 16px;
}
.sched-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--parchment-white); }

.room-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.room-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(224,224,208,0.1);
  background: rgba(49,54,48,0.2);
  color: var(--on-surface-variant);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.room-btn:hover { background: rgba(49,54,48,0.4); color: var(--on-surface); }
.room-btn.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 8px rgba(126,218,149,0.5); font-weight: 700; }

/* ── Inventory Category List ── */
.inv-cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--on-surface-variant);
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.inv-cat-item:hover { background: rgba(49,54,48,0.3); }
.inv-cat-item.active { background: rgba(74,222,128,0.1); color: var(--green-bright); font-weight: 600; }
.cat-count { font-size: 0.7rem; color: var(--text-muted); }

/* ── User Dropdown ── */
#userDropdown button {
  color: rgba(156,163,175,0.6);
  background: transparent;
}
#userDropdown button:hover {
  color: #a3e635;
  background: rgba(163,230,53,0.1);
}
#userDropdown button:hover .material-symbols-outlined {
  color: #a3e635;
}
#signOutBtn:hover {
  color: #f87171 !important;
  background: rgba(248,113,113,0.1) !important;
}
#signOutBtn:hover .material-symbols-outlined {
  color: #f87171 !important;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.modal.hidden { display: none !important; }

/* ── Stealth Mode ── */
.stealth-mode .inv-card-name,
.stealth-mode .inv-card-qty strong,
.stealth-mode .dash-cal-date,
.stealth-mode .dash-cal-plant,
.stealth-mode .dash-watering-event,
.stealth-mode .strain-card .type,
.stealth-mode .strain-card h3,
.stealth-mode .weather-temp,
.stealth-mode .promo-card-title,
.stealth-mode .promo-current {
  filter: blur(5px);
  user-select: none;
}

/* ── Shared Buttons ── */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  background: rgba(49,54,48,0.3);
  color: var(--on-surface-variant);
  border: 1px solid rgba(224,224,208,0.1);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(49,54,48,0.5); color: var(--on-surface); }
.btn-danger {
  background: rgba(255,180,171,0.15);
  color: var(--error);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(255,180,171,0.25); }
.btn-sm { padding: 4px 10px; font-size: 0.72rem; }

/* ── Form / Modal Buttons ── */
.btn-close { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); }
.btn-close:hover { color: var(--on-surface); }

/* ── Misc ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.75rem; color: var(--on-surface-variant); margin-bottom: 6px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { height: 4px; width: 4px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar-thumb { background: #4ADE80; border-radius: 10px; }

/* ── Inline Table Cell Input ── */
td .tbl-cell-input,
td .tbl-date-input {
  background: #181d17 !important;
  border: 1px solid rgba(74, 222, 128, 0.3) !important;
  color: #dfe4db !important;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem !important;
  padding: 2px 6px !important;
  border-radius: 4px;
  width: 90px;
  outline: none !important;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.15);
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}
td .tbl-cell-input:focus, td .tbl-date-input:focus {
  border-color: #4ADE80 !important;
}
.tbl-date-input {
  width: 150px;
  color-scheme: dark;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .promo-grid { grid-template-columns: 1fr; }
  .inv-grid-new { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  /* Flex column: main cresce e empurra a nav para o fundo do viewport sempre */
  body {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100dvh !important;
  }
  main {
    flex: 1 1 auto !important;
    margin-left: 0 !important;
    padding: 4.5rem 1rem 1rem !important;
  }
  .dash-cal-strip { gap: 2px; }
  .dash-cal-day { width: 56px; padding: 6px; }

  /* Mobile: barra de navegação inferior sempre visível no fundo */
  #mobileBottomNav {
    position: sticky !important;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    z-index: 50;
    display: flex !important;
    height: auto;
    margin-top: auto !important;
    flex-shrink: 0 !important;
  }
  #mobileBottomNav .mobile-nav-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }
  #mobileTopBar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
  }

  /* Mobile: painel de chats abre da direita sobre o conteúdo */
  #sessionsPanel {
    width: min(20rem, 85vw);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
  }
  #sessionsPanel.show-mobile {
    transform: translateX(0);
  }
  #tab-chat .flex > div[style*="padding-right"] {
    padding-right: 0 !important;
  }
  body { overflow-x: hidden; }
  #tab-chat > .flex {
    margin: -4.5rem -1rem 0 !important;
    height: calc(100dvh - 3.5rem) !important;
  }
  #tab-chat .pt-10 {
    padding-top: 3.5rem !important;
  }
  #tab-chat .py-4 {
    padding-bottom: 3.5rem !important;
  }
}
