:root {
  --brand-orange: #e68a2e;
  --brand-orange-dark: #c9721b;
  --brand-dark: #1e2022;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1e2022;
  --muted: #64748b;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e2022 0%, #2f3337 100%);
}

.auth-card {
  background: var(--card);
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.auth-logo {
  max-width: 240px;
  max-height: 200px;
  width: auto;
  height: auto;
  margin-bottom: 12px;
  border-radius: 6px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--brand-dark);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  padding: 6px 8px;
  background: #ffffff;
  border-bottom: 4px solid var(--brand-orange);
  text-align: center;
}

.sidebar-logo {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #e2e8f0;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  background: var(--brand-orange);
  color: #ffffff;
  font-weight: 700;
}

.nav-item.nav-highlight:not(.active) {
  background: rgba(230, 138, 46, 0.18);
  color: #ffd8ad;
  border: 1px solid rgba(230, 138, 46, 0.4);
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border-bottom: 3px solid var(--brand-orange);
  position: sticky;
  top: 0;
  z-index: 30;
}

.mobile-logo {
  height: 36px;
  object-fit: contain;
}

.main-content {
  flex: 1;
  padding: 22px 26px;
  min-width: 0;
}

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

.page-header h1 {
  margin: 0;
  font-size: 1.55rem;
}

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

.card-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand-orange);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  margin-top: 4px;
  color: var(--brand-dark);
}

/* Forms & Inputs */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #334155;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.96rem;
  background: #ffffff;
  color: var(--text);
  min-height: 42px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand-orange);
  border-color: var(--brand-orange);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-lg {
  min-height: 48px;
  font-size: 1.05rem;
  padding: 12px 20px;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--brand-orange);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-orange-dark);
}

.btn-dark {
  background: var(--brand-dark);
  color: #ffffff;
}

.btn-dark:hover:not(:disabled) {
  background: #33373b;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: #f8fafc;
}

.sidebar-footer .btn-outline {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr:hover td {
  background: #fcfcfd;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-aberta,
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-fechada,
.badge-ativo,
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-cancelada,
.badge-inativo,
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-orange {
  background: var(--brand-orange);
  color: #ffffff;
}

.badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

/* Alerts & Toasts */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--brand-dark);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  border-left: 4px solid var(--brand-orange);
}

.toast.error {
  border-left-color: #ef4444;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-box {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

/* Quick search dropdown */
.search-results {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  margin-top: 6px;
}

.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.search-result-item:hover {
  background: #fff7ed;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.withdrawal-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #ffffff;
}

.withdrawal-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--brand-dark);
  color: #ffffff;
  border-color: var(--brand-dark);
}

/* Responsive */
@media (max-width: 960px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }
  .mobile-header {
    display: flex;
  }
  .sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    bottom: 0;
    transition: left 0.2s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 35;
  }
  .main-content {
    padding: 14px;
  }
  .grid-4,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
