:root {
  /* Default Theme (Light: White / Orange) */
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-border: #e2e8f0;
  
  --primary-color: #f97316; /* Orange 500 */
  --primary-hover: #ea580c; /* Orange 600 */
  --secondary-hover-text: #9a3412; /* Orange 800: contraste AA no tema claro */
  
  --text-color: #0f172a;
  --text-muted: #64748b;
  
  --danger-color: #ef4444; 
  --success-color: #10b981; 
  --warning-color: #f59e0b; 
  
  --font-family: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --surface-border: #334155;
  
  --primary-color: #f97316; /* Orange */
  --primary-hover: #fb923c; 
  --secondary-hover-text: #fdba74; /* Orange 300: contraste AA no tema escuro */
  
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Classes (adjusted for solid/clean look based on user request) */
.glass-panel {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .glass-panel {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  color: white;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-secondary {
  background: var(--surface-border);
  color: var(--text-color);
  border: 1px solid var(--text-muted);
}

.btn-secondary:hover {
  background: var(--bg-color);
  color: var(--secondary-hover-text);
  border-color: var(--primary-color);
}

.btn-reschedule {
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-icon {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--surface-border);
  padding: 0.5rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--surface-border);
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--bg-color);
  border: 1px solid var(--surface-border);
  color: var(--text-color);
  font-family: var(--font-family);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* Auth Layouts */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.auth-logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-container img {
  max-width: 150px;
  height: auto;
  margin-bottom: 1rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
}

.auth-subtitle {
  color: var(--primary-color);
  font-weight: 500;
  font-size: 0.9rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning-color);
  color: var(--warning-color);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

/* General Layout */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--surface-color);
  border-bottom: 1px solid var(--surface-border);
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  box-sizing: border-box;
  position: relative;
  background: var(--surface-color);
  border-right: 1px solid var(--surface-border);
  padding: 1.5rem 1rem;
  transition: width 0.25s ease, flex-basis 0.25s ease, padding 0.25s ease;
}

.sidebar > ul {
  margin-top: 2.25rem !important;
  transition: opacity 0.15s ease;
}

.sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  right: -14px;
  z-index: 20;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  background: var(--surface-color);
  color: var(--primary-color);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.sidebar-toggle:hover {
  background: rgba(249, 115, 22, 0.1);
}

.sidebar.sidebar-collapsed {
  width: 52px;
  flex-basis: 52px;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.sidebar-collapsed > ul {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  background: rgba(249, 115, 22, 0.1);
  color: var(--primary-color);
}

.sidebar-submenu {
  list-style: none;
  margin: -0.2rem 0 0.5rem;
  padding: 0 0 0 1rem;
}

.sidebar-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-group-chevron {
  transition: transform 0.2s ease;
}

.sidebar-menu-group.submenu-open .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-submenu-link {
  display: block;
  padding: 0.45rem 1rem;
  border-left: 2px solid var(--surface-border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
}

.sidebar-submenu-link:hover, .sidebar-submenu-link.active {
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.report-submenu {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--surface-border);
}

.report-submenu-link {
  padding: 0.7rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
}

.report-submenu-link:hover, .report-submenu-link.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
}

.table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 64px);
  min-width: 0;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2rem;
  overflow: auto;
}

.mechanics-page {
  width: 100%;
  box-sizing: border-box;
}

.mechanics-table-shell {
  width: 100%;
  box-sizing: border-box;
  padding: 1.25rem;
  overflow-x: auto;
}

.mechanics-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.mechanics-table th,
.mechanics-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--surface-border);
}

.mechanics-table th {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.mechanics-table td:nth-child(n+7) {
  text-align: center;
}

.order-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(240px, 1.4fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.order-filters .form-group {
  margin-bottom: 0;
}

.order-filter-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 1200px) {
  .order-filters { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}

@media (max-width: 760px) {
  .app-main { padding: 1rem; }
  .order-filters { grid-template-columns: 1fr; }
  .order-filter-actions .btn { flex: 1; }
}
