/* RESTAURAR DASHBOARD — Paleta Borgonha + Dourado */
:root {
  --burgundy-deep: #3D1A30;
  --burgundy: #5C2D4B;
  --burgundy-light: #7E3B5F;
  --burgundy-pale: #F0E2EC;
  --gold-dark: #B88A1E;
  --gold: #D4A537;
  --gold-light: #E5BD56;
  --gold-pale: #F9EFD4;
  --cream: #FAF5EC;
  --cream-soft: #F5E8DD;
  --charcoal: #1A2538;
  --charcoal-soft: #2D3D52;
  --gray: #8B8B80;
  --gray-light: #D5D5CC;
  --white: #FFFFFF;
  --success: #2D7A3E;
  --warning: #B88A1E;
  --danger: #B82E2E;
  --info: #3666A8;
  --shadow-sm: 0 2px 8px rgba(26, 37, 56, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 37, 56, 0.10);
  --shadow-lg: 0 16px 40px rgba(26, 37, 56, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; text-decoration: none; }

/* LOGIN */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cream) 0%, var(--cream-soft) 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(92, 45, 75, 0.08);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 6px;
}
.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--burgundy), var(--burgundy-deep));
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--burgundy-deep);
  letter-spacing: -0.02em;
}
.login-subtitle {
  text-align: center;
  color: var(--gold-dark);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 32px;
}
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card label {
  font-weight: 500;
  color: var(--charcoal-soft);
  font-size: 0.84rem;
  margin-top: 12px;
}
.login-card input {
  padding: 14px 16px;
  border: 1.5px solid rgba(92, 45, 75, 0.15);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s;
  background: var(--cream);
}
.login-card input:focus { border-color: var(--burgundy); background: white; }
.btn-primary {
  margin-top: 24px;
  padding: 14px 24px;
  background: var(--burgundy);
  color: white;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--burgundy-deep); }
.btn-ghost {
  padding: 9px 16px;
  background: white;
  color: var(--burgundy-deep);
  border: 1px solid rgba(92, 45, 75, 0.15);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.86rem;
}
.btn-ghost:hover { background: var(--burgundy-pale); }
.btn-gold {
  padding: 10px 18px;
  background: var(--gold);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.86rem;
}
.btn-gold:hover { background: var(--gold-dark); }
.btn-danger {
  padding: 9px 16px;
  background: white;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.86rem;
}
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success {
  padding: 11px 18px;
  background: var(--success);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
}
.btn-success:hover { background: #1F5A2A; }
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
}

/* APP */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--burgundy-deep) 0%, var(--burgundy) 100%);
  color: white;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar .logo-mark { background: rgba(255,255,255,0.12); color: var(--gold-light); }
.sidebar .logo-text { color: white; font-size: 1.3rem; }
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: white; }
.sidebar-nav a.active {
  background: rgba(212,165,55,0.18);
  color: var(--gold-light);
  font-weight: 600;
}
.sidebar-nav .ic { font-size: 1.15rem; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.su-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}
.su-info { flex: 1; min-width: 0; }
.su-name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-role { font-size: 0.74rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.06em; }
.su-logout {
  color: rgba(255,255,255,0.6);
  font-size: 1.3rem;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s;
}
.su-logout:hover { color: white; background: rgba(255,255,255,0.1); }

.main { flex: 1; padding: 36px 40px; max-width: 1500px; }
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.view-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 500;
  font-size: 2.1rem;
  color: var(--charcoal);
  letter-spacing: -0.02em;
}
.view-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input, .filter-select {
  padding: 10px 14px;
  border: 1px solid rgba(92,45,75,0.15);
  border-radius: var(--radius-md);
  background: white;
  outline: none;
  font-size: 0.88rem;
  transition: border-color 0.2s;
}
.search-input { min-width: 250px; }
.search-input:focus, .filter-select:focus { border-color: var(--burgundy); }

/* STATUS STRIP */
.status-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.ss-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid rgba(92,45,75,0.08);
  cursor: pointer;
  transition: all 0.2s;
}
.ss-card:hover { border-color: var(--burgundy); transform: translateY(-2px); }
.ss-card.active { border-color: var(--burgundy); background: var(--burgundy-pale); }
.ss-label { font-size: 0.72rem; color: var(--charcoal-soft); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.ss-value { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 600; color: var(--burgundy-deep); line-height: 1.1; margin-top: 4px; }

/* ORDERS LIST */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid rgba(92,45,75,0.08);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}
.order-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--burgundy-light); }
.oc-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--gold-dark);
  font-weight: 600;
  background: var(--gold-pale);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}
.oc-customer { min-width: 0; }
.oc-name { font-weight: 600; font-size: 1rem; color: var(--charcoal); margin-bottom: 2px; }
.oc-meta { font-size: 0.82rem; color: var(--charcoal-soft); }
.oc-total { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 600; color: var(--burgundy-deep); }
.oc-status { display: flex; gap: 8px; align-items: center; }
.status-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-new { background: #FEE; color: var(--danger); }
.status-contacting { background: var(--gold-pale); color: var(--gold-dark); }
.status-confirmed { background: #E3EEFF; color: var(--info); }
.status-in_delivery { background: #DCEDC8; color: #558B2F; }
.status-delivered { background: #C8E6C9; color: var(--success); }
.status-closed { background: #B9F0C5; color: var(--success); }
.status-cancelled { background: #ECECEC; color: var(--gray); text-decoration: line-through; }

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid rgba(92,45,75,0.08);
}
.stat-card.highlight { background: linear-gradient(135deg, var(--burgundy) 0%, var(--burgundy-deep) 100%); color: white; }
.stat-card.gold { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%); color: white; }
.stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; margin-bottom: 8px; font-weight: 500; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 600; line-height: 1.1; }
.stat-sub { font-size: 0.84rem; margin-top: 6px; opacity: 0.75; }

.stats-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid rgba(92,45,75,0.08);
  margin-bottom: 24px;
}
.stats-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--burgundy-deep);
  margin-bottom: 18px;
  font-weight: 500;
}
.product-lot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.pl-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--cream);
  border-radius: var(--radius-md);
}
.pl-qty {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--burgundy);
}
.pl-name { font-size: 0.88rem; font-weight: 500; flex: 1; margin-right: 12px; }
.pl-total { font-size: 0.78rem; color: var(--gray); }

.range-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.range-controls input { padding: 9px 14px; border-radius: var(--radius-md); border: 1px solid rgba(92,45,75,0.15); }

/* USERS */
.users-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.user-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid rgba(92,45,75,0.08);
  display: flex;
  gap: 14px;
  align-items: center;
}
.uc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--burgundy-light), var(--burgundy));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  flex-shrink: 0;
}
.uc-info { flex: 1; min-width: 0; }
.uc-name { font-weight: 600; }
.uc-email { font-size: 0.82rem; color: var(--gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-role {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-block;
  margin-top: 4px;
}
.role-admin { background: var(--burgundy-pale); color: var(--burgundy-deep); }
.role-manager { background: var(--gold-pale); color: var(--gold-dark); }
.role-agent { background: #E3F2FD; color: var(--info); }

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 37, 56, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  padding: 40px;
  position: relative;
}
.modal-small { max-width: 460px; }
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(26,37,56,0.06);
  font-size: 1.2rem;
}
.modal-close:hover { background: rgba(26,37,56,0.12); }
.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: var(--burgundy-deep);
  font-weight: 500;
}
.modal form { display: flex; flex-direction: column; gap: 6px; }
.modal label { font-size: 0.84rem; color: var(--charcoal-soft); font-weight: 500; margin-top: 12px; }
.modal input, .modal select, .modal textarea {
  padding: 12px 14px;
  border: 1px solid rgba(92,45,75,0.15);
  border-radius: var(--radius-md);
  outline: none;
  font-size: 0.92rem;
  background: var(--cream);
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--burgundy); background: white; }

/* ORDER DETAIL */
.od-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(92,45,75,0.1);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.od-code { font-family: 'JetBrains Mono', monospace; color: var(--gold-dark); font-weight: 700; font-size: 0.92rem; }
.od-customer-name { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 500; color: var(--charcoal); margin-top: 6px; }
.od-section { margin-bottom: 22px; }
.od-section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dark);
  font-weight: 600;
  margin-bottom: 10px;
}
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 0.92rem; }
.od-grid .k { color: var(--charcoal-soft); }
.od-grid .v { font-weight: 500; }
.od-items { background: var(--cream); border-radius: var(--radius-md); padding: 16px 18px; }
.od-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(92,45,75,0.08);
  font-size: 0.92rem;
}
.od-item:last-child { border-bottom: none; padding-top: 12px; margin-top: 4px; border-top: 2px solid rgba(92,45,75,0.2); font-weight: 600; }
.od-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.od-history {
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.86rem;
}
.od-history-item { padding: 6px 0; color: var(--charcoal-soft); }
.od-history-item .ts { color: var(--gray); font-size: 0.78rem; margin-right: 8px; }

/* MOBILE */
@media (max-width: 900px) {
  .sidebar { width: 70px; }
  .sidebar-logo .logo-text, .sidebar-nav a span:not(.ic), .su-info { display: none; }
  .sidebar-nav { padding: 20px 8px; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .main { padding: 24px 18px; }
  .status-strip { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .order-card { grid-template-columns: 1fr; gap: 10px; }
  .modal { padding: 28px 22px; }
}
