/* ============================
   Design Tokens
   ============================ */
:root {
  --primary:        #dc2626;
  --primary-hover:  #b91c1c;
  --primary-light:  #fef2f2;
  --primary-border: #fecaca;

  --sidebar-bg:     #0f172a;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active: rgba(220,38,38,.25);
  --sidebar-text:   #94a3b8;
  --sidebar-active-text: #f87171;

  --surface:        #ffffff;
  --bg:             #f1f5f9;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  --text:           #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --success-border: #bbf7d0;

  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --warning-border: #fde68a;

  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --danger-border:  #fecaca;

  --info:           #2563eb;
  --info-light:     #eff6ff;
  --info-border:    #bfdbfe;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  --shadow-xs:  0 1px 2px rgba(15,23,42,.05);
  --shadow:     0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md:  0 4px 6px -1px rgba(15,23,42,.08), 0 2px 4px -1px rgba(15,23,42,.04);
  --shadow-lg:  0 10px 25px -3px rgba(15,23,42,.1), 0 4px 8px -2px rgba(15,23,42,.06);
  --shadow-xl:  0 20px 40px -6px rgba(15,23,42,.15), 0 8px 16px -4px rgba(15,23,42,.08);

  --transition: 0.18s ease;
}

/* ============================
   Base
   ============================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================
   Sidebar
   ============================ */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.01em;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 1px;
}

.sidebar-status {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(217,119,6,.15);
  color: #fbbf24;
  font-weight: 500;
}

.sidebar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fbbf24;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(148,163,184,.5);
  padding: 8px 10px 6px;
  margin-top: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  position: relative;
}

.menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .75;
}

.menu-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.menu-item:hover svg { opacity: 1; }

.menu-item-active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.menu-item-active svg {
  opacity: 1;
  color: var(--sidebar-active-text);
}

.menu-item-active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--primary);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: 11px;
  color: rgba(148,163,184,.5);
}

/* ============================
   Topbar
   ============================ */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.topbar-user-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--border-light);
  color: var(--text-secondary);
}

.topbar-logout {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.topbar-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.topbar-logout svg {
  width: 14px;
  height: 14px;
}

/* ============================
   Cards de superfície
   ============================ */
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card-surface:hover {
  box-shadow: var(--shadow);
}

/* Stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon-warning  { background: var(--warning-light); color: var(--warning); }
.stat-icon-success  { background: var(--success-light); color: var(--success); }
.stat-icon-info     { background: var(--info-light);    color: var(--info); }
.stat-icon-primary  { background: var(--primary-light); color: var(--primary); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================
   Badges de status
   ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-pending  { background: var(--warning-light);  color: var(--warning);  border: 1px solid var(--warning-border); }
.badge-pending::before  { background: var(--warning); }

.badge-accepted { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-accepted::before { background: var(--success); }

.badge-rejected { background: var(--danger-light);  color: var(--danger);  border: 1px solid var(--danger-border); }
.badge-rejected::before { background: var(--danger); }

.badge-default  { background: var(--border-light);  color: var(--text-secondary); border: 1px solid var(--border); }
.badge-default::before  { background: var(--text-muted); }

/* ============================
   Botões
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(220,38,38,.3);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 3px 8px rgba(220,38,38,.35); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 1px 2px rgba(22,163,74,.3);
}
.btn-success:hover { background: #15803d; }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-soft {
  background: var(--border-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-soft:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================
   Tabelas
   ============================ */
.table-wrapper {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead tr {
  background: #f8fafc;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th:last-child { text-align: right; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table td:last-child { text-align: right; }

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: #fafbfc;
  cursor: pointer;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .col-id {
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.data-table .col-name {
  font-weight: 600;
  color: var(--text);
}

.data-table .col-amount {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ============================
   Pending Order Card
   ============================ */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.order-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.order-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--warning-light);
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.order-card-icon svg { width: 18px; height: 18px; }

.order-card-body { flex: 1; min-width: 0; }

.order-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.order-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.order-card-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.order-card-chevron {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.order-card-chevron svg { width: 16px; height: 16px; }

/* ============================
   Drawer (cortina lateral)
   ============================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  width: 420px;
  max-width: calc(100vw - 48px);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.drawer-close:hover { background: var(--border); color: var(--text); }
.drawer-close svg { width: 16px; height: 16px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.drawer-info-row:last-child { border-bottom: none; }

.drawer-info-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: 1px;
}
.drawer-info-icon svg { width: 13px; height: 13px; }

.drawer-info-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.drawer-info-value {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}

.drawer-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}

.drawer-item-name {
  font-weight: 600;
  color: var(--text);
}

.drawer-item-qty {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.drawer-item-price {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.drawer-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}

.drawer-total-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.drawer-total-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ============================
   Modal
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--warning-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--warning);
  flex-shrink: 0;
}
.modal-icon svg { width: 22px; height: 22px; }

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-body {
  padding: 16px 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.modal-footer {
  padding: 12px 20px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================
   Empty state
   ============================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 8px;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.empty-state-icon svg { width: 24px; height: 24px; }

.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.empty-state-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================
   Live indicator (pulsing dot)
   ============================ */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
}

.live-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--success);
  opacity: .3;
  animation: ping 1.5s cubic-bezier(0,0,.2,1) infinite;
}

@keyframes ping {
  0%   { transform: scale(1); opacity: .3; }
  75%, 100% { transform: scale(2); opacity: 0; }
}

/* ============================
   Section header
   ============================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ============================
   Utility
   ============================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.text-right { text-align: right; }
.font-mono { font-family: ui-monospace, monospace; }
