/* ========================================
   Sistema Hoteleiro — Estilos
   Paleta: verde-floresta (#1F3B2D) + dourado (#B08968) + off-white (#FAF7F2)
   Tipografia: Fraunces (display serif) + DM Sans (body)
   ======================================== */

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-soft: #F4EFE6;
  --border: #E5DFD3;
  --border-strong: #D4CCB8;

  --ink: #1A1817;
  --ink-soft: #5C5852;
  --ink-mute: #8F8A80;

  --primary: #1F3B2D;
  --primary-dark: #15291F;
  --primary-soft: #2D5340;

  --accent: #B08968;
  --accent-dark: #8F6B4D;
  --accent-soft: #E8DCC8;

  --ok: #3D7A57;
  --warn: #B86F3C;
  --danger: #A8453C;
  --info: #2E6091;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(26, 24, 23, 0.04);
  --shadow: 0 4px 14px rgba(26, 24, 23, 0.06), 0 1px 3px rgba(26, 24, 23, 0.04);
  --shadow-lg: 0 12px 40px rgba(26, 24, 23, 0.1);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
}

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

html, body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ========== LOGIN ========== */
.login-page {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  min-height: 100vh;
}

.login-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 72px;
  background: var(--bg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-mark {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}

.login-brand-sub {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  text-transform: uppercase;
  font-weight: 500;
}

.login-brand-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.login-form {
  width: 100%;
  max-width: 380px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-welcome h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 48px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 8px;
}

.login-welcome p {
  color: var(--ink-soft);
  font-size: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input, .field select, .field textarea {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 59, 45, 0.1);
}

.login-error {
  padding: 10px 14px;
  background: #F8E8E6;
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  background: var(--primary);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.login-hint {
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
}

.login-hint code {
  background: var(--surface-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--primary);
}

.login-side {
  background: var(--primary);
  color: var(--bg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-side-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(176, 137, 104, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(176, 137, 104, 0.15), transparent 50%);
}

.login-side-content {
  position: relative;
  padding: 64px;
  max-width: 520px;
}

.login-side blockquote {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  border-left: 2px solid var(--accent);
  padding-left: 24px;
}

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

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: 0.9;
}

.feature-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-container { padding: 32px 24px; }
}

/* ========== DASHBOARD ========== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--primary);
  color: var(--bg);
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 28px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.sidebar-brand-sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.5;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 24px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 16px 12px 8px;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--bg);
}

.nav-item.active {
  background: rgba(176, 137, 104, 0.15);
  color: var(--accent);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  opacity: 0.6;
  text-transform: capitalize;
}

.btn-logout {
  color: rgba(255,255,255,0.5);
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.btn-logout:hover { color: var(--accent); background: rgba(255,255,255,0.05); }

/* Main area */
.main {
  padding: 40px 48px;
  max-width: 1400px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 42px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--ink-soft);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 10px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  border: 1px solid transparent;
}

.btn:active { transform: translateY(1px); }

.btn-dark {
  background: var(--primary);
  color: var(--bg);
}
.btn-dark:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--surface-soft); }

.btn-accent {
  background: var(--accent);
  color: var(--primary);
}
.btn-accent:hover { background: var(--accent-dark); color: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { filter: brightness(0.9); }

.btn-sm { padding: 6px 10px; font-size: 12px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.card-sub {
  color: var(--ink-mute);
  font-size: 12px;
  margin-bottom: 20px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 32px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.kpi-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--primary);
}

.kpi-value.negative { color: var(--danger); }
.kpi-value.positive { color: var(--ok); }

.kpi-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* Tabelas */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

thead tr {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-soft); }

/* Badges/Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok { background: #E0EED7; color: #2D5E3F; }
.badge-pending { background: #FCF0D8; color: #8B6914; }
.badge-active { background: #DCE9F2; color: #1E4564; }
.badge-cancel { background: #F3DEDC; color: #7F3A33; }
.badge-done { background: #E8E1D3; color: #5C5037; }

/* Filtros & toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 240px;
  font-size: 13px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 23, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
}

.modal-header {
  padding: 24px 28px 0;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* WhatsApp */
.wa-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.wa-qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

.wa-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 24px;
}

.wa-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-mute);
}

.wa-status-dot.connected { background: var(--ok); animation: pulse 2s infinite; }
.wa-status-dot.qr { background: var(--warn); }
.wa-status-dot.connecting { background: var(--info); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.wa-qr-image {
  width: 260px;
  height: 260px;
  margin: 0 auto 20px;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wa-qr-image img { width: 100%; height: 100%; }

.wa-placeholder {
  padding: 60px 20px;
  color: var(--ink-mute);
  font-size: 14px;
}

.wa-instructions {
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  margin-top: 20px;
}

.wa-instructions ol {
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-nav button {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-nav button:hover { color: var(--ink); }
.tab-nav button.active { color: var(--primary); border-bottom-color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  animation: slideIn 0.2s;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
}

.toast-success { background: var(--ok); color: white; }
.toast-error { background: var(--danger); color: white; }

/* Utilities */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-mute { color: var(--ink-mute); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.mono { font-family: 'SF Mono', Menlo, monospace; font-size: 12px; }

/* Menu Mobile (Hamburger) */
.mobile-header {
  display: none;
  background: var(--primary);
  color: #fff;
  padding: 16px 24px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}
.mobile-menu-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
}
.mobile-brand {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  
  .mobile-header { display: flex; }
  
  .sidebar { 
    position: fixed; 
    top: 0; left: -280px; 
    height: 100vh; 
    z-index: 100; 
    transition: left 0.3s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  }
  
  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay.mobile-open { display: block; opacity: 1; }
  
  .main { padding: 16px; }
  .wa-container { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
}
