/* ============================================================
   Atelier — Painel Larissa Palmieri
   Identidade visual baseada em aromaterapialarissa.com.br
   Cormorant Garamond (italic + display) + Inter (corpo)
   ============================================================ */

:root {
  --sage: #5B6B50;
  --sage-dark: #4A5742;
  --gold: #B8956A;
  --gold-soft: #C9A77E;
  --cream: #F7F6F2;
  --cream-deep: #F1ECDF;
  --ink: #2A2A26;
  --ink-soft: #5A5A52;
  --ink-mute: #8A8A82;
  --line: #D9D2BF;
  --danger: #B85A50;
  --shadow-sm: 0 1px 3px rgba(74, 87, 66, 0.04);
  --shadow-md: 0 4px 12px rgba(74, 87, 66, 0.06);
  --radius: 4px;
  --radius-lg: 8px;
}

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

html, body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { font-weight: 500; line-height: 1.2; color: var(--ink); }

a { color: var(--sage-dark); text-decoration: none; }
a:hover { color: var(--gold); }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(91, 107, 80, 0.12);
}

/* ============ TIPOGRAFIA ============ */

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.serif-italic { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; }
.display { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 400; font-size: 32px; }

/* ============ LAYOUT SHELL ============ */

.app { min-height: 100vh; display: flex; }
.sidebar {
  display: none;
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 0 28px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.sidebar-brand .brand-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 24px;
  color: var(--sage-dark);
  line-height: 1;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

.sidebar-nav { list-style: none; padding: 0 12px; }
.sidebar-nav li { margin: 1px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: var(--cream-deep); color: var(--sage-dark); }
.sidebar-nav a.is-active {
  background: var(--cream-deep);
  color: var(--sage-dark);
  font-weight: 500;
}
.sidebar-nav .nav-icon { width: 16px; height: 16px; opacity: 0.7; }

.sidebar-footer {
  position: absolute;
  bottom: 24px;
  left: 0; right: 0;
  padding: 0 28px;
  font-size: 12px;
  color: var(--ink-mute);
}
.sidebar-footer .footer-link { color: var(--ink-mute); display: block; padding: 6px 0; }
.sidebar-footer .footer-link:hover { color: var(--sage); }

.main {
  flex: 1;
  padding: 24px 18px 96px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.page-header { margin-bottom: 28px; }
.page-header .eyebrow { display: block; margin-bottom: 8px; }
.page-header .page-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  color: var(--sage-dark);
  line-height: 1.1;
}
.page-header .page-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 6px;
}
.page-header .actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ============ BOTTOM NAV (mobile) ============ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 4px max(8px, env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -2px 12px rgba(74, 87, 66, 0.04);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--ink-mute);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
}
.bottom-nav a.is-active { color: var(--sage-dark); }
.bottom-nav a .nav-icon { width: 20px; height: 20px; opacity: 0.85; }
.bottom-nav a.is-active .nav-icon { opacity: 1; }

/* ============ CARDS ============ */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header .card-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  color: var(--sage-dark);
}
.card-body { padding: 16px 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--cream);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ============ KPI CARDS (dashboard) ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}
.kpi-value {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 30px;
  font-weight: 400;
  color: var(--sage-dark);
  line-height: 1.1;
}
.kpi-value.smaller { font-size: 22px; }
.kpi-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.kpi.kpi-accent { background: var(--cream-deep); }
.kpi.kpi-danger .kpi-value { color: var(--danger); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--sage); color: var(--sage-dark); }
.btn-primary {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}
.btn-primary:hover { background: var(--sage-dark); border-color: var(--sage-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--cream-deep); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #9C4A41; border-color: #9C4A41; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* fixed bottom action bar pro mobile */
.action-bar-mobile {
  position: fixed;
  bottom: 60px;
  left: 0; right: 0;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(247,246,242,0) 0%, var(--cream) 60%);
  z-index: 40;
  display: none;
}
.action-bar-mobile .btn { width: 100%; padding: 14px; font-size: 15px; }

/* ============ FORMS ============ */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}
.field-hint { font-size: 12.5px; color: var(--ink-mute); }
.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* ============ TABLES (desktop) / CARDS (mobile) ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th,
table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data thead th {
  background: var(--cream-deep);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}
table.data tbody tr:hover { background: var(--cream); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .data-warn { color: var(--danger); font-weight: 500; }

/* card-list mobile (renderiza no lugar da tabela < 768px) */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.row-card .row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.row-card .row-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  color: var(--sage-dark);
}
.row-card .row-meta { font-size: 12.5px; color: var(--ink-mute); }
.row-card .row-bits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 6px;
  font-size: 13px;
}
.row-card .row-bits span strong { color: var(--ink); font-weight: 600; }
.row-card .row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ============ ALERTS / TOAST ============ */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 14px;
}
.alert-error { background: #F8E4E1; color: #7C3A33; border: 1px solid #E5BFBA; }
.alert-sucesso { background: #E8EDE3; color: var(--sage-dark); border: 1px solid #C4D0B8; }
.alert-info { background: var(--cream-deep); color: var(--ink-soft); border: 1px solid var(--line); }

.toast-host {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--sage-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  margin-top: 8px;
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in 0.25s ease forwards, toast-out 0.3s ease 3.5s forwards;
}
.toast.toast-error { background: var(--danger); }
@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ============ BADGES / PILLS ============ */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-weight: 500;
  border: 1px solid var(--line);
}
.pill-sage { background: var(--sage); color: #fff; border-color: var(--sage); }
.pill-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.pill-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.pill-mute { background: transparent; color: var(--ink-mute); }

.meta-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-right: 6px;
}

.stack > * + * { margin-top: 12px; }
.muted { color: var(--ink-mute); }
.text-danger { color: var(--danger); }
.text-sage { color: var(--sage-dark); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.spacer { flex: 1; }

/* divider de respiro */
.divider {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin: 28px 0;
  color: var(--gold);
  opacity: 0.5;
}
.divider .line { width: 28px; height: 1px; background: currentColor; }
.divider .dot { width: 4px; height: 4px; background: currentColor; border-radius: 50%; }

/* ============ DASHBOARD: CHARTS ============ */
.chart-card { padding: 16px; }
.chart-card canvas { width: 100% !important; height: 220px !important; }

/* ============ LOGIN PAGE ============ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 0%, var(--cream-deep) 0%, transparent 80%),
    var(--cream);
}
.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px -16px rgba(74, 87, 66, 0.18);
}
.login-mark {
  text-align: center;
  margin-bottom: 32px;
  font-size: 13px;
  color: var(--ink-mute);
}
.login-mark .mark-italic {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 28px;
  color: var(--sage-dark);
  display: block;
}
.login-mark .mark-dot { color: var(--gold); margin: 0 6px; }
.login-mark .mark-sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 28px;
  color: var(--sage-dark);
  font-weight: 400;
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 22px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.login-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ============ BOGO grupo highlight ============ */
.bogo-group {
  background: var(--cream-deep);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: var(--radius);
}

/* ============ MEDIA QUERIES ============ */
@media (min-width: 768px) {
  body { font-size: 15.5px; }
  .sidebar { display: block; }
  .bottom-nav { display: none; }
  .main { padding: 36px 36px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .field-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header .actions { margin-top: 0; }
  .page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
  }
  .action-bar-mobile { display: none !important; }
}

@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .field-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* ============ UTIL ============ */
.hidden { display: none !important; }
.only-mobile { display: block; }
.only-desktop { display: none; }
@media (min-width: 768px) {
  .only-mobile { display: none; }
  .only-desktop { display: block; }
}
