/*
 * RepresentaAgro — Stylesheet
 * Design: HP-inspired — primary #024ad8, ink #1a1a1a, canvas #fff, cloud #f7f7f7
 */

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

[hidden] { display: none !important; }

/* ── Variáveis ─────────────────────────────────────────────────────────── */

:root {
  /* HP Design System */
  --primary:        #024ad8;
  --primary-bright: #296ef9;
  --primary-deep:   #0e3191;
  --primary-soft:   #c9e0fc;
  --on-primary:     #ffffff;

  --ink:      #1a1a1a;
  --ink-soft: #292929;
  --on-ink:   #ffffff;

  --canvas:   #ffffff;
  --cloud:    #f7f7f7;
  --fog:      #e8e8e8;
  --steel:    #c2c2c2;
  --graphite: #636363;
  --charcoal: #3d3d3d;
  --hairline: #e8e8e8;
  --error:    #b3262b;

  /* Semantic — status badges, metas, restock */
  --green-950: #052e16;
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-300: #86efac;
  --green-200: #bbf7d0;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-200: #fde68a;
  --amber-100: #fef3c7;
  --amber-50:  #fffbeb;

  --red-700:   #b91c1c;
  --red-600:   #dc2626;
  --red-500:   #ef4444;
  --red-200:   #fecaca;
  --red-100:   #fee2e2;
  --red-50:    #fef2f2;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  /* Layout tokens */
  --bg:        #f7f7f7;
  --surface:   #ffffff;
  --radius:    16px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow:    0 2px 8px rgba(26,26,26,0.08);
  --shadow-md: 0 8px 24px rgba(26,26,26,0.12);
  --shadow-lg: 0 16px 40px rgba(26,26,26,0.14);
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
    'Helvetica Neue', sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
}

h1, h2, h3, h4 { color: var(--ink); margin-top: 0; line-height: 1.2; font-weight: 500; }
h1 { font-size: 1.75rem; font-weight: 500; }
h2 { font-size: 1.05rem; font-weight: 600; }

a { color: var(--primary); transition: color 0.2s; }
a:hover { color: var(--primary-deep); text-decoration: underline; }

/* ── Layout base ────────────────────────────────────────────────────────── */

body.with-sidebar {
  display: flex;
  min-height: 100vh;
}

body.with-sidebar main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 48px;
  overflow-y: auto;
}

body.no-sidebar main {
  padding: 28px 28px 48px;
  max-width: 1440px;
  margin: 0 auto;
}

main {
  padding: 28px 28px 48px;
  max-width: 1440px;
  margin: 0 auto;
}

.devise-body main { padding: 0; max-width: 100%; margin: 0; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  width: 224px;
  min-width: 224px;
  background: var(--green-950);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.sidebar-brand-link:hover { color: var(--green-200); text-decoration: none; }

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  background: var(--green-700);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.70);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--green-400, #4ade80);
  font-weight: 600;
  text-decoration: none;
}

.sidebar-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-group-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.70);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.sidebar-group-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-caret {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.45;
  transition: transform 0.2s;
  display: inline-block;
}

.sidebar-group.open .sidebar-group-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-group.open .sidebar-caret {
  transform: rotate(90deg);
  opacity: 0.9;
}

.sidebar-submenu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 2px 0 4px 0;
  background: rgba(0,0,0,0.18);
}

.sidebar-group.open .sidebar-submenu { display: block; }

.sidebar-submenu a {
  display: block;
  padding: 8px 16px 8px 46px;
  color: rgba(255,255,255,0.60);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-submenu a:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-decoration: none;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.sidebar-user:hover { text-decoration: none; }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: var(--green-700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}

img.sidebar-avatar { display: block; background: none; }

.sidebar-user-name {
  color: rgba(255,255,255,0.80);
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout-form { margin: 0; }

.sidebar-logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.55);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.sidebar-logout-btn:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.40);
}

.mobile-topbar-toggle { display: none; }
.sidebar-backdrop     { display: none; }
.sidebar-close-btn    { display: none; }

/* ── Filter bar ─────────────────────────────────────────────────────────── */

.filter-bar {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-input {
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--cloud);
  color: var(--ink);
  transition: border-color 0.2s;
  height: 36px;
  font-family: inherit;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2,74,216,0.12);
  background: #fff;
}

.filter-wide { min-width: 240px; }

.filter-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--graphite);
  cursor: pointer;
  white-space: nowrap;
}

.filter-check {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Role badges ────────────────────────────────────────────────────────── */

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-admin   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.role-seller  { background: var(--primary-soft); color: var(--primary-deep); border: 1px solid #bfdbfe; }
.role-stock   { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.role-manager { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }

/* ── Search form ─────────────────────────────────────────────────────────── */

.search-form { display: flex; align-items: center; gap: 8px; }

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  min-width: 240px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2,74,216,0.12);
}

/* ── Flash ──────────────────────────────────────────────────────────────── */

.flash {
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-notice {
  background: var(--primary-soft);
  color: var(--primary-deep);
  border: 1px solid #bfdbfe;
}

.flash-alert {
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid var(--red-100);
}

/* ── Dashboard ──────────────────────────────────────────────────────────── */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}

.dashboard-header-content h1 {
  margin: 0 0 4px;
  font-size: 1.75rem;
  color: var(--ink);
}

.dashboard-subtitle {
  margin: 0;
  color: var(--graphite);
  font-size: 0.9rem;
}

.dashboard-header-date { display: flex; align-items: center; }

.period-filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}

.period-filter-group { display: flex; align-items: center; gap: 6px; }

.period-filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--graphite);
  white-space: nowrap;
}

.period-input {
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--cloud);
  color: var(--ink);
  transition: border-color 0.2s;
  font-family: inherit;
}

.period-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2,74,216,0.12);
  background: #fff;
}

.dashboard-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--graphite);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 36px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-period-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-radius: 20px;
  padding: 2px 10px;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ── Cards KPI ──────────────────────────────────────────────────────────── */

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

.dashboard-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  border-top: 3px solid transparent;
  transition: box-shadow 0.2s, transform 0.2s;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  order: 2;
}

.card-content {
  order: 1;
  width: 100%;
}

.card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--graphite);
  margin-bottom: 4px;
  white-space: nowrap;
  line-height: 1.3;
}

.dashboard-count {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.card-trend {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 5px;
  white-space: nowrap;
}
.card-trend.trend-up   { color: var(--green-700); }
.card-trend.trend-down { color: var(--red-600); }

/* Cores por card */
.card-customers  { border-top-color: var(--primary); }
.card-customers  .card-icon { background: var(--primary-soft); }

.card-orders     { border-top-color: var(--amber-600); }
.card-orders     .card-icon { background: var(--amber-50); }

.card-herds      { border-top-color: #0891b2; }
.card-herds      .card-icon { background: #ecfeff; }

.card-products   { border-top-color: #7c3aed; }
.card-products   .card-icon { background: #f5f3ff; }

.card-balances   { border-top-color: var(--primary); }
.card-balances   .card-icon { background: var(--primary-soft); }

.card-movements  { border-top-color: #db2777; }
.card-movements  .card-icon { background: #fdf2f8; }

.card-goals      { border-top-color: #ea580c; }
.card-goals      .card-icon { background: #fff7ed; }

.card-commissions { border-top-color: #7c3aed; }
.card-commissions .card-icon { background: #f5f3ff; }

/* ── Chart cards ────────────────────────────────────────────────────────── */

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--hairline);
  transition: box-shadow 0.2s;
}

.dashboard-chart-card:hover { box-shadow: var(--shadow-md); }

.dashboard-chart-card h2 {
  margin: 0 0 18px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--graphite);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--fog);
}

/* Acento colorido no topo do card */
.chart-card-accent { border-top: 3px solid var(--hairline); }
.chart-accent-blue   { border-top-color: var(--primary); }
.chart-accent-amber  { border-top-color: var(--amber-500); }
.chart-accent-green  { border-top-color: var(--green-600); }
.chart-accent-purple { border-top-color: #7c3aed; }
.chart-accent-teal   { border-top-color: #0891b2; }

.alert-card { border-left: 4px solid var(--red-500); border-top: none; }
.alert-card h2 { color: var(--red-700); }

.alert-list { display: flex; flex-direction: column; gap: 10px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--red-50);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--red-500);
}

.alert-badge {
  width: 28px;
  height: 28px;
  background: var(--red-500);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.alert-info    { flex: 1; min-width: 0; }
.alert-customer { font-weight: 600; color: var(--red-700); font-size: 0.9rem; }
.alert-details  { font-size: 0.82rem; color: var(--red-700); opacity: 0.8; margin-top: 1px; }

.alert-empty {
  padding: 14px 16px;
  background: var(--green-50);
  border-left: 3px solid var(--green-500);
  border-radius: var(--radius-md);
  color: var(--green-800);
  font-weight: 500;
  font-size: 0.9rem;
}

.negative-value { color: var(--red-700); font-weight: 700; }

/* ── Clientes recentes ──────────────────────────────────────────────────── */

.dashboard-recent { margin-bottom: 16px; }
.recent-list { display: flex; flex-direction: column; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.recent-item:last-child { border-bottom: none; }

.recent-avatar {
  width: 38px;
  height: 38px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.recent-content { flex: 1; min-width: 0; }

.recent-name { font-weight: 600; color: var(--ink); margin-bottom: 1px; font-size: 0.9rem; }
.recent-name a { text-decoration: none; color: var(--ink); }
.recent-name a:hover { color: var(--primary); text-decoration: none; }

.recent-meta { font-size: 0.8rem; color: var(--graphite); }
.recent-status { flex-shrink: 0; }

.recent-footer {
  padding: 14px 0 0;
  border-top: 1px solid var(--hairline);
  text-align: right;
  margin-top: 4px;
}

.link-action {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.link-action:hover { color: var(--primary-deep); text-decoration: none; }

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--graphite);
  background: var(--cloud);
  border-radius: var(--radius-md);
  margin: 0;
  font-size: 0.9rem;
}

/* ── Status badges ──────────────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active   { background: var(--green-100); color: var(--green-800); }
.status-inactive { background: var(--red-100);   color: var(--red-700);   }

/* ── Status de pedido ───────────────────────────────────────────────────── */

.order-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.order-status-quote              { background: var(--cloud);      color: var(--charcoal); }
.order-status-created            { background: var(--primary-soft); color: var(--primary-deep); }
.order-status-sent_to_factory    { background: #fdf4ff; color: #7e22ce; }
.order-status-in_production      { background: var(--amber-100); color: var(--amber-700); }
.order-status-invoiced           { background: #fff7ed; color: #c2410c; }
.order-status-in_transit         { background: #ecfeff; color: #0e7490; }
.order-status-delivered_customer { background: var(--green-100); color: var(--green-800); }
.order-status-delivered_warehouse{ background: var(--green-100); color: var(--green-800); }
.order-status-finalized          { background: #d1fae5; color: #065f46; font-weight: 700; }
.order-status-canceled           { background: var(--red-100);  color: var(--red-700); }

/* ── Tabelas ────────────────────────────────────────────────────────────── */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

table th, table td { padding: 12px 16px; text-align: left; }

table th {
  background: var(--cloud);
  color: var(--graphite);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--hairline);
}

table td { border-bottom: 1px solid var(--hairline); font-size: 0.9rem; color: var(--ink); }

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--cloud); }

.dashboard-chart-card table { margin: 0; }

tr.row-critical    { background: #fff7ed; }
tr.row-critical:hover { background: #ffedd5; }

.critical-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid #fca5a5;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Botões ─────────────────────────────────────────────────────────────── */

button,
input[type="submit"],
input[type="button"],
.button {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  padding: 9px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.2s, box-shadow 0.2s;
  line-height: 1;
  font-family: inherit;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.button:hover {
  background: var(--primary-deep);
  box-shadow: 0 4px 12px rgba(2,74,216,0.25);
  text-decoration: none;
  color: var(--on-primary);
}

.button-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.button-secondary:hover {
  background: var(--cloud);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.button-danger {
  background: var(--red-600);
  color: #fff;
}

.button-danger:hover {
  background: var(--red-700);
  box-shadow: 0 4px 10px rgba(220,38,38,0.22);
  color: #fff;
}

.button-small {
  padding: 5px 12px;
  font-size: 0.72rem;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 12px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.breadcrumb-link {
  color: var(--graphite);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb-link:hover { color: var(--primary); text-decoration: underline; }

.breadcrumb-current { color: var(--charcoal); font-weight: 500; }

.breadcrumb-sep { color: var(--steel); user-select: none; font-size: 13px; }

/* ── Page header ────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* ── Show page layout ───────────────────────────────────────────────────── */

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

.profile-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}

.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--hairline);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-avatar-info { flex: 1; }

.profile-avatar-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.profile-avatar-hint {
  display: block;
  font-size: 11px;
  color: var(--steel);
  margin-top: 4px;
}

.profile-avatar-remove {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--red-600);
  cursor: pointer;
  margin-top: 6px;
  accent-color: var(--red-600);
}

.info-list { display: flex; flex-direction: column; gap: 2px; margin: 0; }

.info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9rem;
}

.info-row:last-child { border-bottom: none; }

.info-row dt {
  flex-shrink: 0;
  width: 130px;
  color: var(--graphite);
  font-weight: 600;
  font-size: 0.8rem;
}

.info-row dd { margin: 0; color: var(--ink); }

/* ── Previsão de recompra ───────────────────────────────────────────────── */

.restock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.restock-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--steel);
}

.restock-ok       { border-left-color: var(--green-500); }
.restock-warning  { border-left-color: var(--amber-500); }
.restock-critical { border-left-color: var(--red-500); background: #fff8f8; }
.restock-overdue  { border-left-color: var(--red-700); background: #fff0f0; }
.restock-unknown  { border-left-color: var(--steel); }

.restock-product { font-weight: 700; font-size: 0.95rem; color: var(--ink); margin-bottom: 8px; }
.restock-balance { font-size: 0.85rem; color: var(--charcoal); margin-bottom: 10px; }
.restock-days    { font-size: 0.85rem; color: var(--charcoal); margin-bottom: 4px; }

.restock-days-unknown { color: var(--steel); font-style: italic; }
.restock-days-overdue { color: var(--red-700); font-weight: 600; }

.restock-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  display: inline-block;
  margin-right: 2px;
}

.restock-critical .restock-number { color: var(--red-600); }
.restock-warning  .restock-number { color: var(--amber-600); }

.restock-date { font-size: 0.8rem; color: var(--charcoal); margin-bottom: 6px; }

.restock-consumption {
  font-size: 0.78rem;
  color: var(--steel);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
}

/* ── Urgência (previsão de recompra) ────────────────────────────────────── */

.urgency-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }

.urgency-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 90px;
}

.urgency-card:hover  { box-shadow: var(--shadow-md); }
.urgency-card.active { border-color: var(--primary); }

.urgency-count { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--ink); }
.urgency-label { font-size: 0.75rem; color: var(--graphite); margin-top: 4px; white-space: nowrap; }

.urgency-overdue  .urgency-count { color: var(--red-700); }
.urgency-critical .urgency-count { color: var(--red-600); }
.urgency-warning  .urgency-count { color: var(--amber-600); }
.urgency-ok       .urgency-count { color: var(--green-600); }
.urgency-unknown  .urgency-count { color: var(--steel); }

.urgency-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.urgency-badge-overdue  { background: #fee2e2; color: var(--red-700); }
.urgency-badge-critical { background: #fef3c7; color: #b45309; }
.urgency-badge-warning  { background: #fef9c3; color: #854d0e; }
.urgency-badge-ok       { background: #dcfce7; color: var(--green-700); }
.urgency-badge-unknown  { background: var(--cloud); color: var(--graphite); }

.empty-state-box { text-align: center; padding: 60px 20px; color: var(--steel); }
.empty-state-box .empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Formulários ────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group--full { grid-column: 1 / -1; }

.form-group-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 520px) { .form-group-pair { grid-template-columns: 1fr; } }

.form-group-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .form-group-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .form-group-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .form-group-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; }

.form-group label {
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2,74,216,0.12);
}

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

.form-errors {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--red-50);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
}

.form-errors h2 { margin: 0 0 10px; color: var(--red-700); font-size: 0.95rem; }

/* ── Login ──────────────────────────────────────────────────────────────── */

.devise-body {
  background: var(--green-950);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow: hidden;
}

.login-container {
  display: grid;
  grid-template-columns: 1fr 480px;
  min-height: 100vh;
}

/* ── Painel esquerdo — visual imersivo ──────────────────────────────────── */

.login-visual {
  position: relative;
  overflow: hidden;
  background: var(--green-950);
  background-image: url(/assets/rebanho.jpg);
  background-size: cover;
  background-position: center 30%;
}

/* Overlay escuro verde sobre a foto */
.lv-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg,
      rgba(5,46,22,0.94) 0%,
      rgba(5,46,22,0.80) 60%,
      rgba(5,46,22,0.70) 100%);
  z-index: 1;
}

/* Orbs de luz animados */
.lv-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  z-index: 2;
  animation: lv-float 10s ease-in-out infinite;
}

.lv-orb-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(34,197,94,0.30), transparent 70%);
  top: -140px; left: -100px;
  animation-delay: 0s;
}

.lv-orb-2 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(2,74,216,0.22), transparent 70%);
  bottom: 80px; right: -60px;
  animation-delay: -5s;
}

.lv-orb-3 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(134,239,172,0.15), transparent 70%);
  top: 45%; left: 35%;
  animation-delay: -2.5s;
}

@keyframes lv-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(18px, -26px) scale(1.06); }
  66%       { transform: translate(-12px, 18px) scale(0.96); }
}

/* Grade sutil decorativa */
.lv-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Conteúdo do painel */
.lv-inner {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 48px 56px;
}

/* Marca */
.lv-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: auto;
}

.lv-brand-icon {
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.lv-brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

/* Hero */
.lv-hero {
  padding: 56px 0 40px;
}

.lv-hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green-400, #4ade80);
  background: rgba(74,222,128,0.12);
  border: 1px solid rgba(74,222,128,0.25);
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 24px;
}

.lv-hero-title {
  font-size: 3.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 22px;
}

.lv-hero-accent {
  color: var(--green-300, #86efac);
  display: inline-block;
}

.lv-hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.68);
  line-height: 1.65;
  margin: 0;
}

/* Features */
.lv-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 32px;
}

.lv-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
  transition: background 0.2s;
}

.lv-feature:hover { background: rgba(255,255,255,0.10); }

.lv-feature-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.lv-feature span:last-child {
  color: rgba(255,255,255,0.82);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Stats strip */
.lv-stats {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  gap: 0;
}

.lv-stat { flex: 1; text-align: center; }

.lv-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--green-300, #86efac);
  line-height: 1;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}

.lv-stat-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lv-stat-sep {
  width: 1px;
  height: 38px;
  background: rgba(255,255,255,0.14);
  flex-shrink: 0;
}

/* ── Painel direito — formulário ────────────────────────────────────────── */

.lf-side {
  background: #f0fdf4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 36px;
  position: relative;
  overflow: hidden;
}

/* Decoração de fundo no painel do form */
.lf-side::before {
  content: '';
  position: absolute;
  top: -160px;
  right: -160px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(2,74,216,0.06), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

.lf-side::after {
  content: '';
  position: absolute;
  bottom: -120px;
  left: -80px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(22,163,74,0.07), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

/* Card do formulário */
.lf-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px 38px 36px;
  box-shadow:
    0 4px 6px rgba(5,46,22,0.04),
    0 10px 30px rgba(5,46,22,0.09),
    0 30px 60px rgba(5,46,22,0.06);
  border: 1px solid rgba(5,46,22,0.07);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  animation: lf-rise 0.55s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes lf-rise {
  from { opacity: 0; transform: translateY(28px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo badge */
.lf-logo {
  text-align: center;
  margin-bottom: 28px;
}

.lf-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 99px;
  font-size: 1.05rem;
}

.lf-logo-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-800);
  letter-spacing: -0.01em;
}

/* Cabeçalho */
.lf-header {
  text-align: center;
  margin-bottom: 28px;
}

.lf-header h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.lf-header p {
  margin: 0;
  color: var(--graphite);
  font-size: 0.9rem;
}

/* Erros */
.lf-errors {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--red-50);
  border: 1px solid #fca5a5;
  border-left: 4px solid var(--red-500);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.lf-error-icon {
  color: var(--red-600);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.lf-errors ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lf-errors li {
  color: var(--red-700);
  font-size: 0.875rem;
  padding: 2px 0;
  font-weight: 500;
}

/* Campos */
.lf-field { margin-bottom: 18px; }

.lf-label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.lf-input-wrap {
  position: relative;
}

.lf-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  pointer-events: none;
  color: var(--steel);
  line-height: 1;
}

.lf-input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  border: 1.5px solid var(--fog);
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  background: var(--cloud);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}

.lf-input:focus {
  outline: none;
  border-color: var(--green-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.lf-input::placeholder { color: var(--steel); }

/* Linha lembrar / esqueceu */
.lf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 8px;
}

.lf-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--charcoal);
}

.lf-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--green-700);
  flex-shrink: 0;
}

.lf-forgot {
  font-size: 0.875rem;
  color: var(--green-700);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.lf-forgot:hover { color: var(--green-800); text-decoration: underline; }

/* Botão principal */
.lf-actions { margin-bottom: 4px; }

.lf-submit {
  width: 100%;
  padding: 13px;
  background: var(--green-700);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(22,163,74,0.30);
  font-family: inherit;
}

.lf-submit:hover {
  background: var(--green-800);
  box-shadow: 0 6px 20px rgba(22,163,74,0.38);
  transform: translateY(-1px);
}

.lf-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(22,163,74,0.25);
}

/* Nota de rodapé */
.lf-footer-note {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--graphite);
  text-align: center;
  position: relative;
  z-index: 1;
  opacity: 0.8;
}

/* Mantém compatibilidade com outras views de devise que usam classes antigas */
.login-form-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0fdf4;
  padding: 40px;
}

.login-form-container { width: 100%; max-width: 380px; }
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h2 { margin: 0 0 8px; font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.login-header p  { margin: 0; color: var(--graphite); font-size: 0.9rem; }

.login-errors {
  background: var(--red-50);
  border: 1px solid #fca5a5;
  border-left: 4px solid var(--red-500);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.login-errors ul { margin: 0; padding: 0; list-style: none; }
.login-errors li { color: var(--red-700); font-size: 0.875rem; padding: 3px 0; font-weight: 500; }
.login-field { margin-bottom: 18px; }

.login-label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  color: var(--charcoal);
  font-size: 0.875rem;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--fog);
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  background: var(--cloud);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}

.login-input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.login-input::placeholder { color: var(--steel); }

.login-checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.checkbox-input  { width: 16px; height: 16px; cursor: pointer; accent-color: var(--green-700); }
.checkbox-label  { font-size: 0.875rem; color: var(--charcoal); cursor: pointer; margin: 0; }

.login-actions { margin-bottom: 20px; }

.login-button {
  width: 100%;
  padding: 13px;
  background: var(--green-700);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.925rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(22,163,74,0.30);
  font-family: inherit;
}

.login-button:hover {
  background: var(--green-800);
  box-shadow: 0 6px 20px rgba(22,163,74,0.38);
  transform: translateY(-1px);
}

.login-footer { border-top: 1px solid var(--hairline); padding-top: 18px; }
.login-links { display: flex; flex-direction: column; gap: 10px; text-align: center; }

.link-footer {
  color: var(--green-700);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.link-footer:hover { color: var(--green-800); text-decoration: underline; }

/* ── Responsivo login ──────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .login-container { grid-template-columns: 1fr 440px; }
  .lv-hero-title   { font-size: 2.8rem; }
  .lv-features     { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .login-container { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-visual    { min-height: 280px; }
  .lv-inner        { padding: 32px 28px; }
  .lv-hero         { padding: 24px 0 20px; }
  .lv-hero-title   { font-size: 2.2rem; }
  .lv-features     { display: none; }
  .lv-stats        { gap: 0; }
  .lf-side         { padding: 32px 20px; }
  .lf-card         { padding: 32px 24px; border-radius: 18px; }
}

@media (max-width: 480px) {
  .lv-hero-title   { font-size: 1.9rem; }
  .lf-card         { padding: 28px 20px; }
  .lv-stats        { padding: 14px 16px; }
  .lv-stat-value   { font-size: 1.1rem; }
}

/* ── Status update form inline ─────────────────────────────────────────── */

.status-update-form { display: flex; align-items: center; gap: 8px; }

/* ── Order item form ────────────────────────────────────────────────────── */

.order-item-form-wrap {
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.order-item-form-wrap h2 {
  margin: 0 0 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-deep);
}

/* ── Progress bar ───────────────────────────────────────────────────────── */

.progress-bar-track {
  height: 11px;
  background: var(--fog);
  border-radius: 99px;
  overflow: hidden;
  margin: 5px 0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.progress-low      { background: var(--red-500); }
.progress-good     { background: var(--amber-500); }
.progress-complete { background: var(--primary); }

.goal-progress-section { margin-bottom: 16px; }
.goal-progress-section:last-child { margin-bottom: 0; }

.goal-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--charcoal);
  margin-bottom: 3px;
}

.progress-pct { font-size: 0.75rem; color: var(--steel); text-align: right; margin-top: 2px; }

/* ── Seller goal rows ───────────────────────────────────────────────────── */

.seller-goal-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
}

.seller-goal-info { min-width: 0; }

.seller-goal-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seller-goal-sub { font-size: 0.78rem; color: var(--graphite); }
.seller-goal-progress { flex: 1; min-width: 0; }
.seller-goal-actions  { flex-shrink: 0; }

.divider-light { border: none; border-top: 1px solid var(--hairline); margin: 0; }

/* ── Dashboard do Vendedor ──────────────────────────────────────────────── */

.card-sub { display: block; font-size: 0.75rem; color: var(--graphite); margin-top: 2px; }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.goal-progress-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.goal-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.goal-period-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  background: var(--cloud);
  color: var(--graphite);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.goal-progress-row { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--charcoal); margin-bottom: 5px; }
.goal-progress-label { font-weight: 500; }
.goal-progress-value { color: var(--ink); }

.goal-progress-bar-wrap {
  background: var(--fog);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.goal-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  background: var(--steel);
}

.bar-full { background: var(--primary); }
.bar-good { background: var(--amber-500); }
.bar-low  { background: var(--red-500); }

.goal-progress-pct { font-size: 0.75rem; color: var(--graphite); text-align: right; margin-top: 3px; }

/* ── Card border colors (genérico) ──────────────────────────────────────── */

.card-border-green { border-top-color: var(--green-600); }
.card-border-amber { border-top-color: var(--amber-600); }
.card-border-red   { border-top-color: var(--red-600); }
.card-border-blue  { border-top-color: var(--primary); }

/* ── Paginação (kaminari) ───────────────────────────────────────────────── */

.pagination-wrap { display: flex; justify-content: center; margin: 20px 0 8px; }

nav.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

nav.pagination a,
nav.pagination span,
nav.pagination em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--hairline);
  color: var(--charcoal);
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}

nav.pagination a:hover {
  background: var(--primary-soft);
  border-color: #bfdbfe;
  color: var(--primary-deep);
}

nav.pagination .current,
nav.pagination em.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-style: normal;
  font-weight: 700;
}

nav.pagination .disabled,
nav.pagination span.disabled {
  color: var(--steel);
  background: var(--cloud);
  border-color: var(--hairline);
  cursor: not-allowed;
}

/* ── Tabelas como cards em mobile ────────────────────────────────────────── */

@media (max-width: 768px) {
  .table-responsive table {
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
    border-radius: 0;
    overflow: visible;
  }

  .table-responsive thead { display: none; }
  .table-responsive tbody { display: block; }

  .table-responsive tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
  }

  .table-responsive tr.row-critical {
    border-left: 4px solid var(--amber-500);
    background: #fffbf0;
  }

  .table-responsive tr:hover td { background: transparent; }

  .table-responsive td {
    display: block;
    position: relative;
    padding: 9px 14px 9px 116px;
    border-bottom: 1px solid var(--hairline);
    font-size: 0.9rem;
    text-align: left !important;
    min-height: 38px;
    white-space: normal;
  }

  .table-responsive td:last-child { border-bottom: none; }

  .table-responsive td[data-label]::before {
    content: attr(data-label);
    position: absolute;
    left: 14px;
    top: 10px;
    width: 92px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--steel);
    line-height: 1.3;
  }

  .table-responsive td.col-actions,
  .table-responsive td:not([data-label]):last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    justify-content: flex-end;
    background: var(--cloud);
    border-top: 1px solid var(--hairline);
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .table-responsive td.col-actions::before,
  .table-responsive td:not([data-label]):last-child::before { display: none; }

  .table-responsive td[data-label] > div[style*="flex"] { width: 100%; }
  .table-responsive { overflow-x: visible; }
}

/* ── Badge de tipo de movimentação ─────────────────────────────────────── */

.movement-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.movement-entry      { background: var(--green-100); color: var(--green-800); }
.movement-withdrawal { background: var(--red-100);   color: var(--red-700);   }
.movement-adjustment { background: var(--amber-100); color: var(--amber-700); }

/* ── Formulário de itens de movimentação ───────────────────────────────── */

.movement-items-section {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--cloud);
  margin-bottom: 16px;
}

.movement-items-header {
  display: flex;
  gap: 8px;
  padding: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--graphite);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 8px;
}

.movement-item-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.movement-item-row .login-input { margin: 0; }
.movement-item-row .login-input:first-of-type { flex: 1; }
.qty-input { width: 110px !important; flex: none !important; }
.movement-add-btn { margin-top: 6px; }

/* ── Utilitários de tabela ──────────────────────────────────────────────── */

.text-nowrap  { white-space: nowrap; }
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.text-left    { text-align: left !important; }

.col-actions { white-space: nowrap; width: 1%; text-align: right; }
.col-actions .button + .button { margin-left: 4px; }

.col-actions form,
.page-actions form,
.commission-actions form { display: inline-block; }

.col-actions form + .button,
.col-actions .button + form .button,
.col-actions form + form .button { margin-left: 4px; }

/* ── Commission status badges ───────────────────────────────────────────── */

.commission-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.commission-status-pending  { background: #fef3c7; color: #b45309; }
.commission-status-approved { background: var(--green-100); color: var(--green-700); }
.commission-status-paid     { background: var(--primary-soft); color: var(--primary-deep); }
.commission-status-rejected { background: #fee2e2; color: var(--red-700); }

/* ── Commission approval flow ───────────────────────────────────────────── */

.commission-flow {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.flow-step {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--cloud);
  color: var(--graphite);
  border: 1px solid var(--hairline);
}

.flow-step-done     { background: var(--green-50); color: var(--green-700); border-color: var(--green-300); }
.flow-step-rejected { background: #fee2e2; color: var(--red-700); border-color: #fca5a5; }

.flow-arrow      { color: var(--steel); font-size: 1.1rem; line-height: 1; }
.flow-arrow-done { color: var(--green-300); }

.commission-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.commission-action-info { width: 100%; font-size: 0.88rem; color: var(--charcoal); margin-bottom: 8px; }

/* ── Faixas de comissão ─────────────────────────────────────────────────── */

.tiers-section {
  margin-top: 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--cloud);
}

.tiers-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tiers-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--charcoal); margin: 0; }
.tiers-hint { font-size: 0.8rem; color: var(--steel); margin-bottom: 14px; }
.tier-row { margin-bottom: 8px; }
.tier-row-fields { display: flex; gap: 10px; align-items: flex-end; }
.tier-row-fields .form-group { flex: 1; margin-bottom: 0; }
.tier-remove-btn { flex-shrink: 0; align-self: flex-end; margin-bottom: 0; }

/* ── Permissões — grade de checkboxes ───────────────────────────────────── */

.perm-group {
  margin-bottom: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.perm-group-header {
  padding: 6px 12px;
  background: var(--cloud);
  border-bottom: 1px solid var(--hairline);
}

.perm-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--charcoal);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.perm-keys {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
  padding: 8px;
}

.perm-key-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.1s;
}

.perm-key-label:hover { background: var(--cloud); }
.perm-key-label input { accent-color: var(--primary); cursor: pointer; }

.perm-key-name { font-weight: 500; color: var(--charcoal); }
.perm-key-full { font-size: 0.72rem; color: var(--steel); font-family: monospace; }

.perm-keys-override { grid-template-columns: 1fr; gap: 1px; padding: 4px 8px; }

.perm-override-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--cloud);
}

.perm-override-row .perm-key-full { flex: 1; font-size: 0.78rem; color: var(--charcoal); }

.perm-base-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.perm-base-yes { background: var(--green-50);  color: var(--green-700); }
.perm-base-no  { background: var(--cloud); color: var(--steel); }

.perm-override-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--cloud);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--steel);
  transition: all 0.15s;
  user-select: none;
}

.perm-override-btn:hover { border-color: var(--steel); }
.perm-grant.active  { background: var(--green-100); color: var(--green-700); border-color: var(--green-300); }
.perm-revoke.active { background: #fee2e2; color: var(--red-700); border-color: #fca5a5; }

/* ── Manual do Sistema ─────────────────────────────────────────────────── */

.manual-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.manual-search-input-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.manual-search-icon { font-size: 15px; flex-shrink: 0; }

.manual-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}

.manual-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--steel);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.manual-search-clear:hover { background: var(--cloud); color: var(--charcoal); }

.manual-search-counter { font-size: 12px; color: var(--steel); white-space: nowrap; flex-shrink: 0; }

.manual-no-results {
  text-align: center;
  padding: 40px;
  color: var(--steel);
  background: var(--surface);
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.manual-layout { display: flex; gap: 24px; align-items: flex-start; }

.manual-toc {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  width: 220px;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
}

.manual-toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--steel);
  margin-bottom: 10px;
}

.manual-toc ul { list-style: none; margin: 0; padding: 0; }
.manual-toc > ul > li { margin-bottom: 6px; }
.manual-toc > ul > li > ul { padding-left: 12px; margin-top: 4px; }
.manual-toc > ul > li > ul > li { margin-bottom: 3px; }

.manual-toc a {
  color: var(--charcoal);
  text-decoration: none;
  display: block;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
}
.manual-toc a:hover { background: var(--primary-soft); color: var(--primary); }
.manual-toc a.toc-active {
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: 5px;
}

.manual-toc-group {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel);
  display: block;
  margin-bottom: 2px;
}

.manual-sections { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.manual-section {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px 28px;
  scroll-margin-top: 28px;
}

.manual-section[hidden] { display: none; }

.manual-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-soft);
}

.manual-section-desc { font-size: 0.88rem; color: var(--graphite); margin-bottom: 20px; line-height: 1.6; }

.manual-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--graphite);
  margin: 20px 0 10px;
}
.manual-section h3:first-of-type { margin-top: 0; }

.manual-section p { font-size: 0.88rem; color: var(--charcoal); line-height: 1.6; margin-bottom: 10px; }

.manual-fields { display: flex; flex-direction: column; gap: 8px; }

.manual-field {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 16px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--cloud);
  font-size: 0.85rem;
  align-items: baseline;
}

.manual-field dt { font-weight: 600; color: var(--charcoal); }
.manual-field dd { color: var(--graphite); line-height: 1.55; margin: 0; }

.manual-required {
  font-size: 10px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.manual-tip {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fffbeb;
  border-left: 3px solid var(--amber-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  color: var(--charcoal);
  line-height: 1.5;
}

.manual-list { font-size: 0.88rem; color: var(--charcoal); padding-left: 20px; line-height: 1.8; }

.manual-section code {
  background: var(--cloud);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--charcoal);
}

mark.manual-highlight { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }

@media (max-width: 900px) {
  .manual-layout { flex-direction: column; }
  .manual-toc { position: static; width: auto; max-height: none; overflow-y: visible; margin-bottom: 16px; }
  .manual-field { grid-template-columns: 1fr; }
}

@media print {
  /* ── Página ─────────────────────────────────────────────────────────────
   * 0,5 cm = mínimo de hardware da HP MFP 135w e similares.
   * Com CSS margin = hardware minimum, o driver não altera a posição,
   * garantindo resultado consistente em PDF, Epson, HP Laser e HP MFP.
   * ────────────────────────────────────────────────────────────────────── */
  @page { size: A4 portrait; margin: 0.5cm; }

  /* ── Elementos de interface ocultos na impressão ───────────────────── */
  .sidebar,
  .sidebar-backdrop,
  .mobile-topbar-toggle,
  .filter-bar,
  .filter-form,
  .page-actions,
  .flash,
  .pagination-wrap,
  .col-actions,
  .btn-icon,
  .breadcrumbs,
  .registered-cta,
  .empty-state-table .empty-icon { display: none !important; }

  /* ── Layout — main sem sidebar ─────────────────────────────────────── */
  body, html { background: #fff !important; }
  body.with-sidebar,
  body.no-sidebar { display: block !important; }
  body.with-sidebar main,
  body.no-sidebar main,
  main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  /* ── Tipografia e cores ────────────────────────────────────────────── */
  body { font-family: Arial, Helvetica, sans-serif !important; font-size: 11pt; color: #111 !important; }
  a    { color: #111 !important; text-decoration: none !important; }

  /* ── Cabeçalho de página (page-header) ────────────────────────────── */
  .page-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    border-bottom: 2px solid #111 !important;
    padding-bottom: 6px !important;
    margin-bottom: 14px !important;
  }
  .page-header h1          { font-size: 14pt !important; margin: 0 !important; }
  .dashboard-subtitle      { font-size: 9pt !important; color: #555 !important; margin: 2px 0 0 !important; }

  /* ── Tabelas ───────────────────────────────────────────────────────── */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10pt !important;
    table-layout: fixed !important;
  }
  th {
    background: #e8e8e8 !important;
    border: 1px solid #999 !important;
    padding: 5px 7px !important;
    font-size: 9.5pt !important;
    font-weight: bold !important;
    text-align: left !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  td {
    border: 1px solid #ccc !important;
    padding: 4px 7px !important;
    vertical-align: middle !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  tr:nth-child(even) td {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  thead { display: table-header-group !important; }
  tr    { break-inside: avoid !important; page-break-inside: avoid !important; }

  /* ── Badges de movimentação ────────────────────────────────────────── */
  .movement-badge {
    font-size: 8.5pt !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    font-weight: bold !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .movement-entry     { background: #d1fae5 !important; color: #065f46 !important; }
  .movement-withdrawal{ background: #fee2e2 !important; color: #991b1b !important; }
  .movement-adjustment{ background: #e0e7ff !important; color: #3730a3 !important; }
  .movement-loan      { background: #fef9c3 !important; color: #854d0e !important; }
  .movement-return    { background: #f3e8ff !important; color: #6b21a8 !important; }

  /* ── Cabeçalho de impressão com empresa ───────────────────────────── */
  .print-list-header       { display: flex !important; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
  .print-list-header-left  { font-size: 11pt; font-weight: bold; color: #111; }
  .print-list-header-right { font-size: 9pt; color: #555; text-align: right; }

  /* ── Manual ────────────────────────────────────────────────────────── */
  .manual-search-bar, .manual-toc { display: none !important; }
  .manual-layout { display: block !important; }
  .manual-section { break-inside: avoid; border: none; padding: 16px 0; border-bottom: 1px solid #ddd; }
  .manual-section[hidden] { display: block !important; }
}

/* ── PDF Import ─────────────────────────────────────────────────────────── */

.pdf-import-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.pdf-import-icon-wrap {
  width: 46px;
  height: 46px;
  background: var(--primary-soft);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}

.pdf-import-info { flex: 1; }
.pdf-import-info strong { font-size: 0.95rem; color: var(--ink); display: block; }
.pdf-import-info p { margin: 2px 0 0; font-size: 0.82rem; color: var(--graphite); }

.pdf-import-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.pdf-import-loading { background: var(--primary-soft); color: var(--primary-deep); border-color: #bfdbfe; }
.pdf-import-success { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.pdf-import-error   { background: var(--red-50);  color: var(--red-700);   border-color: var(--red-100);  }

.pdf-import-preview {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--cloud);
  border-bottom: 1px solid var(--hairline);
}

.pdf-preview-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--steel); margin: 0; }

.pdf-preview-order-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  background: var(--fog);
  padding: 2px 12px;
  border-radius: 20px;
  border: 1px solid var(--hairline);
}

.pdf-preview-body { padding: 20px; }

.pdf-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.pdf-preview-block {
  background: var(--cloud);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pdf-preview-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--steel); }
.pdf-preview-value { font-size: 0.88rem; color: var(--charcoal); font-weight: 500; }

.pdf-match-found   { font-size: 0.88rem; color: var(--green-700); font-weight: 500; }
.pdf-match-missing { font-size: 0.85rem; color: var(--amber-700); font-weight: 500; }

.pdf-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--steel);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.pdf-items-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.pdf-items-table thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--graphite);
  background: var(--cloud);
  border-bottom: 2px solid var(--hairline);
  white-space: nowrap;
}

.pdf-items-table tbody tr { transition: background 0.12s; }
.pdf-items-table tbody tr:hover { background: var(--cloud); }
.pdf-items-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--hairline); }
.pdf-items-table td { padding: 10px 12px; color: var(--charcoal); vertical-align: middle; }
.pdf-items-table .td-product { font-weight: 500; color: var(--ink); }
.pdf-items-table .td-num { font-variant-numeric: tabular-nums; text-align: right; color: var(--charcoal); white-space: nowrap; }
.pdf-items-table .td-status { width: 230px; }

.pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.pdf-badge-ok   { background: var(--green-100); color: var(--green-800); }
.pdf-badge-warn { background: var(--amber-100); color: var(--amber-700); border: 1px solid var(--amber-200); }

.pdf-product-actions { display: flex; flex-direction: column; gap: 6px; }
.pdf-product-select { font-size: 0.8rem !important; padding: 4px 8px !important; height: auto !important; border-radius: var(--radius-sm) !important; }

.pdf-product-register {
  font-size: 0.78rem !important;
  padding: 3px 10px !important;
  text-align: center;
  background: transparent !important;
  color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  box-shadow: none !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.pdf-product-register:hover { background: var(--primary-soft) !important; }

.pdf-missing-hint {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--amber-50);
  border: 1px solid var(--amber-200);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--amber-700);
  line-height: 1.5;
}

.factory-order-tag {
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--cloud);
  color: var(--graphite);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  vertical-align: middle;
  margin-left: 8px;
  letter-spacing: 0.02em;
}

/* ── Extrato de Estoque ─────────────────────────────────────────────────── */

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

.extrato-table th {
  padding: 10px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--graphite);
  border-bottom: 2px solid var(--hairline);
  background: var(--cloud);
}

.extrato-table td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); font-size: 0.88rem; }

.extrato-opening td { background: var(--cloud); font-weight: 600; }
.extrato-closing td { background: var(--cloud); font-weight: 700; border-top: 2px solid var(--steel); }
.extrato-row-entry     { background: #fff; }
.extrato-row-withdrawal { background: #fffbfb; }

.extrato-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.extrato-badge-entry      { background: #dcfce7; color: #15803d; }
.extrato-badge-withdrawal { background: #fee2e2; color: #b91c1c; }
.extrato-badge-adjustment { background: var(--primary-soft); color: var(--primary-deep); }
.extrato-badge-loan       { background: #fef9c3; color: #854d0e; }

.extrato-balance { text-align: right; font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
.extrato-balance-positive { color: var(--green-700); }
.extrato-balance-negative { color: var(--red-700); }
.extrato-balance-neutral  { color: var(--graphite); }

/* ── Card Dias Úteis ────────────────────────────────────────────────────── */

.biz-days-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 24px; }

.biz-days-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.biz-days-title  { font-weight: 600; font-size: 0.95rem; color: var(--charcoal); }
.biz-days-range  { display: block; font-size: 0.78rem; color: var(--steel); margin-top: 2px; }

.biz-days-numbers { display: flex; align-items: center; gap: 10px; }
.biz-day-num      { text-align: center; }

.biz-day-val {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1;
}
.biz-day-val.biz-elapsed   { color: var(--primary); }
.biz-day-val.biz-remaining { color: var(--ink); }

.biz-day-lbl { font-size: 0.7rem; color: var(--steel); text-transform: uppercase; letter-spacing: 0.04em; }
.biz-day-sep { font-size: 1.4rem; color: var(--hairline); font-weight: 300; }

.biz-progress-wrap { position: relative; height: 10px; background: var(--fog); border-radius: 99px; overflow: visible; margin-bottom: 6px; }

.biz-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.4s ease;
  min-width: 4px;
}

.biz-holiday-marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 16px;
  background: var(--amber-500);
  border-radius: 2px;
  transform: translateX(-50%);
  cursor: help;
}

.biz-holiday-marker::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  background: var(--amber-500);
  border-radius: 50%;
}

.biz-progress-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--steel); margin-bottom: 12px; }
.biz-pct-label       { font-weight: 600; color: var(--graphite); }

.biz-days-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  font-size: 0.83rem;
  color: var(--graphite);
}
.biz-holiday-info strong { color: #b45309; }
.biz-pace-info strong    { color: var(--ink); }

/* ── Quick-create modal ──────────────────────────────────────────────────── */

.select-with-add { display: flex; gap: 6px; align-items: center; }
.select-with-add .login-input,
.select-with-add select { flex: 1; min-width: 0; }

.btn-add-inline {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--cloud);
  color: var(--charcoal);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-add-inline:hover {
  background: var(--primary-soft);
  border-color: #bfdbfe;
  color: var(--primary);
}

.qc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.qc-modal {
  background: var(--canvas);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.qc-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.qc-modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--ink); }

.qc-close { background: none; border: none; font-size: 1.1rem; color: var(--steel); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); }
.qc-close:hover { background: var(--cloud); color: var(--charcoal); }

.qc-modal-footer { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

.qc-full-link { font-size: 0.82rem; color: var(--steel); margin-left: auto; text-decoration: underline; }
.qc-full-link:hover { color: var(--charcoal); }

.qc-error {
  background: var(--red-50);
  border: 1px solid #fecaca;
  color: var(--red-700);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* ── Painel de saldo de cliente ─────────────────────────────────────────── */

.balance-preview-panel { margin-top: 10px; border: 1px solid var(--hairline); border-radius: var(--radius-md); overflow: hidden; font-size: 0.85rem; }
.balance-preview-header { background: var(--cloud); border-bottom: 1px solid var(--hairline); padding: 6px 12px; font-weight: 600; font-size: 0.78rem; color: var(--graphite); letter-spacing: 0.04em; text-transform: uppercase; }
.balance-preview-empty  { padding: 10px 14px; color: var(--steel); font-style: italic; font-size: 0.85rem; }

.balance-preview-table { width: 100%; border-collapse: collapse; margin: 0; }
.balance-preview-table thead tr { background: transparent; }
.balance-preview-table th { padding: 5px 10px; font-size: 0.75rem; font-weight: 600; color: var(--graphite); text-align: left; border-bottom: 1px solid var(--hairline); }
.balance-preview-table td { padding: 6px 10px; border-bottom: 1px solid var(--cloud); vertical-align: middle; }
.balance-preview-table tbody tr:last-child td { border-bottom: none; }
.balance-preview-table tbody tr:hover { background: var(--cloud); }

.bp-product { color: var(--charcoal); }
.bp-qty     { font-variant-numeric: tabular-nums; }
.bp-min     { color: var(--steel); font-size: 0.8rem; }

.balance-preview-ok   { color: var(--green-700); }
.balance-preview-crit { color: var(--amber-600); }
.balance-preview-neg  { color: var(--red-600); }

.balance-warn {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  color: #9a3412;
  font-size: 0.8rem;
  font-weight: 500;
  grid-column: 1 / -1;
}

.balance-submit-banner {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--red-50);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-size: 0.85rem;
}
.balance-submit-banner ul { margin: 4px 0 0 16px; padding: 0; }
.balance-submit-banner li { margin: 2px 0; }

/* ── Última movimentação ─────────────────────────────────────────────────── */

.last-movement-summary {
  max-width: 680px;
  margin-bottom: 24px;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  background: var(--green-50);
  overflow: hidden;
}

.last-movement-header { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #bbf7d0; }

.lm-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-600);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.last-movement-title { display: flex; align-items: center; gap: 14px; }
.last-movement-meta  { color: var(--graphite); font-size: 0.82rem; margin-top: 2px; }

.last-movement-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.last-movement-table th { padding: 6px 18px; font-size: 0.75rem; font-weight: 600; color: var(--graphite); text-align: left; border-bottom: 1px solid #bbf7d0; background: #dcfce7; }
.last-movement-table td { padding: 8px 18px; border-bottom: 1px solid #d1fae5; color: var(--charcoal); }
.last-movement-table tr:last-child td { border-bottom: none; }
.last-movement-notes { padding: 8px 18px; font-size: 0.8rem; color: var(--graphite); border-top: 1px solid #bbf7d0; font-style: italic; }

.last-movement-cta { display: flex; gap: 0; border-top: 1px solid #bbf7d0; }

.lm-cta-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  text-decoration: none;
  color: var(--green-700);
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  border-right: 1px solid #bbf7d0;
  transition: background 0.15s;
  text-transform: none;
  letter-spacing: 0;
}

.lm-cta-btn:last-child { border-right: none; }
.lm-cta-btn:hover { background: #dcfce7; color: var(--green-700); }
.lm-cta-primary { background: var(--green-600); color: #fff; }
.lm-cta-primary:hover { background: var(--green-700); color: #fff; }
.lm-cta-icon  { font-size: 1.2rem; line-height: 1; }
.lm-cta-label { letter-spacing: 0.01em; }

.registered-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}
.registered-cta-withdrawal { background: var(--green-50); border: 1px solid #86efac; color: var(--green-700); }
.registered-cta-entry      { background: var(--primary-soft); border: 1px solid #bfdbfe; color: var(--primary-deep); }

/* ── PDF Attachment ─────────────────────────────────────────────────────── */

.pdf-attachment-card { border: 1px solid var(--hairline); border-radius: var(--radius); margin-bottom: 24px; overflow: hidden; background: var(--cloud); }
.pdf-attachment-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--hairline); background: var(--surface); flex-wrap: wrap; gap: 8px; }
.pdf-attachment-title  { font-weight: 600; font-size: 0.9rem; color: var(--charcoal); }
.pdf-attachment-info   { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.pdf-attachment-name   { font-size: 0.875rem; color: var(--charcoal); font-weight: 500; }
.pdf-attachment-size   { font-size: 0.78rem; color: var(--steel); }

.pdf-upload-form { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.pdf-upload-label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; min-width: 0; }
.pdf-upload-input { display: none; }

.pdf-upload-filename {
  font-size: 0.82rem;
  color: var(--graphite);
  padding: 6px 10px;
  border: 1px dashed var(--steel);
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s;
}
.pdf-upload-filename:hover { border-color: var(--primary); }

/* ── Storage fee ─────────────────────────────────────────────────────────── */

.storage-fee-subtotal td { background: var(--cloud); border-top: 1px solid var(--hairline); font-size: 0.85rem; }

/* ── Badges genéricos ──────────────────────────────────────────────────── */

.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-warning { background: var(--amber-100); color: var(--amber-700); }
.badge-success { background: var(--green-100); color: var(--green-800); }
.badge-danger  { background: var(--red-100);   color: var(--red-700); }
.badge-info    { background: var(--primary-soft); color: var(--primary-deep); }

/* ── Card genérico (container CRUD) ────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--hairline);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

/* ── Log de Auditoria ──────────────────────────────────────────────────── */

.audit-row td { vertical-align: middle; }

.audit-expand-btn {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 1px 6px;
  font-size: 0.9rem;
  color: var(--graphite);
  line-height: 1.4;
}
.audit-expand-btn:hover { background: var(--cloud); }

.audit-changes-row { background: var(--cloud); }
.audit-changes-row.hidden { display: none; }

.audit-changes-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; margin-top: 4px; }
.audit-changes-table th { text-align: left; padding: 4px 8px; background: var(--fog); font-weight: 600; color: var(--charcoal); }
.audit-changes-table td { padding: 4px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; font-family: monospace; }
.audit-before { color: var(--red-700); background: #fef2f2; }
.audit-after  { color: var(--green-800); background: #f0fdf4; }

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .login-container { grid-template-columns: 1fr; }
  .login-visual { min-height: 220px; order: -1; }
  .visual-text h1 { font-size: 1.9rem; }
  .visual-features { gap: 8px; }
  .feature { padding: 8px 10px; font-size: 0.875rem; }
}

@media (max-width: 768px) {
  main { padding: 20px 16px 40px; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
  .dashboard-cards  { grid-template-columns: repeat(2, 1fr); }

  body.with-sidebar { display: block; }
  body.with-sidebar main { padding-top: 64px; }

  .mobile-topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 10px;
    left: 12px;
    z-index: 1003;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--green-950);
    color: #fff;
    font-size: 1.3rem;
    box-shadow: var(--shadow-md);
    transition: background 0.2s;
    text-transform: none;
    letter-spacing: 0;
  }

  .mobile-topbar-toggle:hover { background: var(--green-900); }

  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    min-width: 260px;
    z-index: 1002;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { left: 0; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26,26,26,0.50);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.visible { opacity: 1; visibility: visible; }
  body.mobile-nav-open { overflow: hidden; }

  .sidebar-brand { display: flex; align-items: center; justify-content: space-between; }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.80);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-transform: none;
    letter-spacing: 0;
  }

  .sidebar-close-btn:hover { background: rgba(255,255,255,0.20); color: #fff; }

  .search-form { flex-wrap: wrap; }
  .search-input { min-width: 0; flex: 1; }
}

@media (max-width: 480px) {
  .login-form-wrapper { padding: 20px 16px; }
  .login-form-container { max-width: 100%; }
  .dashboard-charts { grid-template-columns: 1fr; }
  main { padding: 16px 12px 32px; }
  body.with-sidebar main { padding-top: 60px; }
  .page-header { gap: 12px; }
}

@media (max-width: 380px) {
  .dashboard-cards { grid-template-columns: 1fr; }
}

/* ── Ações Rápidas (agro) ───────────────────────────────────────────────── */

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: none;
  transition: box-shadow 0.15s, transform 0.15s, background 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.quick-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.qa-icon  { font-size: 1.1rem; line-height: 1; }
.qa-label { line-height: 1; }

.quick-action-movement {
  background: var(--green-700);
  color: #fff;
  border-color: var(--green-700);
}
.quick-action-movement:hover { background: var(--green-800); color: #fff; }

.quick-action-order {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.quick-action-order:hover { background: var(--primary-deep); color: #fff; }

.quick-action-customer {
  background: var(--surface);
  color: var(--charcoal);
  border-color: var(--hairline);
}
.quick-action-customer:hover { background: var(--cloud); color: var(--ink); }

.quick-action-forecast {
  background: var(--amber-50);
  color: var(--amber-700);
  border-color: var(--amber-200);
}
.quick-action-forecast:hover { background: var(--amber-100); color: var(--amber-700); }

@media (max-width: 480px) {
  .quick-action-btn { flex: 1 1 calc(50% - 5px); justify-content: center; }
}

/* ── Banner de alertas críticos (topo dashboard) ────────────────────────── */

.critical-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--red-50);
  border: 1px solid var(--red-200);
  border-left: 4px solid var(--red-600);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.critical-banner-icon { font-size: 1.5rem; flex-shrink: 0; }
.critical-banner-text { flex: 1; }
.critical-banner-text strong { display: block; color: var(--red-700); font-size: 0.9rem; }
.critical-banner-text span   { color: var(--red-600); font-size: 0.82rem; }
.critical-banner-link {
  color: var(--red-700);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: underline;
}
.critical-banner-link:hover { color: var(--red-600); }

/* ── Urgência na tabela de saldos ───────────────────────────────────────── */

.balance-urgency-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.days-bar-track {
  flex: 1;
  height: 6px;
  background: var(--fog);
  border-radius: 99px;
  overflow: hidden;
  min-width: 40px;
}

.days-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s;
}

.days-bar-overdue  { background: var(--red-700); }
.days-bar-critical { background: var(--red-500); }
.days-bar-warning  { background: var(--amber-500); }
.days-bar-ok       { background: var(--green-500); }
.days-bar-unknown  { background: var(--steel); }

.days-label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.days-label-overdue  { color: var(--red-700); }
.days-label-critical { color: var(--red-600); }
.days-label-warning  { color: var(--amber-700); }
.days-label-ok       { color: var(--green-700); }
.days-label-unknown  { color: var(--steel); }

.row-overdue  { background: #fff5f5 !important; }
.row-warning  { background: #fffbeb !important; }

/* ── Urgency cards — borda lateral colorida ─────────────────────────────── */

.urgency-card {
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: var(--hairline);
}

.urgency-overdue  { border-left-color: var(--red-700) !important; }
.urgency-critical { border-left-color: var(--red-500) !important; }
.urgency-warning  { border-left-color: var(--amber-500) !important; }
.urgency-ok       { border-left-color: var(--green-500) !important; }

/* ── Dashboard section header com contagem ──────────────────────────────── */

.section-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--red-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ════════════════════════════════════════════════════════════════════════════
   LOGIN — Cena imersiva (tela cheia com glassmorphism)
   Substitui o layout de duas colunas — imagem como protagonista
   ════════════════════════════════════════════════════════════════════════════ */

/* Override no body da página de login */
.devise-body {
  background: #052e16;
  overflow: hidden;
}

/* Wrapper de cena — ocupa 100% da tela */
.lscene {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* ── Imagem hero (protagonista) ─────────────────────────────────────────── */

.lscene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.lscene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  /* Garante renderização nítida em alta resolução */
  image-rendering: -webkit-optimize-contrast;
}

/* Vinheta mínima — afeta apenas bordas, centro fica aberto */
.lscene-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,
      rgba(5,46,22,0.22)  0%,
      transparent         30%,
      transparent         55%,
      rgba(5,46,22,0.82) 100%),
    linear-gradient(to bottom,
      rgba(0,0,0,0.18)  0%,
      transparent       18%,
      transparent       78%,
      rgba(0,0,0,0.42) 100%);
}

/* ── Conteúdo da esquerda — sobreposto à foto ───────────────────────────── */

.lscene-left {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 44px 52px 56px;
  min-width: 0;
}

/* Marca no topo */
.lscene-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: rgba(5,46,22,0.55);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 99px;
  backdrop-filter: blur(14px);
  align-self: flex-start;
  text-decoration: none;
}

.lscene-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

/* Headline hero */
.lscene-headline { padding-bottom: 32px; }

.lscene-eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #4ade80;
  background: rgba(5,46,22,0.78);
  border: 1px solid rgba(74,222,128,0.45);
  padding: 7px 16px;
  border-radius: 99px;
  margin-bottom: 22px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-shadow: 0 0 18px rgba(74,222,128,0.60);
  box-shadow: 0 2px 16px rgba(5,46,22,0.50), inset 0 1px 0 rgba(255,255,255,0.06);
}

.lscene-title {
  font-size: 4.2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.02;
  letter-spacing: -0.05em;
  margin: 0 0 20px;
  text-shadow: 0 2px 32px rgba(0,0,0,0.35), 0 0 80px rgba(0,0,0,0.20);
}

.lscene-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.65;
  margin: 0;
  text-shadow: 0 1px 8px rgba(0,0,0,0.30);
}

/* Chips de features */
.lscene-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lscene-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 15px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 99px;
  backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.90);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Painel de vidro — formulário ───────────────────────────────────────── */

.lglass {
  position: relative;
  z-index: 2;
  width: 460px;
  flex-shrink: 0;
  background: rgba(5,46,22,0.68);
  backdrop-filter: blur(36px) saturate(160%) brightness(0.9);
  -webkit-backdrop-filter: blur(36px) saturate(160%) brightness(0.9);
  border-left: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  animation: lglass-slide 0.6s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes lglass-slide {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

.lglass-inner {
  width: 100%;
  padding: 48px 44px;
}

/* Logo */
.lglass-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.lglass-logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lglass-logo-name {
  font-size: 1.0rem;
  font-weight: 700;
  color: rgba(255,255,255,0.90);
  letter-spacing: -0.01em;
}

/* Header */
.lglass-header {
  margin-bottom: 28px;
}

.lglass-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.lglass-header p {
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  margin: 0;
}

/* Erros */
.lglass-errors {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(220,38,38,0.18);
  border: 1px solid rgba(220,38,38,0.40);
  border-left: 3px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 11px 14px;
  margin-bottom: 20px;
  color: #fca5a5;
  font-size: 0.875rem;
}

.lglass-errors ul { margin: 0; padding: 0; list-style: none; }
.lglass-errors li { padding: 2px 0; font-weight: 500; }

/* Campos */
.lglass-field { margin-bottom: 18px; }

.lglass-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.01em;
}

.lglass-input-wrap { position: relative; }

.lglass-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  line-height: 1;
}

.lglass-input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.lglass-input:focus {
  outline: none;
  background: rgba(255,255,255,0.13);
  border-color: #4ade80;
  box-shadow: 0 0 0 3px rgba(74,222,128,0.18);
}

.lglass-input::placeholder { color: rgba(255,255,255,0.28); }

/* Campo de senha com espaço para o botão olho */
.lglass-pwd-wrap .lglass-input { padding-right: 44px; }

/* Botão olho — toggle de visibilidade da senha */
.lglass-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
  /* sobrescreve estilos globais de button */
  width: auto;
  letter-spacing: normal;
  text-transform: none;
  font-weight: normal;
  box-shadow: none;
  line-height: 1;
}

.lglass-eye-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
  transform: translateY(-50%);
  box-shadow: none;
}

/* Lembrar / Esqueceu */
.lglass-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 22px;
}

.lglass-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
}

.lglass-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #4ade80;
  flex-shrink: 0;
}

.lglass-forgot {
  font-size: 0.85rem;
  color: #86efac;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.lglass-forgot:hover { color: #4ade80; text-decoration: underline; }

/* Botão */
.lglass-submit {
  display: block;
  width: 100%;
  padding: 14px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(22,163,74,0.45);
  margin-bottom: 28px;
}

.lglass-submit:hover {
  background: #15803d;
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(22,163,74,0.55);
}

.lglass-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(22,163,74,0.30);
}

/* Nota de rodapé */
.lglass-note {
  text-align: center;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.32);
  margin: 0;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════════════
   USO DO SISTEMA — USER ACTIVITIES DASHBOARD
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Header do perfil do usuário ─────────────────────────────────────────── */
.ua-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--canvas);
  border: 1.5px solid var(--fog);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ua-profile-header h1 { margin: 0; font-size: 1.4rem; }
.ua-profile-header .page-actions { margin-left: auto; }

.ua-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ua-avatar-img     { width: 100%; height: 100%; object-fit: cover; }
.ua-avatar-initials { font-size: 1.4rem; font-weight: 700; color: #fff; letter-spacing: -0.03em; }

.ua-profile-info { flex: 1; min-width: 0; }
.ua-profile-info .dashboard-subtitle { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Badges de tipo de atividade ─────────────────────────────────────────── */
.ua-kind-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.ua-kind-page_view { background: #eff6ff; color: var(--primary-deep); }
.ua-kind-create    { background: var(--green-100); color: var(--green-800); }
.ua-kind-update    { background: var(--amber-50); color: var(--amber-800); }
.ua-kind-delete    { background: var(--red-100); color: var(--red-700); }
.ua-kind-export    { background: #ecfeff; color: #0e7490; }

/* ══════════════════════════════════════════════════════════════════════════
   UTILITÁRIOS DE TABELA E VISUALIZAÇÃO
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Empty state de tabela ──────────────────────────────────────────────── */
.empty-state-table {
  text-align: center;
  padding: 56px 24px 48px;
  background: var(--cloud);
  border-radius: var(--radius-md);
  margin: 0;
}
.empty-state-table .empty-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 14px;
  line-height: 1;
}
.empty-state-table .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: 0 0 6px;
}
.empty-state-table .empty-desc {
  font-size: 0.875rem;
  color: var(--graphite);
  margin: 0 0 20px;
}

/* ── Tag de produto (lista compacta em célula de tabela) ─────────────────── */
.product-tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--fog);
  color: var(--charcoal);
  margin: 1px;
  font-weight: 500;
}

/* ── Badge de segmento (metas) ───────────────────────────────────────────── */
.segment-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  background: var(--amber-50);
  color: var(--amber-800);
  white-space: nowrap;
}

/* ── Célula de cliente com sub-informação ────────────────────────────────── */
.customer-name-link {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: block;
}
.customer-name-link:hover { color: var(--primary); }
.customer-meta {
  font-size: 0.78rem;
  color: var(--graphite);
  margin-top: 2px;
}

/* ── Barra de progresso compacta (tabela de metas) ───────────────────────── */
.table-progress-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 130px;
}
.table-progress-track {
  flex: 1;
  height: 6px;
  background: var(--fog);
  border-radius: 3px;
  overflow: hidden;
}
.table-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.table-progress-fill.bar-full { background: var(--green-600); }
.table-progress-fill.bar-good { background: var(--amber-500); }
.table-progress-fill.bar-low  { background: var(--red-500); }
.table-progress-pct {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}
.table-progress-pct.bar-full { color: var(--green-700); }
.table-progress-pct.bar-good { color: var(--amber-600); }
.table-progress-pct.bar-low  { color: var(--red-600); }

/* ── Célula de contagem com unidade (movimentações) ─────────────────────── */
.count-cell {
  text-align: center;
  white-space: nowrap;
}
.count-cell .count-num  { font-weight: 600; }
.count-cell .count-unit { color: var(--steel); font-size: 0.78rem; margin-left: 2px; }

/* ── Coluna de período de texto secundário ───────────────────────────────── */
.period-cell {
  font-size: 0.82rem;
  color: var(--graphite);
  white-space: nowrap;
}

/* ── Coluna de código/ID ─────────────────────────────────────────────────── */
.code-cell {
  font-size: 0.82rem;
  color: var(--steel);
  font-family: ui-monospace, 'SF Mono', monospace;
}

/* ── Botão de impressão (ícone SVG) ─────────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  border: 1.5px solid var(--fog);
  background: var(--canvas);
  color: var(--charcoal);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.btn-icon:hover { background: var(--cloud); border-color: var(--steel); }
.btn-icon svg   { flex-shrink: 0; }

/* ── Texto de estoque normal (sem badge, sutíl) ──────────────────────────── */
.stock-normal {
  color: var(--graphite);
  font-size: 0.82rem;
}

/* Oculto na tela, aparece apenas no @media print */
.print-list-header { display: none; }

/* ── Sobre o Sistema ────────────────────────────────────────────────────── */

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 900px;
}

.about-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
}

.about-card-main {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 32px;
  border-top: 4px solid var(--green-600);
}

.about-logo-wrap {
  margin-bottom: 16px;
}

.about-logo {
  max-height: 72px;
  max-width: 220px;
  object-fit: contain;
}

.about-logo-placeholder {
  font-size: 3.5rem;
}

.about-system-name {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--green-700);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.about-system-desc {
  font-size: 0.88rem;
  color: var(--graphite);
  line-height: 1.6;
  max-width: 520px;
  margin-bottom: 24px;
}

.about-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--green-50, #f0fdf4);
  border: 1.5px solid var(--green-200, #bbf7d0);
  border-radius: 999px;
  padding: 8px 22px;
  margin-bottom: 10px;
}

.about-version-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-700);
}

.about-version-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-700);
  font-variant-numeric: tabular-nums;
}

.about-build-date {
  font-size: 0.8rem;
  color: var(--graphite);
}

.about-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.about-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.85rem;
}

.about-field dt {
  color: var(--graphite);
  flex-shrink: 0;
}

.about-field dd {
  color: var(--charcoal);
  font-weight: 500;
  text-align: right;
}

.about-env-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}

.about-env-production  { background: #dcfce7; color: #166534; }
.about-env-development { background: #fef9c3; color: #854d0e; }
.about-env-test        { background: #e0e7ff; color: #3730a3; }

.about-card-dev {
  grid-column: 1 / -1;
  border-top: 3px solid var(--border);
}

.about-dev-info {
  margin-bottom: 14px;
}

.about-dev-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 4px;
}

.about-dev-contact a {
  font-size: 0.87rem;
  color: var(--green-700);
  text-decoration: none;
}

.about-dev-contact a:hover { text-decoration: underline; }

.about-copyright {
  font-size: 0.78rem;
  color: var(--graphite);
  line-height: 1.7;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .lglass { width: 420px; }
  .lscene-title { font-size: 3.4rem; }
  .lglass-inner { padding: 40px 36px; }
}

@media (max-width: 860px) {
  .lscene { flex-direction: column; }
  .lscene-left {
    padding: 32px 28px;
    flex: none;
    height: 52vh;
    justify-content: flex-start;
    gap: 20px;
  }
  .lscene-title { font-size: 2.4rem; }
  .lscene-sub   { display: none; }
  .lglass { width: 100%; height: auto; border-left: none; border-top: 1px solid rgba(255,255,255,0.10); animation: none; }
  .lglass-inner { padding: 32px 24px; }
  .lscene-img   { object-position: center 10%; }
}

@media (max-width: 480px) {
  .lscene-left  { padding: 24px 20px; height: 44vh; }
  .lscene-title { font-size: 1.9rem; }
  .lscene-chips { display: none; }
  .lglass-inner { padding: 28px 20px; }
}
